/*******************************************************************************
*
* McStas, the neutron ray-tracing package: Guide_four_side_inlay.comp
*
* Component: Guide_four_side_10_shells
*
* %I
* Written by: Tobias Panzner
* Date: 02/12/2009
* Version: $Revision: 1.0 $
* Release: McStas 1.12b
* Origin: PSI
*
* %D
*  This component models a guide with four side walls surounded by up to 10 shells (every shell consists of 
*  additional four walls). In the  end it  forms a guide with an inner and up to 10 outer channel.
*  As user you can controll the properties of every wall separatly. All togther you have up to 
*  88 walls: From the inner channel 4 inner walls and four outer walls and from every outer
*  channel 4 inner and 4 outer walls.
* 
*  Every single wall can have a elliptic, parabolic or straight shape.
*  All four sides of the guide are independent from each other.
*  In the elliptic case the side wall shape follows the equation x^2/b^2+(z+z0)^2/a^2=1
*  (the center of the ellipse is located at (0,-z0)).
*  In the parabolic case the side wall shape follows the equation z=b-ax^2;mc
*  In the straight case the side wall shape follows the equation z=l/(w2-w1)*x-w1.
*
*  The shape selection is done by the focal points. The focal points are located at the 
*  z-axis and are defined by their distance to the entrance or exit window of the guide
*  (in the following called 'focal length').
*
*  If both focal lengths for one wall are zero it will be a straight wall (entrance and 
*  exit width have to be given in the beginning).
*
*  If one of the focal lengths is not zero the shape will be parabolic (only the entrance width 
*  given in the beginning is recognized; exit width will be calculated). If the the entrance 
*  focal length is zero the guide will be a focusing devise.
*  If the exit focal length is zero it will be defocusing devise.
*
*  If both focals are non zero the shape of the wall will be elliptic (only the entrance width 
*  given in the beginning is recognized; exit width will be calculated). 
*
*  Notice: 1.)The focal points are in general located outside the guide (positive focal lengths).
*             Focal points inside the guide need to have negative focal lengths.
*          2.)The exit width parameters (w2r, w2l, h2u,h2d) are only taken into account if the 
*             walls have a linear shape. In the ellitic or parabolic case they will be ignored.
*
*  For the inner channel: the outer side of each wall is calculated by the component in depentence 
*  of the wallthickness and the shape of the inner side.
*
*  Each of the 88 walls can have a own indepenting reflecting layer (defined by an input file) 
*  or it can be a absorber or it can be transparent.
*
*  The reflectivity properties can be given by an input file (Format [q(Angs-1) R(0-1)]) or by 
*  parameters (Qc, alpha, m, W).
*
* %BUGS
* This component does not work with gravitation on.
*
* This component does not work correctly in GROUP-modus.
*
* %P
* INPUT PARAMETERS:
*
* GENERAL PARAMETERS (VALID FOR ALL SIDES):
*
* l:       [m]    length of guide (DEFAULT = 0)
*
* R0:      [1]    Low-angle reflectivity (DEFAULT = 0.99)
*
* THE INNER WALLS OF THE INLAY ARE DEFINED BY:
*
* w1r:     [m]    Width at the right guide entry   (negative x-axis)
*                 (DEFAULT = 0)
*
* w2r:     [m]    Width at the right guide exit    (negative x-axis)
*                 (DEFAULT = 0)
*
* w1l:     [m]    Width at the left guide entry    (positive x-axis)
*                 (DEFAULT = 0)
*
* w2l:     [m]    Width at the left guide exit     (positive x-axis)
*                 (DEFAULT = 0)
*
* h1d:     [m]    Height at the bottom guide entry (negative y-axis)
*                 (DEFAULT = 0)
*
* h2d:     [m]    Height at the bottom guide entry (negative y-axis)
*                 (DEFAULT = 0)
*
* h1u:     [m]    Height at the top guide entry    (positive y-axis)
*                 (DEFAULT = 0)
*
* h2u:     [m]    Height at the top guide entry    (positive y-axis)
*                 (DEFAULT = 0)
*
* linwr     [m]   right horizontal wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0)
*
* loutwr   [m]    right horizontal wall: distance of 2nd focal point
*                 and guide exit (DEFAULT = 0)
*
* linwl    [m]    left horizontal wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0)
*
* loutwl   [m]    left horizontal wall: distance of 2nd focal point
*                 and guide exit  (DEFAULT = 0)
*
* linhd    [m]    lower vertical wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0)
*
* louthd   [m]    lower vertical wall: distance of 2nd focal point
*                 and guide exit (DEFAULT = 0)
*
* linhu    [m]    upper vertical wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0) 
*
* louthu   [m]    upper vertical wall: distance of 2nd focal point
*                 and guide exit (DEFAULT = 0)
*
* RIreflect: (str)  Name of relfectivity file for the right inner wall.
*                   Format [q(Angs-1) R(0-1)]  (DEFAULT : no file)
*
* LIreflect: (str)  Name of relfectivity file for the left inner wall.
*                   Format [q(Angs-1) R(0-1)]   (DEFAULT : no file)
* 
* DIreflect: (str)  Name of relfectivity file for the bottom inner wall.
*                   Format [q(Angs-1) R(0-1)] (DEFAULT : no file)
*
* UIreflect: (str)  Name of relfectivity file for the top inner wall. 
*                   Format [q(Angs-1) R(0-1)]    (DEFAULT : no file)
*
* Qcxr:    [AA-1] Critical scattering vector for right vertical
*                 inner wall (DEFAULT = 0.0217)
*
* Qcxl:    [AA-1] Critical scattering vector for left vertical
*                 inner wall (DEFAULT = 0.0217)
*
* Qcyd:    [AA-1] Critical scattering vector for bottom inner wall
*                 (DEFAULT = 0.0217)
*
* Qcyu:    [AA-1] Critical scattering vector for top inner wall
*                 (DEFAULT = 0.0217)
*
* alphaxr: [AA]   Slope of reflectivity for right vertical
*                 inner wall (DEFAULT = 6.07)
*
* alphaxl: [AA]   Slope of reflectivity for left vertical
*                 inner wall (DEFAULT = 6.07)
*
* alphayd: [AA]   Slope of reflectivity for bottom inner wall
*                 (DEFAULT = 6.07)
*
* alphayu: [AA]   Slope of reflectivity for top inner wall
*                 (DEFAULT = 6.07)
*
* mxr:     [1]    m-value of material for right vertical inner wall.
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = 3.6)
*
* mxl:     [1]    m-value of material for left vertical inner wall.
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = 3.6)
*
* myd:     [1]    m-value of material for bottom inner wall
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = 3.6)
*
* myu:     [1]    m-value of material for top inner wall
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = 3.6)
*
* Wxr:       [AA-1] Width of supermirror cut-off for right inner wall
*                   (DEFAULT = 0.003)
*
* Wxl:       [AA-1] Width of supermirror cut-off for left inner wall
*                   (DEFAULT = 0.003)
*
* Wyu:       [AA-1] Width of supermirror cut-off for top inner wall
*                   (DEFAULT = 0.003)
*
* Wyd:       [AA-1] Width of supermirror cut-off for bottom inner wall
*                   (DEFAULT = 0.003)
*
* rwallthick: [m]   thickness of the right wall (DEFAULT = 0.001 m)
*
* lwallthick: [m]   thickness of the left wall  (DEFAULT = 0.001 m)
*
* uwallthick: [m]   thickness of the top wall   (DEFAULT = 0.001 m)
*
* dwallthick: [m]   thickness of the bottom wall(DEFAULT = 0.001 m)
*
*   THE OUTER WALLS OF THE INLAY ARE DEFINED BY: 
*
* ROreflect: (str)  Name of relfectivity file for the right outer wall.
*                   Format [q(Angs-1) R(0-1)]  (DEFAULT : no file)
*
* LOreflect: (str)  Name of relfectivity file for the left outer wall.
*                   Format [q(Angs-1) R(0-1)]   (DEFAULT : no file)
* 
* DOreflect: (str)  Name of relfectivity file for the bottom outer wall.
*                   Format [q(Angs-1) R(0-1)] (DEFAULT : no file)
*
* UOreflect: (str)  Name of relfectivity file for the top outer wall.
*                   Format [q(Angs-1) R(0-1)]    (DEFAULT : no file)
*
* QcxrOW:    [AA-1] Critical scattering vector for right vertical
*                   outer wall (DEFAULT = 0.0217)
*
* QcxlOW:    [AA-1] Critical scattering vector for left vertical
*                   outer wall (DEFAULT = 0.0217)
*
* QcydOW:    [AA-1] Critical scattering vector for bottom outer wall
*                   (DEFAULT = 0.0217)
*
* QcyuOW:    [AA-1] Critical scattering vector for top outer wall
*                   (DEFAULT = 0.0217)
*
* alphaxrOW: [AA]   Slope of reflectivity for right vertical
*                   outer wall (DEFAULT = 6.07)
*
* alphaxlOW: [AA]   Slope of reflectivity for left vertical
*                   outer wall (DEFAULT = 6.07)
*
* alphaydOW: [AA]   Slope of reflectivity for bottom outer wall
*                   (DEFAULT = 6.07)
*
* alphayuOW: [AA]   Slope of reflectivity for top outer wall
*                   (DEFAULT = 6.07)
*
* mxrOW:     [1]   m-value of material for right vertical outer wall
*                  0 means the wall is absorbing. (DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = 0)
*
* mxlOW:     [1]   m-value of material for left vertical outer wall
*                  0 means the wall is absorbing.(DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = 0)
*
* mydOW:     [1]   m-value of material for bottom outer wall
*                  0 means the wall is absorbing. (DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = 0)
*
* myuOW:     [1]   m-value of material for top outer wall
*                  0 means the wall is absorbing. (DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = 0)
*
* WxrOW:       [AA-1] Width of supermirror cut-off for right outer wall
*                     (DEFAULT = 0.003)
*
* WxlOW:       [AA-1] Width of supermirror cut-off for left outer wall
*                     (DEFAULT = 0.003)
*
* WyuOW:       [AA-1] Width of supermirror cut-off for top outer wall
*                     (DEFAULT = 0.003)
*
* WydOW:       [AA-1] Width of supermirror cut-off for bottom outer wall
*                     (DEFAULT = 0.003)
*
* THE INNER WALLS OF THE  @ OUTER CHANNEL ARE DEFINED BY:	
*
* w1r@:     [m]    Width at the right guide entry   (negative x-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* w2r@:     [m]    Width at the right guide exit    (negative x-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* w1l@:     [m]    Width at the left guide entry    (positive x-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* w2l@:     [m]    Width at the left guide exit     (positive x-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* h1d@:     [m]    Height at the bottom guide entry (negative y-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* h2d@:     [m]    Height at the bottom guide entry (negative y-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* h1u@:     [m]    Height at the top guide entry    (positive y-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* h2u@:     [m]    Height at the top guide entry    (positive y-axis)
*                 (DEFAULT = 2.000 + @*0.002)
*
* linwr@     [m]   right horizontal wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0)
*
* loutwr@   [m]    right horizontal wall: distance of 2nd focal point
*                 and guide exit (DEFAULT = 0)
*
* linwl@    [m]    left horizontal wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0)
*
* loutwl@   [m]    left horizontal wall: distance of 2nd focal point
*                 and guide exit  (DEFAULT = 0)
*
* linhd@    [m]    lower vertical wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0)
*
* louthd@   [m]    lower vertical wall: distance of 2nd focal point
*                 and guide exit (DEFAULT = 0)
*
* linhu@    [m]    upper vertical wall: distance of 1st focal point
*                 and guide entry (DEFAULT = 0) 
*
* louthu@   [m]    upper vertical wall: distance of 2nd focal point
*                 and guide exit (DEFAULT = 0)
*
* RIreflect@: (str)  Name of relfectivity file for the right inner wall.
*                   Format [q(Angs-1) R(0-1)]  (DEFAULT : no file)
*
* LIreflect@: (str)  Name of relfectivity file for the left inner wall.
*                   Format [q(Angs-1) R(0-1)]   (DEFAULT : no file)
* 
* DIreflect@: (str)  Name of relfectivity file for the bottom inner wall.
*                   Format [q(Angs-1) R(0-1)] (DEFAULT : no file)
*
* UIreflect@: (str)  Name of relfectivity file for the top inner wall. 
*                   Format [q(Angs-1) R(0-1)]    (DEFAULT : no file)
*
* Qcxr@:    [AA-1] Critical scattering vector for right vertical
*                 inner wall (DEFAULT = 0.0217)
*
* Qcxl@:    [AA-1] Critical scattering vector for left vertical
*                 inner wall (DEFAULT = 0.0217)
*
* Qcyd@:    [AA-1] Critical scattering vector for bottom inner wall
*                 (DEFAULT = 0.0217)
*
* Qcyu@:    [AA-1] Critical scattering vector for top inner wall
*                 (DEFAULT = 0.0217)
*
* alphaxr@: [AA]   Slope of reflectivity for right vertical
*                 inner wall (DEFAULT = 6.07)
*
* alphaxl@: [AA]   Slope of reflectivity for left vertical
*                 inner wall (DEFAULT = 6.07)
*
* alphayd@: [AA]   Slope of reflectivity for bottom inner wall
*                 (DEFAULT = 6.07)
*
* alphayu@: [AA]   Slope of reflectivity for top inner wall
*                 (DEFAULT = 6.07)
*
* mxr@:     [1]    m-value of material for right vertical inner wall.
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = -1)
*
* mxl@:     [1]    m-value of material for left vertical inner wall.
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = -1)
*
* myd@:     [1]    m-value of material for bottom inner wall
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = -1)
*
* myu@:     [1]    m-value of material for top inner wall
*                  0 means the wall is absorbing.
*		  -1 means the wall is transparent.
*                 (DEFAULT = -1)
*
* Wxr@:       [AA-1] Width of supermirror cut-off for right inner wall
*                   (DEFAULT = 0.003)
*
* Wxl@:       [AA-1] Width of supermirror cut-off for left inner wall
*                   (DEFAULT = 0.003)
*
* Wyu@:       [AA-1] Width of supermirror cut-off for top inner wall
*                   (DEFAULT = 0.003)
*
* Wyd@:       [AA-1] Width of supermirror cut-off for bottom inner wall
*                   (DEFAULT = 0.003)
*
*   THE OUTER WALLS THE  @ OUTER CHANNEL ARE DEFINED BY: 
*
* ROreflect@: (str)  Name of relfectivity file for the right outer wall.
*                   Format [q(Angs-1) R(0-1)]  (DEFAULT : no file)
*
* LOreflect@: (str)  Name of relfectivity file for the left outer wall.
*                   Format [q(Angs-1) R(0-1)]   (DEFAULT : no file)
* 
* DOreflect@: (str)  Name of relfectivity file for the bottom outer wall.
*                   Format [q(Angs-1) R(0-1)] (DEFAULT : no file)
*
* UOreflect@: (str)  Name of relfectivity file for the top outer wall.
*                   Format [q(Angs-1) R(0-1)]    (DEFAULT : no file)
*
* QcxrOW@:    [AA-1] Critical scattering vector for right vertical
*                   outer wall (DEFAULT = 0.0217)
*
* QcxlOW@:    [AA-1] Critical scattering vector for left vertical
*                   outer wall (DEFAULT = 0.0217)
*
* QcydOW@:    [AA-1] Critical scattering vector for bottom outer wall
*                   (DEFAULT = 0.0217)
*
* QcyuOW@:    [AA-1] Critical scattering vector for top outer wall
*                   (DEFAULT = 0.0217)
*
* alphaxrOW@: [AA]   Slope of reflectivity for right vertical
*                   outer wall (DEFAULT = 6.07)
*
* alphaxlOW@: [AA]   Slope of reflectivity for left vertical
*                   outer wall (DEFAULT = 6.07)
*
* alphaydOW@: [AA]   Slope of reflectivity for bottom outer wall
*                   (DEFAULT = 6.07)
*
* alphayuOW@: [AA]   Slope of reflectivity for top outer wall
*                   (DEFAULT = 6.07)
*
* mxrOW@:     [1]   m-value of material for right vertical outer wall
*                  0 means the wall is absorbing. (DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = -1)
*
* mxlOW@:     [1]   m-value of material for left vertical outer wall
*                  0 means the wall is absorbing.(DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = -1)
*
* mydOW@:     [1]   m-value of material for bottom outer wall
*                  0 means the wall is absorbing. (DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = -1)
*
* myuOW@:     [1]   m-value of material for top outer wall
*                  0 means the wall is absorbing. (DEFAULT)
*		  -1 means the wall is transparent.
*                  (DEFAULT = -1)
*
* WxrOW@:       [AA-1] Width of supermirror cut-off for right outer wall
*                     (DEFAULT = 0.003)
*
* WxlOW@:       [AA-1] Width of supermirror cut-off for left outer wall
*                     (DEFAULT = 0.003)
*
* WyuOW@:       [AA-1] Width of supermirror cut-off for top outer wall
*                     (DEFAULT = 0.003)
*
* WydOW@:       [AA-1] Width of supermirror cut-off for bottom outer wall
*                     (DEFAULT = 0.003)
* %End
*
******************************************************************************/

DEFINE COMPONENT Guide_four_side_10_shells
DEFINITION PARAMETERS(string RIreflect=0, LIreflect=0, UIreflect=0, DIreflect=0, ROreflect=0, LOreflect=0, UOreflect=0, DOreflect=0, RIreflect1=0, LIreflect1=0, UIreflect1=0, DIreflect1=0, ROreflect1=0, LOreflect1=0, UOreflect1=0, DOreflect1=0,RIreflect2=0, LIreflect2=0, UIreflect2=0, DIreflect2=0, ROreflect2=0, LOreflect2=0, UOreflect2=0, DOreflect2=0, RIreflect3=0, LIreflect3=0, UIreflect3=0, DIreflect3=0, ROreflect3=0, LOreflect3=0, UOreflect3=0, DOreflect3=0,RIreflect4=0, LIreflect4=0, UIreflect4=0, DIreflect4=0, ROreflect4=0, LOreflect4=0, UOreflect4=0, DOreflect4=0, RIreflect5=0, LIreflect5=0, UIreflect5=0, DIreflect5=0, ROreflect5=0, LOreflect5=0, UOreflect5=0, DOreflect5=0,RIreflect6=0, LIreflect6=0, UIreflect6=0, DIreflect6=0, ROreflect6=0, LOreflect6=0, UOreflect6=0, DOreflect6=0, RIreflect7=0, LIreflect7=0, UIreflect7=0, DIreflect7=0, ROreflect7=0, LOreflect7=0, UOreflect7=0,  DOreflect7=0,RIreflect8=0, LIreflect8=0, UIreflect8=0, DIreflect8=0, ROreflect8=0, LOreflect8=0, UOreflect8=0, DOreflect8=0, RIreflect9=0, LIreflect9=0, UIreflect9=0, DIreflect9=0, ROreflect9=0, LOreflect9=0, UOreflect9=0, DOreflect9=0,RIreflect10=0, LIreflect10=0, UIreflect10=0, DIreflect10=0, ROreflect10=0, LOreflect10=0, UOreflect10=0, DOreflect10=0)
SETTING PARAMETERS (w1l=0.002,w2l=0.002,linwl=0,loutwl=0,
                    w1r=0.002,w2r=0.002,linwr=0.0,loutwr=0,
                    h1u=0.002,h2u=0.002,linhu=0.0,louthu=0,
                    h1d=0.002,h2d=0.002,linhd=0.0,louthd=0,
                    l=0, R0=0.99,
                    Qcxl=0.0217,Qcxr=0.0217,Qcyu=0.0217, Qcyd=0.0217,
                    alphaxl=6.07, alphaxr=6.07, alphayu=6.07, alphayd=6.07,
                    Wxr=0.003,Wxl=0.003,Wyu=0.003,Wyd=0.003,
                    mxr=3.6, mxl=3.6, myu=3.6, myd=3.6,
                    QcxrOW=0.0217,QcxlOW=0.0217,QcyuOW=0.0217, QcydOW=0.0217,
                    alphaxlOW=6.07, alphaxrOW=6.07, alphayuOW=6.07, alphaydOW=6.07,
                    WxrOW=0.003,WxlOW=0.003,WyuOW=0.003,WydOW=0.003,
                    mxrOW=0, mxlOW=0, myuOW=0, mydOW=0,
		    rwallthick=0.001,lwallthick=0.001,uwallthick=0.001,dwallthick=0.001,

                    w1l1=2.002,w2l1=2.002,linwl1=0,loutwl1=0,
                    w1r1=2.002,w2r1=2.002,linwr1=0,loutwr1=0,
                    h1u1=2.002,h2u1=2.002,linhu1=0,louthu1=0,
                    h1d1=2.002,h2d1=2.002,linhd1=0,louthd1=0,
                    Qcxl1=0.0217,Qcxr1=0.0217,Qcyu1=0.0217, Qcyd1=0.0217,
                    alphaxl1=6.07, alphaxr1=6.07, alphayu1=6.07, alphayd1=6.07,
                    Wxr1=0.003,Wxl1=0.003,Wyu1=0.003,Wyd1=0.003,
                    mxr1=-1, mxl1=-1, myu1=-1, myd1=-1,
                    QcxrOW1=0.0217,QcxlOW1=0.0217,QcyuOW1=0.0217, QcydOW1=0.0217,
                    alphaxlOW1=6.07, alphaxrOW1=6.07, alphayuOW1=6.07, alphaydOW1=6.07,
                    WxrOW1=0.003,WxlOW1=0.003,WyuOW1=0.003,WydOW1=0.003,
                    mxrOW1=-1, mxlOW1=-1, myuOW1=-1, mydOW1=-1,
		    rwallthick1=0.001,lwallthick1=0.001,uwallthick1=0.001,dwallthick1=0.001,

                    w1l2=2.004,w2l2=2.004,linwl2=0,loutwl2=0,
                    w1r2=2.004,w2r2=2.004,linwr2=0,loutwr2=0,
                    h1u2=2.004,h2u2=2.004,linhu2=0,louthu2=0,
                    h1d2=2.004,h2d2=2.004,linhd2=0,louthd2=0,
                    Qcxl2=0.0217,Qcxr2=0.0217,Qcyu2=0.0217, Qcyd2=0.0217,
                    alphaxl2=6.07, alphaxr2=6.07, alphayu2=6.07, alphayd2=6.07,
                    Wxr2=0.003,Wxl2=0.003,Wyu2=0.003,Wyd2=0.003,
                    mxr2=-1, mxl2=-1, myu2=-1, myd2=-1,
                    QcxrOW2=0.0217,QcxlOW2=0.0217,QcyuOW2=0.0217, QcydOW2=0.0217,
                    alphaxlOW2=6.07, alphaxrOW2=6.07, alphayuOW2=6.07, alphaydOW2=6.07,
                    WxrOW2=0.003,WxlOW2=0.003,WyuOW2=0.003,WydOW2=0.003,
                    mxrOW2=-1, mxlOW2=-1, myuOW2=-1, mydOW2=-1,
		    rwallthick2=0.001,lwallthick2=0.001,uwallthick2=0.001,dwallthick2=0.001,

                    w1l3=2.006,w2l3=2.006,linwl3=0,loutwl3=0,
                    w1r3=2.006,w2r3=2.006,linwr3=0,loutwr3=0,
                    h1u3=2.006,h2u3=2.006,linhu3=0,louthu3=0,
                    h1d3=2.006,h2d3=2.006,linhd3=0,louthd3=0,
                    Qcxl3=0.0217,Qcxr3=0.0217,Qcyu3=0.0217, Qcyd3=0.0217,
                    alphaxl3=6.07, alphaxr3=6.07, alphayu3=6.07, alphayd3=6.07,
                    Wxr3=0.003,Wxl3=0.003,Wyu3=0.003,Wyd3=0.003,
                    mxr3=-1, mxl3=-1, myu3=-1, myd3=-1,
                    QcxrOW3=0.0217,QcxlOW3=0.0217,QcyuOW3=0.0217, QcydOW3=0.0217,
                    alphaxlOW3=6.07, alphaxrOW3=6.07, alphayuOW3=6.07, alphaydOW3=6.07,
                    WxrOW3=0.003,WxlOW3=0.003,WyuOW3=0.003,WydOW3=0.003,
                    mxrOW3=-1, mxlOW3=-1, myuOW3=-1, mydOW3=-1,
		    rwallthick3=0.001,lwallthick3=0.001,uwallthick3=0.001,dwallthick3=0.001,

                    w1l4=2.008,w2l4=2.008,linwl4=0,loutwl4=0,
                    w1r4=2.008,w2r4=2.008,linwr4=0,loutwr4=0,
                    h1u4=2.008,h2u4=2.008,linhu4=0,louthu4=0,
                    h1d4=2.008,h2d4=2.008,linhd4=0,louthd4=0,
                    Qcxl4=0.0217,Qcxr4=0.0217,Qcyu4=0.0217, Qcyd4=0.0217,
                    alphaxl4=6.07, alphaxr4=6.07, alphayu4=6.07, alphayd4=6.07,
                    Wxr4=0.003,Wxl4=0.003,Wyu4=0.003,Wyd4=0.003,
                    mxr4=-1, mxl4=-1, myu4=-1, myd4=-1,
                    QcxrOW4=0.0217,QcxlOW4=0.0217,QcyuOW4=0.0217, QcydOW4=0.0217,
                    alphaxlOW4=6.07, alphaxrOW4=6.07, alphayuOW4=6.07, alphaydOW4=6.07,
                    WxrOW4=0.003,WxlOW4=0.003,WyuOW4=0.003,WydOW4=0.003,
                    mxrOW4=-1, mxlOW4=-1, myuOW4=-1, mydOW4=-1,
		   rwallthick4=0.001,lwallthick4=0.001,uwallthick4=0.001,dwallthick4=0.001,

                    w1l5=2.01,w2l5=2.01,linwl5=0,loutwl5=0,
                    w1r5=2.01,w2r5=2.01,linwr5=0,loutwr5=0,
                    h1u5=2.01,h2u5=2.01,linhu5=0,louthu5=0,
                    h1d5=2.01,h2d5=2.01,linhd5=0,louthd5=0,
                    Qcxl5=0.0217,Qcxr5=0.0217,Qcyu5=0.0217, Qcyd5=0.0217,
                    alphaxl5=6.07, alphaxr5=6.07, alphayu5=6.07, alphayd5=6.07,
                    Wxr5=0.003,Wxl5=0.003,Wyu5=0.003,Wyd5=0.003,
                    mxr5=-1, mxl5=-1, myu5=-1, myd5=-1,
                    QcxrOW5=0.0217,QcxlOW5=0.0217,QcyuOW5=0.0217, QcydOW5=0.0217,
                    alphaxlOW5=6.07, alphaxrOW5=6.07, alphayuOW5=6.07, alphaydOW5=6.07,
                    WxrOW5=0.003,WxlOW5=0.003,WyuOW5=0.003,WydOW5=0.003,
                    mxrOW5=-1, mxlOW5=-1, myuOW5=-1, mydOW5=-1,
		    rwallthick5=0.001,lwallthick5=0.001,uwallthick5=0.001,dwallthick5=0.001,

                    w1l6=2.012,w2l6=2.012,linwl6=0,loutwl6=0,
                    w1r6=2.012,w2r6=2.012,linwr6=0,loutwr6=0,
                    h1u6=2.012,h2u6=2.012,linhu6=0,louthu6=0,
                    h1d6=2.012,h2d6=2.012,linhd6=0,louthd6=0,
                    Qcxl6=0.0217,Qcxr6=0.0217,Qcyu6=0.0217, Qcyd6=0.0217,
                    alphaxl6=6.07, alphaxr6=6.07, alphayu6=6.07, alphayd6=6.07,
                    Wxr6=0.003,Wxl6=0.003,Wyu6=0.003,Wyd6=0.003,
                    mxr6=-1, mxl6=-1, myu6=-1, myd6=-1,
                    QcxrOW6=0.0217,QcxlOW6=0.0217,QcyuOW6=0.0217, QcydOW6=0.0217,
                    alphaxlOW6=6.07, alphaxrOW6=6.07, alphayuOW6=6.07, alphaydOW6=6.07,
                    WxrOW6=0.003,WxlOW6=0.003,WyuOW6=0.003,WydOW6=0.003,
                    mxrOW6=-1, mxlOW6=-1, myuOW6=-1, mydOW6=-1,
		    rwallthick6=0.001,lwallthick6=0.001,uwallthick6=0.001,dwallthick6=0.001,

                    w1l7=2.014,w2l7=2.014,linwl7=0,loutwl7=0,
                    w1r7=2.014,w2r7=2.014,linwr7=0,loutwr7=0,
                    h1u7=2.014,h2u7=2.014,linhu7=0,louthu7=0,
                    h1d7=2.014,h2d7=2.014,linhd7=0,louthd7=0,
                    Qcxl7=0.0217,Qcxr7=0.0217,Qcyu7=0.0217, Qcyd7=0.0217,
                    alphaxl7=6.07, alphaxr7=6.07, alphayu7=6.07, alphayd7=6.07,
                    Wxr7=0.003,Wxl7=0.003,Wyu7=0.003,Wyd7=0.003,
                    mxr7=-1, mxl7=-1, myu7=-1, myd7=-1,
                    QcxrOW7=0.0217,QcxlOW7=0.0217,QcyuOW7=0.0217, QcydOW7=0.0217,
                    alphaxlOW7=6.07, alphaxrOW7=6.07, alphayuOW7=6.07, alphaydOW7=6.07,
                    WxrOW7=0.003,WxlOW7=0.003,WyuOW7=0.003,WydOW7=0.003,
                    mxrOW7=-1, mxlOW7=-1, myuOW7=-1, mydOW7=-1,
		   rwallthick7=0.001,lwallthick7=0.001,uwallthick7=0.001,dwallthick7=0.001,

                    w1l8=2.016,w2l8=2.016,linwl8=0,loutwl8=0,
                    w1r8=2.016,w2r8=2.016,linwr8=0,loutwr8=0,
                    h1u8=2.016,h2u8=2.016,linhu8=0,louthu8=0,
                    h1d8=2.016,h2d8=2.016,linhd8=0,louthd8=0,
                    Qcxl8=0.0217,Qcxr8=0.0217,Qcyu8=0.0217, Qcyd8=0.0217,
                    alphaxl8=6.07, alphaxr8=6.07, alphayu8=6.07, alphayd8=6.07,
                    Wxr8=0.003,Wxl8=0.003,Wyu8=0.003,Wyd8=0.003,
                    mxr8=-1, mxl8=-1, myu8=-1, myd8=-1,
                    QcxrOW8=0.0217,QcxlOW8=0.0217,QcyuOW8=0.0217, QcydOW8=0.0217,
                    alphaxlOW8=6.07, alphaxrOW8=6.07, alphayuOW8=6.07, alphaydOW8=6.07,
                    WxrOW8=0.003,WxlOW8=0.003,WyuOW8=0.003,WydOW8=0.003,
                    mxrOW8=-1, mxlOW8=-1, myuOW8=-1, mydOW8=-1,
		   rwallthick8=0.001,lwallthick8=0.001,uwallthick8=0.001,dwallthick8=0.001,

                    w1l9=2.018,w2l9=2.018,linwl9=0,loutwl9=0,
                    w1r9=2.018,w2r9=2.018,linwr9=0,loutwr9=0,
                    h1u9=2.018,h2u9=2.018,linhu9=0,louthu9=0,
                    h1d9=2.018,h2d9=2.018,linhd9=0,louthd9=0,
                    Qcxl9=0.0217,Qcxr9=0.0217,Qcyu9=0.0217, Qcyd9=0.0217,
                    alphaxl9=6.07, alphaxr9=6.07, alphayu9=6.07, alphayd9=6.07,
                    Wxr9=0.003,Wxl9=0.003,Wyu9=0.003,Wyd9=0.003,
                    mxr9=-1, mxl9=-1, myu9=-1, myd9=-1,
                    QcxrOW9=0.0217,QcxlOW9=0.0217,QcyuOW9=0.0217, QcydOW9=0.0217,
                    alphaxlOW9=6.07, alphaxrOW9=6.07, alphayuOW9=6.07, alphaydOW9=6.07,
                    WxrOW9=0.003,WxlOW9=0.003,WyuOW9=0.003,WydOW9=0.003,
                    mxrOW9=-1, mxlOW9=-1, myuOW9=-1, mydOW9=-1,
		   rwallthick9=0.001,lwallthick9=0.001,uwallthick9=0.001,dwallthick9=0.001,

                    w1l10=2.02,w2l10=2.02,linwl10=0,loutwl10=0,
                    w1r10=2.02,w2r10=2.02,linwr10=0,loutwr10=0,
                    h1u10=2.02,h2u10=2.02,linhu10=0,louthu10=0,
                    h1d10=2.02,h2d10=2.02,linhd10=0,louthd10=0,
                    Qcxl10=0.0217,Qcxr10=0.0217,Qcyu10=0.0217, Qcyd10=0.0217,
                    alphaxl10=6.07, alphaxr10=6.07, alphayu10=6.07, alphayd10=6.07,
                    Wxr10=0.003,Wxl10=0.003,Wyu10=0.003,Wyd10=0.003,
                    mxr10=-1, mxl10=-1, myu10=-1, myd10=-1,
                    QcxrOW10=0.0217,QcxlOW10=0.0217,QcyuOW10=0.0217, QcydOW10=0.0217,
                    alphaxlOW10=6.07, alphaxrOW10=6.07, alphayuOW10=6.07, alphaydOW10=6.07,
                    WxrOW10=0.003,WxlOW10=0.003,WyuOW10=0.003,WydOW10=0.003,
                    mxrOW10=-1, mxlOW10=-1, myuOW10=-1, mydOW10=-1,
		   rwallthick10=0.001,lwallthick10=0.001,uwallthick10=0.001,dwallthick10=0.001
)

OUTPUT PARAMETERS(w1rwt,w1lwt,h1uwt,h1dwt,w2rwt,w2lwt,h2uwt,h2dwt,
                  pawr,pawl,pbwr,pbwl,pahu,pahd,pbhu,pbhd,
                  awl,bwl,awr,bwr,ahu,bhu,ahd,bhd,
                  awlwt,bwlwt,awrwt,bwrwt,ahuwt,bhuwt,ahdwt,bhdwt,
                  pawrwt,pawlwt,pbwrwt,pbwlwt,pahuwt,pahdwt,pbhuwt,pbhdwt,
                  t1,t2w1r,t2w2r,t2w1l,t2w2l,t2h1u,t2h2u,t2h1d,t2h2d,
                  t2w1rwt,t2w2rwt,t2w1lwt,t2w2lwt,t2h1uwt,t2h2uwt,t2h1dwt,t2h2dwt,

		  a2wlwt,b2wlwt,a2wrwt,b2wrwt,a2huwt,b2huwt,a2hdwt,b2hdwt,
                  a2wl,b2wl,a2wr,b2wr,a2hu,b2hu,a2hd,b2hd,
                  mru1,mru2,nru1,nru2,mrd1,mrd2,nrd1,nrd2,mlu1,mlu2,nlu1,nlu2,mld1,mld2,nld1,nld2,
                  z0wr,z0wl,z0hu,z0hd,
		
		  lbwl,lbwr,lbhu,lbhd,
                  p2parawr,p2parawl,p2parahu,p2parahd,
                  u1wl,u2wl,u1wr,u2wr,u1hu,u2hu,u1hd,u2hd,
                  DIV1wl,DIV1wr,DIV1hu,DIV1hd,
                  p2parawrwt,p2parawlwt,p2parahuwt,p2parahdwt,
                  DIV1wlwt,DIV1wrwt,DIV1huwt,DIV1hdwt,
                  u1wrwt,u2wrwt,u1wlwt,u2wlwt,u1huwt,u2huwt,u1hdwt,u2hdwt,
                  dxwr,dzwr,dxwl,dzwl,dyhu,dzhu,dyhd,dzhd,

                  zw1r,zw2r,zw1l,zw2l,zh1u,zh2u,zh1d,zh2d,m,n,
                  pwr,qwr,pwl,qwl,phu,qhu,phd,qhd,
                  nz,nx,ny,n2,
                  pf,
                  vxin,vyin,vzin,
                  q,
                  xintersecwr,xintersecwl,yintersechd,yintersechu,
                  xlimitr,xlimitrwt,xlimitl,xlimitlwt,ylimitd,ylimitdwt,ylimitu,ylimituwt,
                  xtest,ytest,
                  pwrwt,qwrwt,pwlwt,qwlwt,phuwt,qhuwt,phdwt,qhdwt,
                  zw1rwt,zw2rwt,zw1lwt,zw2lwt,zh1uwt,zh2uwt,zh1dwt,zh2dwt,
                  xintersecwrwt,xintersecwlwt,yintersechdwt,yintersechuwt,

                  riTable, liTable, uiTable, diTable,
                  roTable, loTable, uoTable, doTable,



		  w1rwt1,w1lwt1,h1uwt1,h1dwt1,w2rwt1,w2lwt1,h2uwt1,h2dwt1,
                  pawr1,pawl1,pbwr1,pbwl1,pahu1,pahd1,pbhu1,pbhd1,
                  awl1,bwl1,awr1,bwr1,ahu1,bhu1,ahd1,bhd1,
                  awlwt1,bwlwt1,awrwt1,bwrwt1,ahuwt1,bhuwt1,ahdwt1,bhdwt1,
                  pawrwt1,pawlwt1,pbwrwt1,pbwlwt1,pahuwt1,pahdwt1,pbhuwt1,pbhdwt1,
                  t2w1r1,t2w2r1,t2w1l1,t2w2l1,t2h1u1,t2h2u1,t2h1d1,t2h2d1,
                  t2w1rwt1,t2w2rwt1,t2w1lwt1,t2w2lwt1,t2h1uwt1,t2h2uwt1,t2h1dwt1,t2h2dwt1,

                  a2wlwt1,b2wlwt1,a2wrwt1,b2wrwt1,a2huwt1,b2huwt1,a2hdwt1,b2hdwt1,
                  a2wl1,b2wl1,a2wr1,b2wr1,a2hu1,b2hu1,a2hd1,b2hd1,
                  mru11,mru21,nru11,nru21,mrd11,mrd21,nrd11,nrd21,mlu11,mlu21,nlu11,nlu21,mld11,mld21,nld11,nld21,
                  z0wr1,z0wl1,z0hu1,z0hd1,

                  lbwl1,lbwr1,lbhu1,lbhd1,
                  p2parawr1,p2parawl1,p2parahu1,p2parahd1,
                  u1wl1,u2wl1,u1wr1,u2wr1,u1hu1,u2hu1,u1hd1,u2hd1,
                  DIV1wl1,DIV1wr1,DIV1hu1,DIV1hd1,
                  p2parawrwt1,p2parawlwt1,p2parahuwt1,p2parahdwt1,
                  DIV1wlwt1,DIV1wrwt1,DIV1huwt1,DIV1hdwt1,
                  u1wrwt1,u2wrwt1,u1wlwt1,u2wlwt1,u1huwt1,u2huwt1,u1hdwt1,u2hdwt1,
                  dxwr1,dzwr1,dxwl1,dzwl1,dyhu1,dzhu1,dyhd1,dzhd1,


                  zw1r1,zw2r1,zw1l1,zw2l1,zh1u1,zh2u1,zh1d1,zh2d1,
                  pwr1,qwr1,pwl1,qwl1,phu1,qhu1,phd1,qhd1,
                  xintersecwr1,xintersecwl1,yintersechd1,yintersechu1,
                  pwrwt1,qwrwt1,pwlwt1,qwlwt1,phuwt1,qhuwt1,phdwt1,qhdwt1,
                  zw1rwt1,zw2rwt1,zw1lwt1,zw2lwt1,zh1uwt1,zh2uwt1,zh1dwt1,zh2dwt1,
                  xintersecwrwt1,xintersecwlwt1,yintersechdwt1,yintersechuwt1,

                  riTable1, liTable1, uiTable1, diTable1,
                  roTable1, loTable1, uoTable1, doTable1,

                  w1rwt2,w1lwt2,h1uwt2,h1dwt2,w2rwt2,w2lwt2,h2uwt2,h2dwt2,
                  pawr2,pawl2,pbwr2,pbwl2,pahu2,pahd2,pbhu2,pbhd2,
                  awl2,bwl2,awr2,bwr2,ahu2,bhu2,ahd2,bhd2,
                  awlwt2,bwlwt2,awrwt2,bwrwt2,ahuwt2,bhuwt2,ahdwt2,bhdwt2,
                  pawrwt2,pawlwt2,pbwrwt2,pbwlwt2,pahuwt2,pahdwt2,pbhuwt2,pbhdwt2,
                  t2w1r2,t2w2r2,t2w1l2,t2w2l2,t2h1u2,t2h2u2,t2h1d2,t2h2d2,
                  t2w1rwt2,t2w2rwt2,t2w1lwt2,t2w2lwt2,t2h1uwt2,t2h2uwt2,t2h1dwt2,t2h2dwt2,

                  a2wlwt2,b2wlwt2,a2wrwt2,b2wrwt2,a2huwt2,b2huwt2,a2hdwt2,b2hdwt2,
                  a2wl2,b2wl2,a2wr2,b2wr2,a2hu2,b2hu2,a2hd2,b2hd2,
                  mru12,mru22,nru12,nru22,mrd12,mrd22,nrd12,nrd22,mlu12,mlu22,nlu12,nlu22,mld12,mld22,nld12,nld22,
                  z0wr2,z0wl2,z0hu2,z0hd2,

                  lbwl2,lbwr2,lbhu2,lbhd2,
                  p2parawr2,p2parawl2,p2parahu2,p2parahd2,
                  u1wl2,u2wl2,u1wr2,u2wr2,u1hu2,u2hu2,u1hd2,u2hd2,
                  DIV1wl2,DIV1wr2,DIV1hu2,DIV1hd2,
                  p2parawrwt2,p2parawlwt2,p2parahuwt2,p2parahdwt2,
                  DIV1wlwt2,DIV1wrwt2,DIV1huwt2,DIV1hdwt2,
                  u1wrwt2,u2wrwt2,u1wlwt2,u2wlwt2,u1huwt2,u2huwt2,u1hdwt2,u2hdwt2,
                  dxwr2,dzwr2,dxwl2,dzwl2,dyhu2,dzhu2,dyhd2,dzhd2,


                  zw1r2,zw2r2,zw1l2,zw2l2,zh1u2,zh2u2,zh1d2,zh2d2,
                  pwr2,qwr2,pwl2,qwl2,phu2,qhu2,phd2,qhd2,
                  xintersecwr2,xintersecwl2,yintersechd2,yintersechu2,
                  pwrwt2,qwrwt2,pwlwt2,qwlwt2,phuwt2,qhuwt2,phdwt2,qhdwt2,
                  zw1rwt2,zw2rwt2,zw1lwt2,zw2lwt2,zh1uwt2,zh2uwt2,zh1dwt2,zh2dwt2,
                  xintersecwrwt2,xintersecwlwt2,yintersechdwt2,yintersechuwt2,

                  riTable2, liTable2, uiTable2, diTable2,
                  roTable2, loTable2, uoTable2, doTable2,

                  t2w1r3,t2w2r3,t2w1l3,t2w2l3,t2h1u3,t2h2u3,t2h1d3,t2h2d3,
                  t2w1rwt3,t2w2rwt3,t2w1lwt3,t2w2lwt3,t2h1uwt3,t2h2uwt3,t2h1dwt3,t2h2dwt3,
		  t2w1r4,t2w2r4,t2w1l4,t2w2l4,t2h1u4,t2h2u4,t2h1d4,t2h2d4,
                  t2w1rwt4,t2w2rwt4,t2w1lwt4,t2w2lwt4,t2h1uwt4,t2h2uwt4,t2h1dwt4,t2h2dwt4,
		  t2w1r5,t2w2r5,t2w1l5,t2w2l5,t2h1u5,t2h2u5,t2h1d5,t2h2d5,
                  t2w1rwt5,t2w2rwt5,t2w1lwt5,t2w2lwt5,t2h1uwt5,t2h2uwt5,t2h1dwt5,t2h2dwt5,
		  t2w1r6,t2w2r6,t2w1l6,t2w2l6,t2h1u6,t2h2u6,t2h1d6,t2h2d6,
                  t2w1rwt6,t2w2rwt6,t2w1lwt6,t2w2lwt6,t2h1uwt6,t2h2uwt6,t2h1dwt6,t2h2dwt6,
		  t2w1r7,t2w2r7,t2w1l7,t2w2l7,t2h1u7,t2h2u7,t2h1d7,t2h2d7,
                  t2w1rwt7,t2w2rwt7,t2w1lwt7,t2w2lwt7,t2h1uwt7,t2h2uwt7,t2h1dwt7,t2h2dwt7,
		  t2w1r8,t2w2r8,t2w1l8,t2w2l8,t2h1u8,t2h2u8,t2h1d8,t2h2d8,
                  t2w1rwt8,t2w2rwt8,t2w1lwt8,t2w2lwt8,t2h1uwt8,t2h2uwt8,t2h1dwt8,t2h2dwt8,
		  t2w1r9,t2w2r9,t2w1l9,t2w2l9,t2h1u9,t2h2u9,t2h1d9,t2h2d9,
                  t2w1rwt9,t2w2rwt9,t2w1lwt9,t2w2lwt9,t2h1uwt9,t2h2uwt9,t2h1dwt9,t2h2dwt9,
		  t2w1r10,t2w2r10,t2w1l10,t2w2l10,t2h1u10,t2h2u10,t2h1d10,t2h2d10,
                  t2w1rwt10,t2w2rwt10,t2w1lwt10,t2w2lwt10,t2h1uwt10,t2h2uwt10,t2h1dwt10,t2h2dwt10,

                  w1rwt3,w1lwt3,h1uwt3,h1dwt3,w2rwt3,w2lwt3,h2uwt3,h2dwt3,
                  pawr3,pawl3,pbwr3,pbwl3,pahu3,pahd3,pbhu3,pbhd3,
                  awl3,bwl3,awr3,bwr3,ahu3,bhu3,ahd3,bhd3,
                  awlwt3,bwlwt3,awrwt3,bwrwt3,ahuwt3,bhuwt3,ahdwt3,bhdwt3,
                  pawrwt3,pawlwt3,pbwrwt3,pbwlwt3,pahuwt3,pahdwt3,pbhuwt3,pbhdwt3,
                  t2w1r3,t2w2r3,t2w1l3,t2w2l3,t2h1u3,t2h2u3,t2h1d3,t2h2d3,
                  t2w1rwt3,t2w2rwt3,t2w1lwt3,t2w2lwt3,t2h1uwt3,t2h2uwt3,t2h1dwt3,t2h2dwt3,

                  a2wlwt3,b2wlwt3,a2wrwt3,b2wrwt3,a2huwt3,b2huwt3,a2hdwt3,b2hdwt3,
                  a2wl3,b2wl3,a2wr3,b2wr3,a2hu3,b2hu3,a2hd3,b2hd3,
                  mru13,mru23,nru13,nru23,mrd13,mrd23,nrd13,nrd23,mlu13,mlu23,nlu13,nlu23,mld13,mld23,nld13,nld23,
                  z0wr3,z0wl3,z0hu3,z0hd3,

                  lbwl3,lbwr3,lbhu3,lbhd3,
                  p2parawr3,p2parawl3,p2parahu3,p2parahd3,
                  u1wl3,u2wl3,u1wr3,u2wr3,u1hu3,u2hu3,u1hd3,u2hd3,
                  DIV1wl3,DIV1wr3,DIV1hu3,DIV1hd3,
                  p2parawrwt3,p2parawlwt3,p2parahuwt3,p2parahdwt3,
                  DIV1wlwt3,DIV1wrwt3,DIV1huwt3,DIV1hdwt3,
                  u1wrwt3,u2wrwt3,u1wlwt3,u2wlwt3,u1huwt3,u2huwt3,u1hdwt3,u2hdwt3,
                  dxwr3,dzwr3,dxwl3,dzwl3,dyhu3,dzhu3,dyhd3,dzhd3,


                  zw1r3,zw2r3,zw1l3,zw2l3,zh1u3,zh2u3,zh1d3,zh2d3,
                  pwr3,qwr3,pwl3,qwl3,phu3,qhu3,phd3,qhd3,
                  xintersecwr3,xintersecwl3,yintersechd3,yintersechu3,
                  pwrwt3,qwrwt3,pwlwt3,qwlwt3,phuwt3,qhuwt3,phdwt3,qhdwt3,
                  zw1rwt3,zw2rwt3,zw1lwt3,zw2lwt3,zh1uwt3,zh2uwt3,zh1dwt3,zh2dwt3,
                  xintersecwrwt3,xintersecwlwt3,yintersechdwt3,yintersechuwt3,

                  riTable3, liTable3, uiTable3, diTable3,
                  roTable3, loTable3, uoTable3, doTable3,

                  w1rwt4,w1lwt4,h1uwt4,h1dwt4,w2rwt4,w2lwt4,h2uwt4,h2dwt4,
                  pawr4,pawl4,pbwr4,pbwl4,pahu4,pahd4,pbhu4,pbhd4,
                  awl4,bwl4,awr4,bwr4,ahu4,bhu4,ahd4,bhd4,
                  awlwt4,bwlwt4,awrwt4,bwrwt4,ahuwt4,bhuwt4,ahdwt4,bhdwt4,
                  pawrwt4,pawlwt4,pbwrwt4,pbwlwt4,pahuwt4,pahdwt4,pbhuwt4,pbhdwt4,
                  t2w1r4,t2w2r4,t2w1l4,t2w2l4,t2h1u4,t2h2u4,t2h1d4,t2h2d4,
                  t2w1rwt4,t2w2rwt4,t2w1lwt4,t2w2lwt4,t2h1uwt4,t2h2uwt4,t2h1dwt4,t2h2dwt4,

                  a2wlwt4,b2wlwt4,a2wrwt4,b2wrwt4,a2huwt4,b2huwt4,a2hdwt4,b2hdwt4,
                  a2wl4,b2wl4,a2wr4,b2wr4,a2hu4,b2hu4,a2hd4,b2hd4,
                  mru14,mru24,nru14,nru24,mrd14,mrd24,nrd14,nrd24,mlu14,mlu24,nlu14,nlu24,mld14,mld24,nld14,nld24,
                  z0wr4,z0wl4,z0hu4,z0hd4,

                  lbwl4,lbwr4,lbhu4,lbhd4,
                  p2parawr4,p2parawl4,p2parahu4,p2parahd4,
                  u1wl4,u2wl4,u1wr4,u2wr4,u1hu4,u2hu4,u1hd4,u2hd4,
                  DIV1wl4,DIV1wr4,DIV1hu4,DIV1hd4,
                  p2parawrwt4,p2parawlwt4,p2parahuwt4,p2parahdwt4,
                  DIV1wlwt4,DIV1wrwt4,DIV1huwt4,DIV1hdwt4,
                  u1wrwt4,u2wrwt4,u1wlwt4,u2wlwt4,u1huwt4,u2huwt4,u1hdwt4,u2hdwt4,
                  dxwr4,dzwr4,dxwl4,dzwl4,dyhu4,dzhu4,dyhd4,dzhd4,


                  zw1r4,zw2r4,zw1l4,zw2l4,zh1u4,zh2u4,zh1d4,zh2d4,
                  pwr4,qwr4,pwl4,qwl4,phu4,qhu4,phd4,qhd4,
                  xintersecwr4,xintersecwl4,yintersechd4,yintersechu4,
                  pwrwt4,qwrwt4,pwlwt4,qwlwt4,phuwt4,qhuwt4,phdwt4,qhdwt4,
                  zw1rwt4,zw2rwt4,zw1lwt4,zw2lwt4,zh1uwt4,zh2uwt4,zh1dwt4,zh2dwt4,
                  xintersecwrwt4,xintersecwlwt4,yintersechdwt4,yintersechuwt4,

                  riTable4, liTable4, uiTable4, diTable4,
                  roTable4, loTable4, uoTable4, doTable4,

                  w1rwt5,w1lwt5,h1uwt5,h1dwt5,w2rwt5,w2lwt5,h2uwt5,h2dwt5,
                  pawr5,pawl5,pbwr5,pbwl5,pahu5,pahd5,pbhu5,pbhd5,
                  awl5,bwl5,awr5,bwr5,ahu5,bhu5,ahd5,bhd5,
                  awlwt5,bwlwt5,awrwt5,bwrwt5,ahuwt5,bhuwt5,ahdwt5,bhdwt5,
                  pawrwt5,pawlwt5,pbwrwt5,pbwlwt5,pahuwt5,pahdwt5,pbhuwt5,pbhdwt5,
                  t2w1r5,t2w2r5,t2w1l5,t2w2l5,t2h1u5,t2h2u5,t2h1d5,t2h2d5,
                  t2w1rwt5,t2w2rwt5,t2w1lwt5,t2w2lwt5,t2h1uwt5,t2h2uwt5,t2h1dwt5,t2h2dwt5,

                  a2wlwt5,b2wlwt5,a2wrwt5,b2wrwt5,a2huwt5,b2huwt5,a2hdwt5,b2hdwt5,
                  a2wl5,b2wl5,a2wr5,b2wr5,a2hu5,b2hu5,a2hd5,b2hd5,
                  mru15,mru25,nru15,nru25,mrd15,mrd25,nrd15,nrd25,mlu15,mlu25,nlu15,nlu25,mld15,mld25,nld15,nld25,
                  z0wr5,z0wl5,z0hu5,z0hd5,

                  lbwl5,lbwr5,lbhu5,lbhd5,
                  p2parawr5,p2parawl5,p2parahu5,p2parahd5,
                  u1wl5,u2wl5,u1wr5,u2wr5,u1hu5,u2hu5,u1hd5,u2hd5,
                  DIV1wl5,DIV1wr5,DIV1hu5,DIV1hd5,
                  p2parawrwt5,p2parawlwt5,p2parahuwt5,p2parahdwt5,
                  DIV1wlwt5,DIV1wrwt5,DIV1huwt5,DIV1hdwt5,
                  u1wrwt5,u2wrwt5,u1wlwt5,u2wlwt5,u1huwt5,u2huwt5,u1hdwt5,u2hdwt5,
                  dxwr5,dzwr5,dxwl5,dzwl5,dyhu5,dzhu5,dyhd5,dzhd5,


                  zw1r5,zw2r5,zw1l5,zw2l5,zh1u5,zh2u5,zh1d5,zh2d5,
                  pwr5,qwr5,pwl5,qwl5,phu5,qhu5,phd5,qhd5,
                  xintersecwr5,xintersecwl5,yintersechd5,yintersechu5,
                  pwrwt5,qwrwt5,pwlwt5,qwlwt5,phuwt5,qhuwt5,phdwt5,qhdwt5,
                  zw1rwt5,zw2rwt5,zw1lwt5,zw2lwt5,zh1uwt5,zh2uwt5,zh1dwt5,zh2dwt5,
                  xintersecwrwt5,xintersecwlwt5,yintersechdwt5,yintersechuwt5,

                  riTable5, liTable5, uiTable5, diTable5,
                  roTable5, loTable5, uoTable5, doTable5,

                  w1rwt6,w1lwt6,h1uwt6,h1dwt6,w2rwt6,w2lwt6,h2uwt6,h2dwt6,
                  pawr6,pawl6,pbwr6,pbwl6,pahu6,pahd6,pbhu6,pbhd6,
                  awl6,bwl6,awr6,bwr6,ahu6,bhu6,ahd6,bhd6,
                  awlwt6,bwlwt6,awrwt6,bwrwt6,ahuwt6,bhuwt6,ahdwt6,bhdwt6,
                  pawrwt6,pawlwt6,pbwrwt6,pbwlwt6,pahuwt6,pahdwt6,pbhuwt6,pbhdwt6,
                  t2w1r6,t2w2r6,t2w1l6,t2w2l6,t2h1u6,t2h2u6,t2h1d6,t2h2d6,
                  t2w1rwt6,t2w2rwt6,t2w1lwt6,t2w2lwt6,t2h1uwt6,t2h2uwt6,t2h1dwt6,t2h2dwt6,

                  a2wlwt6,b2wlwt6,a2wrwt6,b2wrwt6,a2huwt6,b2huwt6,a2hdwt6,b2hdwt6,
                  a2wl6,b2wl6,a2wr6,b2wr6,a2hu6,b2hu6,a2hd6,b2hd6,
                  mru16,mru26,nru16,nru26,mrd16,mrd26,nrd16,nrd26,mlu16,mlu26,nlu16,nlu26,mld16,mld26,nld16,nld26,
                  z0wr6,z0wl6,z0hu6,z0hd6,

                  lbwl6,lbwr6,lbhu6,lbhd6,
                  p2parawr6,p2parawl6,p2parahu6,p2parahd6,
                  u1wl6,u2wl6,u1wr6,u2wr6,u1hu6,u2hu6,u1hd6,u2hd6,
                  DIV1wl6,DIV1wr6,DIV1hu6,DIV1hd6,
                  p2parawrwt6,p2parawlwt6,p2parahuwt6,p2parahdwt6,
                  DIV1wlwt6,DIV1wrwt6,DIV1huwt6,DIV1hdwt6,
                  u1wrwt6,u2wrwt6,u1wlwt6,u2wlwt6,u1huwt6,u2huwt6,u1hdwt6,u2hdwt6,
                  dxwr6,dzwr6,dxwl6,dzwl6,dyhu6,dzhu6,dyhd6,dzhd6,


                  zw1r6,zw2r6,zw1l6,zw2l6,zh1u6,zh2u6,zh1d6,zh2d6,
                  pwr6,qwr6,pwl6,qwl6,phu6,qhu6,phd6,qhd6,
                  xintersecwr6,xintersecwl6,yintersechd6,yintersechu6,
                  pwrwt6,qwrwt6,pwlwt6,qwlwt6,phuwt6,qhuwt6,phdwt6,qhdwt6,
                  zw1rwt6,zw2rwt6,zw1lwt6,zw2lwt6,zh1uwt6,zh2uwt6,zh1dwt6,zh2dwt6,
                  xintersecwrwt6,xintersecwlwt6,yintersechdwt6,yintersechuwt6,

                  riTable6, liTable6, uiTable6, diTable6,
                  roTable6, loTable6, uoTable6, doTable6,

                  w1rwt7,w1lwt7,h1uwt7,h1dwt7,w2rwt7,w2lwt7,h2uwt7,h2dwt7,
                  pawr7,pawl7,pbwr7,pbwl7,pahu7,pahd7,pbhu7,pbhd7,
                  awl7,bwl7,awr7,bwr7,ahu7,bhu7,ahd7,bhd7,
                  awlwt7,bwlwt7,awrwt7,bwrwt7,ahuwt7,bhuwt7,ahdwt7,bhdwt7,
                  pawrwt7,pawlwt7,pbwrwt7,pbwlwt7,pahuwt7,pahdwt7,pbhuwt7,pbhdwt7,
                  t2w1r7,t2w2r7,t2w1l7,t2w2l7,t2h1u7,t2h2u7,t2h1d7,t2h2d7,
                  t2w1rwt7,t2w2rwt7,t2w1lwt7,t2w2lwt7,t2h1uwt7,t2h2uwt7,t2h1dwt7,t2h2dwt7,

                  a2wlwt7,b2wlwt7,a2wrwt7,b2wrwt7,a2huwt7,b2huwt7,a2hdwt7,b2hdwt7,
                  a2wl7,b2wl7,a2wr7,b2wr7,a2hu7,b2hu7,a2hd7,b2hd7,
                  mru17,mru27,nru17,nru27,mrd17,mrd27,nrd17,nrd27,mlu17,mlu27,nlu17,nlu27,mld17,mld27,nld17,nld27,
                  z0wr7,z0wl7,z0hu7,z0hd7,

                  lbwl7,lbwr7,lbhu7,lbhd7,
                  p2parawr7,p2parawl7,p2parahu7,p2parahd7,
                  u1wl7,u2wl7,u1wr7,u2wr7,u1hu7,u2hu7,u1hd7,u2hd7,
                  DIV1wl7,DIV1wr7,DIV1hu7,DIV1hd7,
                  p2parawrwt7,p2parawlwt7,p2parahuwt7,p2parahdwt7,
                  DIV1wlwt7,DIV1wrwt7,DIV1huwt7,DIV1hdwt7,
                  u1wrwt7,u2wrwt7,u1wlwt7,u2wlwt7,u1huwt7,u2huwt7,u1hdwt7,u2hdwt7,
                  dxwr7,dzwr7,dxwl7,dzwl7,dyhu7,dzhu7,dyhd7,dzhd7,


                  zw1r7,zw2r7,zw1l7,zw2l7,zh1u7,zh2u7,zh1d7,zh2d7,
                  pwr7,qwr7,pwl7,qwl7,phu7,qhu7,phd7,qhd7,
                  xintersecwr7,xintersecwl7,yintersechd7,yintersechu7,
                  pwrwt7,qwrwt7,pwlwt7,qwlwt7,phuwt7,qhuwt7,phdwt7,qhdwt7,
                  zw1rwt7,zw2rwt7,zw1lwt7,zw2lwt7,zh1uwt7,zh2uwt7,zh1dwt7,zh2dwt7,
                  xintersecwrwt7,xintersecwlwt7,yintersechdwt7,yintersechuwt7,

                  riTable7, liTable7, uiTable7, diTable7,
                  roTable7, loTable7, uoTable7, doTable7,

                  w1rwt8,w1lwt8,h1uwt8,h1dwt8,w2rwt8,w2lwt8,h2uwt8,h2dwt8,
                  pawr8,pawl8,pbwr8,pbwl8,pahu8,pahd8,pbhu8,pbhd8,
                  awl8,bwl8,awr8,bwr8,ahu8,bhu8,ahd8,bhd8,
                  awlwt8,bwlwt8,awrwt8,bwrwt8,ahuwt8,bhuwt8,ahdwt8,bhdwt8,
                  pawrwt8,pawlwt8,pbwrwt8,pbwlwt8,pahuwt8,pahdwt8,pbhuwt8,pbhdwt8,
                  t2w1r8,t2w2r8,t2w1l8,t2w2l8,t2h1u8,t2h2u8,t2h1d8,t2h2d8,
                  t2w1rwt8,t2w2rwt8,t2w1lwt8,t2w2lwt8,t2h1uwt8,t2h2uwt8,t2h1dwt8,t2h2dwt8,

                  a2wlwt8,b2wlwt8,a2wrwt8,b2wrwt8,a2huwt8,b2huwt8,a2hdwt8,b2hdwt8,
                  a2wl8,b2wl8,a2wr8,b2wr8,a2hu8,b2hu8,a2hd8,b2hd8,
                  mru18,mru28,nru18,nru28,mrd18,mrd28,nrd18,nrd28,mlu18,mlu28,nlu18,nlu28,mld18,mld28,nld18,nld28,
                  z0wr8,z0wl8,z0hu8,z0hd8,

                  lbwl8,lbwr8,lbhu8,lbhd8,
                  p2parawr8,p2parawl8,p2parahu8,p2parahd8,
                  u1wl8,u2wl8,u1wr8,u2wr8,u1hu8,u2hu8,u1hd8,u2hd8,
                  DIV1wl8,DIV1wr8,DIV1hu8,DIV1hd8,
                  p2parawrwt8,p2parawlwt8,p2parahuwt8,p2parahdwt8,
                  DIV1wlwt8,DIV1wrwt8,DIV1huwt8,DIV1hdwt8,
                  u1wrwt8,u2wrwt8,u1wlwt8,u2wlwt8,u1huwt8,u2huwt8,u1hdwt8,u2hdwt8,
                  dxwr8,dzwr8,dxwl8,dzwl8,dyhu8,dzhu8,dyhd8,dzhd8,


                  zw1r8,zw2r8,zw1l8,zw2l8,zh1u8,zh2u8,zh1d8,zh2d8,
                  pwr8,qwr8,pwl8,qwl8,phu8,qhu8,phd8,qhd8,
                  xintersecwr8,xintersecwl8,yintersechd8,yintersechu8,
                  pwrwt8,qwrwt8,pwlwt8,qwlwt8,phuwt8,qhuwt8,phdwt8,qhdwt8,
                  zw1rwt8,zw2rwt8,zw1lwt8,zw2lwt8,zh1uwt8,zh2uwt8,zh1dwt8,zh2dwt8,
                  xintersecwrwt8,xintersecwlwt8,yintersechdwt8,yintersechuwt8,

                  riTable8, liTable8, uiTable8, diTable8,
                  roTable8, loTable8, uoTable8, doTable8,

                  w1rwt9,w1lwt9,h1uwt9,h1dwt9,w2rwt9,w2lwt9,h2uwt9,h2dwt9,
                  pawr9,pawl9,pbwr9,pbwl9,pahu9,pahd9,pbhu9,pbhd9,
                  awl9,bwl9,awr9,bwr9,ahu9,bhu9,ahd9,bhd9,
                  awlwt9,bwlwt9,awrwt9,bwrwt9,ahuwt9,bhuwt9,ahdwt9,bhdwt9,
                  pawrwt9,pawlwt9,pbwrwt9,pbwlwt9,pahuwt9,pahdwt9,pbhuwt9,pbhdwt9,
                  t2w1r9,t2w2r9,t2w1l9,t2w2l9,t2h1u9,t2h2u9,t2h1d9,t2h2d9,
                  t2w1rwt9,t2w2rwt9,t2w1lwt9,t2w2lwt9,t2h1uwt9,t2h2uwt9,t2h1dwt9,t2h2dwt9,

                  a2wlwt9,b2wlwt9,a2wrwt9,b2wrwt9,a2huwt9,b2huwt9,a2hdwt9,b2hdwt9,
                  a2wl9,b2wl9,a2wr9,b2wr9,a2hu9,b2hu9,a2hd9,b2hd9,
                  mru19,mru29,nru19,nru29,mrd19,mrd29,nrd19,nrd29,mlu19,mlu29,nlu19,nlu29,mld19,mld29,nld19,nld29,
                  z0wr9,z0wl9,z0hu9,z0hd9,

                  lbwl9,lbwr9,lbhu9,lbhd9,
                  p2parawr9,p2parawl9,p2parahu9,p2parahd9,
                  u1wl9,u2wl9,u1wr9,u2wr9,u1hu9,u2hu9,u1hd9,u2hd9,
                  DIV1wl9,DIV1wr9,DIV1hu9,DIV1hd9,
                  p2parawrwt9,p2parawlwt9,p2parahuwt9,p2parahdwt9,
                  DIV1wlwt9,DIV1wrwt9,DIV1huwt9,DIV1hdwt9,
                  u1wrwt9,u2wrwt9,u1wlwt9,u2wlwt9,u1huwt9,u2huwt9,u1hdwt9,u2hdwt9,
                  dxwr9,dzwr9,dxwl9,dzwl9,dyhu9,dzhu9,dyhd9,dzhd9,


                  zw1r9,zw2r9,zw1l9,zw2l9,zh1u9,zh2u9,zh1d9,zh2d9,
                  pwr9,qwr9,pwl9,qwl9,phu9,qhu9,phd9,qhd9,
                  xintersecwr9,xintersecwl9,yintersechd9,yintersechu9,
                  pwrwt9,qwrwt9,pwlwt9,qwlwt9,phuwt9,qhuwt9,phdwt9,qhdwt9,
                  zw1rwt9,zw2rwt9,zw1lwt9,zw2lwt9,zh1uwt9,zh2uwt9,zh1dwt9,zh2dwt9,
                  xintersecwrwt9,xintersecwlwt9,yintersechdwt9,yintersechuwt9,

                  riTable9, liTable9, uiTable9, diTable9,
                  roTable9, loTable9, uoTable9, doTable9,

                  w1rwt10,w1lwt10,h1uwt10,h1dwt10,w2rwt10,w2lwt10,h2uwt10,h2dwt10,
                  pawr10,pawl10,pbwr10,pbwl10,pahu10,pahd10,pbhu10,pbhd10,
                  awl10,bwl10,awr10,bwr10,ahu10,bhu10,ahd10,bhd10,
                  awlwt10,bwlwt10,awrwt10,bwrwt10,ahuwt10,bhuwt10,ahdwt10,bhdwt10,
                  pawrwt10,pawlwt10,pbwrwt10,pbwlwt10,pahuwt10,pahdwt10,pbhuwt10,pbhdwt10,
                  t2w1r10,t2w2r10,t2w1l10,t2w2l10,t2h1u10,t2h2u10,t2h1d10,t2h2d10,
                  t2w1rwt10,t2w2rwt10,t2w1lwt10,t2w2lwt10,t2h1uwt10,t2h2uwt10,t2h1dwt10,t2h2dwt10,

                  a2wlwt10,b2wlwt10,a2wrwt10,b2wrwt10,a2huwt10,b2huwt10,a2hdwt10,b2hdwt10,
                  a2wl10,b2wl10,a2wr10,b2wr10,a2hu10,b2hu10,a2hd10,b2hd10,
                  mru110,mru210,nru110,nru210,mrd110,mrd210,nrd110,nrd210,mlu110,mlu210,nlu110,nlu210,mld110,mld210,nld110,nld210,
                  z0wr10,z0wl10,z0hu10,z0hd10,

                  lbwl10,lbwr10,lbhu10,lbhd10,
                  p2parawr10,p2parawl10,p2parahu10,p2parahd10,
                  u1wl10,u2wl10,u1wr10,u2wr10,u1hu10,u2hu10,u1hd10,u2hd10,
                  DIV1wl10,DIV1wr10,DIV1hu10,DIV1hd10,
                  p2parawrwt10,p2parawlwt10,p2parahuwt10,p2parahdwt10,
                  DIV1wlwt10,DIV1wrwt10,DIV1huwt10,DIV1hdwt10,
                  u1wrwt10,u2wrwt10,u1wlwt10,u2wlwt10,u1huwt10,u2huwt10,u1hdwt10,u2hdwt10,
                  dxwr10,dzwr10,dxwl10,dzwl10,dyhu10,dzhu10,dyhd10,dzhd10,


                  zw1r10,zw2r10,zw1l10,zw2l10,zh1u10,zh2u10,zh1d10,zh2d10,
                  pwr10,qwr10,pwl10,qwl10,phu10,qhu10,phd10,qhd10,
                  xintersecwr10,xintersecwl10,yintersechd10,yintersechu10,
                  pwrwt10,qwrwt10,pwlwt10,qwlwt10,phuwt10,qhuwt10,phdwt10,qhdwt10,
                  zw1rwt10,zw2rwt10,zw1lwt10,zw2lwt10,zh1uwt10,zh2uwt10,zh1dwt10,zh2dwt10,
                  xintersecwrwt10,xintersecwlwt10,yintersechdwt10,yintersechuwt10,

                  riTable10, liTable10, uiTable10, diTable10,
                  roTable10, loTable10, uoTable10, doTable10
)

STATE PARAMETERS (x,y,z,vx,vy,vz,t,sx,sy,p)

SHARE
%{	
%include "read_table-lib"
%}


DECLARE
%{
  double w1rwt,w1lwt,h1uwt,h1dwt,w2rwt,w2lwt,h2uwt,h2dwt;					/* entrance and exit width for th OUTER walls of the guide*/
  double pawr,pawl,pbwr,pbwl,pahu,pahd,pbhu,pbhd;						/* parameter a and b of the parabolic curves (INNER walls)*/
  double awl,bwl,awr,bwr,ahu,bhu,ahd,bhd;							/* long and short axis a and b auf the ellipses (INNER walls)*/
  double awlwt,bwlwt,awrwt,bwrwt,ahuwt,bhuwt,ahdwt,bhdwt;					/* long and short axis a and b auf the ellipses (OUTER walls)*/
  double pawrwt,pawlwt,pbwrwt,pbwlwt,pahuwt,pahdwt,pbhuwt,pbhdwt;				/* parameter a and b of the parabolic curves for the OUTER wall*/
  double t1,t2w1r,t2w2r,t2w1l,t2w2l,t2h1u,t2h2u,t2h1d,t2h2d;					/* time variables (INNER walls)*/
  double t2w1rwt,t2w2rwt,t2w1lwt,t2w2lwt,t2h1uwt,t2h2uwt,t2h1dwt,t2h2dwt;			/* time variables (OUTER walls)*/


  double a2wlwt,b2wlwt,a2wrwt,b2wrwt,a2huwt,b2huwt,a2hdwt,b2hdwt;				/* square of long and short axis a and b auf the ellipses (OUTER walls) */
  double a2wl,b2wl,a2wr,b2wr,a2hu,b2hu,a2hd,b2hd;						/* square of long and short axis a and b auf the ellipses (INNER walls)*/
  double mru1,mru2,nru1,nru2,mrd1,mrd2,nrd1,nrd2,mlu1,mlu2,nlu1,nlu2,mld1,mld2,nld1,nld2;	/* variables the calculated the guide geometrie in the entrance and exit plane (absorbing mask given by the walls)*/
  double z0wr,z0wl,z0hu,z0hd;									/* z-component of the center of the ellipse (x-component is allways zero) */

  double lbwl,lbwr,lbhu,lbhd;								/* length between focal points , needed for elliptic case */
  double p2parawr,p2parawl,p2parahu,p2parahd;						/* help variables to calculate the parabolic curve parameters a and b (INNER walls)*/
  double u1wl,u2wl,u1wr,u2wr,u1hu,u2hu,u1hd,u2hd;					/* help variables to calculate the long axis a of the ellipse (INNER walls)*/
  double DIV1wl,DIV1wr,DIV1hu,DIV1hd;							/* help variables (INNER walls)*/
  double p2parawrwt,p2parawlwt,p2parahuwt,p2parahdwt;					/* help variables to calculate the parabolic curve parameters a and b for (OUTER wall)*/
  double DIV1wlwt,DIV1wrwt,DIV1huwt,DIV1hdwt;						/* help variables (OUTER wall) */
  double u1wrwt,u2wrwt,u1wlwt,u2wlwt,u1huwt,u2huwt,u1hdwt,u2hdwt;			/* help variables to calculate the long axis a of the ellipse (OUTER walls)*/
  double dxwr,dzwr,dxwl,dzwl,dyhu,dzhu,dyhd,dzhd;					/* help variables to calculate the entrance and exit witdh of the OUTER walls*/


  double zw1r,zw2r,zw1l,zw2l,zh1u,zh2u,zh1d,zh2d,m,n;							/* zcomponent of the intersection point of the neutron trajectory and the ellipse (INNER walls)*/
  double pwr,qwr,pwl,qwl,phu,qhu,phd,qhd;								/* parameters for the quadratic equations for the intersection points or the intersection time (INNER walls)*/
  double nz,nx,ny,n2;											/* component and length of the surfaces normal vector at the intersection point */
  double pf;												/* prefactor to calculate the velocity vector after the interaction */
  double vxin,vyin,vzin;										/* velocity vector components before the interaction*/
  double q;												/* q-vector for the interaction */
  double xintersecwr,xintersecwl,yintersechd,yintersechu;						/* intersection point crosscheck variables (INNER walls) */
  double xlimitr,xlimitrwt,xlimitl,xlimitlwt,ylimitd,ylimitdwt,ylimitu,ylimituwt;			/* limit variables to determine the interaction position given by the time relative to the guide walls*/
  double xtest,ytest;											/* interaction position of the neutron given by the interaction time; crosscheck with limit variables*/
  double pwrwt,qwrwt,pwlwt,qwlwt,phuwt,qhuwt,phdwt,qhdwt;						/* parameters for the quadratic equations for the intersection points or the intersection time (OUTER walls)*/
  double zw1rwt,zw2rwt,zw1lwt,zw2lwt,zh1uwt,zh2uwt,zh1dwt,zh2dwt;					/* zcomponent of the intersection point of the neutron trajectory and the ellipse (OUTER walls)*/
  double xintersecwrwt,xintersecwlwt,yintersechdwt,yintersechuwt;					/* intersection point crosscheck variables (OUTER walls) */


  t_Table riTable,liTable,uiTable,diTable;
  t_Table roTable,loTable,uoTable,doTable;

  double w1rwt1,w1lwt1,h1uwt1,h1dwt1,w2rwt1,w2lwt1,h2uwt1,h2dwt1;
  double pawr1,pawl1,pbwr1,pbwl1,pahu1,pahd1,pbhu1,pbhd1;
  double awl1,bwl1,awr1,bwr1,ahu1,bhu1,ahd1,bhd1;
  double awlwt1,bwlwt1,awrwt1,bwrwt1,ahuwt1,bhuwt1,ahdwt1,bhdwt1;
  double pawrwt1,pawlwt1,pbwrwt1,pbwlwt1,pahuwt1,pahdwt1,pbhuwt1,pbhdwt1;
  double t2w1r1,t2w2r1,t2w1l1,t2w2l1,t2h1u1,t2h2u1,t2h1d1,t2h2d1;
  double t2w1rwt1,t2w2rwt1,t2w1lwt1,t2w2lwt1,t2h1uwt1,t2h2uwt1,t2h1dwt1,t2h2dwt1;

  double a2wlwt1,b2wlwt1,a2wrwt1,b2wrwt1,a2huwt1,b2huwt1,a2hdwt1,b2hdwt1;
  double a2wl1,b2wl1,a2wr1,b2wr1,a2hu1,b2hu1,a2hd1,b2hd1;
  double mru11,mru21,nru11,nru21,mrd11,mrd21,nrd11,nrd21,mlu11,mlu21,nlu11,nlu21,mld11,mld21,nld11,nld21;
  double z0wr1,z0wl1,z0hu1,z0hd1;

  double lbwl1,lbwr1,lbhu1,lbhd1;
  double p2parawr1,p2parawl1,p2parahu1,p2parahd1;
  double u1wl1,u2wl1,u1wr1,u2wr1,u1hu1,u2hu1,u1hd1,u2hd1;
  double DIV1wl1,DIV1wr1,DIV1hu1,DIV1hd1;
  double p2parawrwt1,p2parawlwt1,p2parahuwt1,p2parahdwt1;
  double DIV1wlwt1,DIV1wrwt1,DIV1huwt1,DIV1hdwt1;
  double u1wrwt1,u2wrwt1,u1wlwt1,u2wlwt1,u1huwt1,u2huwt1,u1hdwt1,u2hdwt1;
  double dxwr1,dzwr1,dxwl1,dzwl1,dyhu1,dzhu1,dyhd1,dzhd1;


  double zw1r1,zw2r1,zw1l1,zw2l1,zh1u1,zh2u1,zh1d1,zh2d1;
  double pwr1,qwr1,pwl1,qwl1,phu1,qhu1,phd1,qhd1;
  double xintersecwr1,xintersecwl1,yintersechd1,yintersechu1;
  double pwrwt1,qwrwt1,pwlwt1,qwlwt1,phuwt1,qhuwt1,phdwt1,qhdwt1;
  double zw1rwt1,zw2rwt1,zw1lwt1,zw2lwt1,zh1uwt1,zh2uwt1,zh1dwt1,zh2dwt1;
  double xintersecwrwt1,xintersecwlwt1,yintersechdwt1,yintersechuwt1;

  t_Table riTable1,liTable1,uiTable1,diTable1;
  t_Table roTable1,loTable1,uoTable1,doTable1;

  double w1rwt2,w1lwt2,h1uwt2,h1dwt2,w2rwt2,w2lwt2,h2uwt2,h2dwt2;
  double pawr2,pawl2,pbwr2,pbwl2,pahu2,pahd2,pbhu2,pbhd2;
  double awl2,bwl2,awr2,bwr2,ahu2,bhu2,ahd2,bhd2;
  double awlwt2,bwlwt2,awrwt2,bwrwt2,ahuwt2,bhuwt2,ahdwt2,bhdwt2;
  double pawrwt2,pawlwt2,pbwrwt2,pbwlwt2,pahuwt2,pahdwt2,pbhuwt2,pbhdwt2;
  double t2w1r2,t2w2r2,t2w1l2,t2w2l2,t2h1u2,t2h2u2,t2h1d2,t2h2d2;
  double t2w1rwt2,t2w2rwt2,t2w1lwt2,t2w2lwt2,t2h1uwt2,t2h2uwt2,t2h1dwt2,t2h2dwt2;

  double a2wlwt2,b2wlwt2,a2wrwt2,b2wrwt2,a2huwt2,b2huwt2,a2hdwt2,b2hdwt2;
  double a2wl2,b2wl2,a2wr2,b2wr2,a2hu2,b2hu2,a2hd2,b2hd2;
  double mru12,mru22,nru12,nru22,mrd12,mrd22,nrd12,nrd22,mlu12,mlu22,nlu12,nlu22,mld12,mld22,nld12,nld22;
  double z0wr2,z0wl2,z0hu2,z0hd2;

  double lbwl2,lbwr2,lbhu2,lbhd2;
  double p2parawr2,p2parawl2,p2parahu2,p2parahd2;
  double u1wl2,u2wl2,u1wr2,u2wr2,u1hu2,u2hu2,u1hd2,u2hd2;
  double DIV1wl2,DIV1wr2,DIV1hu2,DIV1hd2;
  double p2parawrwt2,p2parawlwt2,p2parahuwt2,p2parahdwt2;
  double DIV1wlwt2,DIV1wrwt2,DIV1huwt2,DIV1hdwt2;
  double u1wrwt2,u2wrwt2,u1wlwt2,u2wlwt2,u1huwt2,u2huwt2,u1hdwt2,u2hdwt2;
  double dxwr2,dzwr2,dxwl2,dzwl2,dyhu2,dzhu2,dyhd2,dzhd2;


  double zw1r2,zw2r2,zw1l2,zw2l2,zh1u2,zh2u2,zh1d2,zh2d2;
  double pwr2,qwr2,pwl2,qwl2,phu2,qhu2,phd2,qhd2;
  double xintersecwr2,xintersecwl2,yintersechd2,yintersechu2;
  double pwrwt2,qwrwt2,pwlwt2,qwlwt2,phuwt2,qhuwt2,phdwt2,qhdwt2;
  double zw1rwt2,zw2rwt2,zw1lwt2,zw2lwt2,zh1uwt2,zh2uwt2,zh1dwt2,zh2dwt2;
  double xintersecwrwt2,xintersecwlwt2,yintersechdwt2,yintersechuwt2;

  t_Table riTable2, liTable2, uiTable2, diTable2;
  t_Table roTable2, loTable2, uoTable2, doTable2;

  double t2w1r3,t2w2r3,t2w1l3,t2w2l3,t2h1u3,t2h2u3,t2h1d3,t2h2d3;
  double t2w1rwt3,t2w2rwt3,t2w1lwt3,t2w2lwt3,t2h1uwt3,t2h2uwt3,t2h1dwt3,t2h2dwt3;
  double t2w1r4,t2w2r4,t2w1l4,t2w2l4,t2h1u4,t2h2u4,t2h1d4,t2h2d4;
  double t2w1rwt4,t2w2rwt4,t2w1lwt4,t2w2lwt4,t2h1uwt4,t2h2uwt4,t2h1dwt4,t2h2dwt4;
  double t2w1r5,t2w2r5,t2w1l5,t2w2l5,t2h1u5,t2h2u5,t2h1d5,t2h2d5;
  double t2w1rwt5,t2w2rwt5,t2w1lwt5,t2w2lwt5,t2h1uwt5,t2h2uwt5,t2h1dwt5,t2h2dwt5;
  double t2w1r6,t2w2r6,t2w1l6,t2w2l6,t2h1u6,t2h2u6,t2h1d6,t2h2d6;
  double t2w1rwt6,t2w2rwt6,t2w1lwt6,t2w2lwt6,t2h1uwt6,t2h2uwt6,t2h1dwt6,t2h2dwt6;
  double t2w1r7,t2w2r7,t2w1l7,t2w2l7,t2h1u7,t2h2u7,t2h1d7,t2h2d7;
  double t2w1rwt7,t2w2rwt7,t2w1lwt7,t2w2lwt7,t2h1uwt7,t2h2uwt7,t2h1dwt7,t2h2dwt7;
  double t2w1r8,t2w2r8,t2w1l8,t2w2l8,t2h1u8,t2h2u8,t2h1d8,t2h2d8;
  double t2w1rwt8,t2w2rwt8,t2w1lwt8,t2w2lwt8,t2h1uwt8,t2h2uwt8,t2h1dwt8,t2h2dwt8;
  double t2w1r9,t2w2r9,t2w1l9,t2w2l9,t2h1u9,t2h2u9,t2h1d9,t2h2d9;
  double t2w1rwt9,t2w2rwt9,t2w1lwt9,t2w2lwt9,t2h1uwt9,t2h2uwt9,t2h1dwt9,t2h2dwt9;
  double t2w1r10,t2w2r10,t2w1l10,t2w2l10,t2h1u10,t2h2u10,t2h1d10,t2h2d10;
  double t2w1rwt10,t2w2rwt10,t2w1lwt10,t2w2lwt10,t2h1uwt10,t2h2uwt10,t2h1dwt10,t2h2dwt10;

  double w1rwt3,w1lwt3,h1uwt3,h1dwt3,w2rwt3,w2lwt3,h2uwt3,h2dwt3;
  double pawr3,pawl3,pbwr3,pbwl3,pahu3,pahd3,pbhu3,pbhd3;
  double awl3,bwl3,awr3,bwr3,ahu3,bhu3,ahd3,bhd3;
  double awlwt3,bwlwt3,awrwt3,bwrwt3,ahuwt3,bhuwt3,ahdwt3,bhdwt3;
  double pawrwt3,pawlwt3,pbwrwt3,pbwlwt3,pahuwt3,pahdwt3,pbhuwt3,pbhdwt3;

  double a2wlwt3,b2wlwt3,a2wrwt3,b2wrwt3,a2huwt3,b2huwt3,a2hdwt3,b2hdwt3;
  double a2wl3,b2wl3,a2wr3,b2wr3,a2hu3,b2hu3,a2hd3,b2hd3;
  double mru13,mru23,nru13,nru23,mrd13,mrd23,nrd13,nrd23,mlu13,mlu23,nlu13,nlu23,mld13,mld23,nld13,nld23;
  double z0wr3,z0wl3,z0hu3,z0hd3;

  double lbwl3,lbwr3,lbhu3,lbhd3;
  double p2parawr3,p2parawl3,p2parahu3,p2parahd3;
  double u1wl3,u2wl3,u1wr3,u2wr3,u1hu3,u2hu3,u1hd3,u2hd3;
  double DIV1wl3,DIV1wr3,DIV1hu3,DIV1hd3;
  double p2parawrwt3,p2parawlwt3,p2parahuwt3,p2parahdwt3;
  double DIV1wlwt3,DIV1wrwt3,DIV1huwt3,DIV1hdwt3;
  double u1wrwt3,u2wrwt3,u1wlwt3,u2wlwt3,u1huwt3,u2huwt3,u1hdwt3,u2hdwt3;
  double dxwr3,dzwr3,dxwl3,dzwl3,dyhu3,dzhu3,dyhd3,dzhd3;


  double zw1r3,zw2r3,zw1l3,zw2l3,zh1u3,zh2u3,zh1d3,zh2d3;
  double pwr3,qwr3,pwl3,qwl3,phu3,qhu3,phd3,qhd3;
  double xintersecwr3,xintersecwl3,yintersechd3,yintersechu3;
  double pwrwt3,qwrwt3,pwlwt3,qwlwt3,phuwt3,qhuwt3,phdwt3,qhdwt3;
  double zw1rwt3,zw2rwt3,zw1lwt3,zw2lwt3,zh1uwt3,zh2uwt3,zh1dwt3,zh2dwt3;
  double xintersecwrwt3,xintersecwlwt3,yintersechdwt3,yintersechuwt3;

  t_Table riTable3,liTable3,uiTable3,diTable3;
  t_Table roTable3,loTable3,uoTable3,doTable3;
  
  double w1rwt4,w1lwt4,h1uwt4,h1dwt4,w2rwt4,w2lwt4,h2uwt4,h2dwt4;
  double pawr4,pawl4,pbwr4,pbwl4,pahu4,pahd4,pbhu4,pbhd4;
  double awl4,bwl4,awr4,bwr4,ahu4,bhu4,ahd4,bhd4;
  double awlwt4,bwlwt4,awrwt4,bwrwt4,ahuwt4,bhuwt4,ahdwt4,bhdwt4;
  double pawrwt4,pawlwt4,pbwrwt4,pbwlwt4,pahuwt4,pahdwt4,pbhuwt4,pbhdwt4;

  double a2wlwt4,b2wlwt4,a2wrwt4,b2wrwt4,a2huwt4,b2huwt4,a2hdwt4,b2hdwt4;
  double a2wl4,b2wl4,a2wr4,b2wr4,a2hu4,b2hu4,a2hd4,b2hd4;
  double mru14,mru24,nru14,nru24,mrd14,mrd24,nrd14,nrd24,mlu14,mlu24,nlu14,nlu24,mld14,mld24,nld14,nld24;
  double z0wr4,z0wl4,z0hu4,z0hd4;

  double lbwl4,lbwr4,lbhu4,lbhd4;
  double p2parawr4,p2parawl4,p2parahu4,p2parahd4;
  double u1wl4,u2wl4,u1wr4,u2wr4,u1hu4,u2hu4,u1hd4,u2hd4;
  double DIV1wl4,DIV1wr4,DIV1hu4,DIV1hd4;
  double p2parawrwt4,p2parawlwt4,p2parahuwt4,p2parahdwt4;
  double DIV1wlwt4,DIV1wrwt4,DIV1huwt4,DIV1hdwt4;
  double u1wrwt4,u2wrwt4,u1wlwt4,u2wlwt4,u1huwt4,u2huwt4,u1hdwt4,u2hdwt4;
  double dxwr4,dzwr4,dxwl4,dzwl4,dyhu4,dzhu4,dyhd4,dzhd4;


  double zw1r4,zw2r4,zw1l4,zw2l4,zh1u4,zh2u4,zh1d4,zh2d4;
  double pwr4,qwr4,pwl4,qwl4,phu4,qhu4,phd4,qhd4;
  double xintersecwr4,xintersecwl4,yintersechd4,yintersechu4;
  double pwrwt4,qwrwt4,pwlwt4,qwlwt4,phuwt4,qhuwt4,phdwt4,qhdwt4;
  double zw1rwt4,zw2rwt4,zw1lwt4,zw2lwt4,zh1uwt4,zh2uwt4,zh1dwt4,zh2dwt4;
  double xintersecwrwt4,xintersecwlwt4,yintersechdwt4,yintersechuwt4;

  t_Table riTable4,liTable4,uiTable4,diTable4;
  t_Table roTable4,loTable4,uoTable4,doTable4;

    double w1rwt5,w1lwt5,h1uwt5,h1dwt5,w2rwt5,w2lwt5,h2uwt5,h2dwt5;
  double pawr5,pawl5,pbwr5,pbwl5,pahu5,pahd5,pbhu5,pbhd5;
  double awl5,bwl5,awr5,bwr5,ahu5,bhu5,ahd5,bhd5;
  double awlwt5,bwlwt5,awrwt5,bwrwt5,ahuwt5,bhuwt5,ahdwt5,bhdwt5;
  double pawrwt5,pawlwt5,pbwrwt5,pbwlwt5,pahuwt5,pahdwt5,pbhuwt5,pbhdwt5;

  double a2wlwt5,b2wlwt5,a2wrwt5,b2wrwt5,a2huwt5,b2huwt5,a2hdwt5,b2hdwt5;
  double a2wl5,b2wl5,a2wr5,b2wr5,a2hu5,b2hu5,a2hd5,b2hd5;
  double mru15,mru25,nru15,nru25,mrd15,mrd25,nrd15,nrd25,mlu15,mlu25,nlu15,nlu25,mld15,mld25,nld15,nld25;
  double z0wr5,z0wl5,z0hu5,z0hd5;

  double lbwl5,lbwr5,lbhu5,lbhd5;
  double p2parawr5,p2parawl5,p2parahu5,p2parahd5;
  double u1wl5,u2wl5,u1wr5,u2wr5,u1hu5,u2hu5,u1hd5,u2hd5;
  double DIV1wl5,DIV1wr5,DIV1hu5,DIV1hd5;
  double p2parawrwt5,p2parawlwt5,p2parahuwt5,p2parahdwt5;
  double DIV1wlwt5,DIV1wrwt5,DIV1huwt5,DIV1hdwt5;
  double u1wrwt5,u2wrwt5,u1wlwt5,u2wlwt5,u1huwt5,u2huwt5,u1hdwt5,u2hdwt5;
  double dxwr5,dzwr5,dxwl5,dzwl5,dyhu5,dzhu5,dyhd5,dzhd5;


  double zw1r5,zw2r5,zw1l5,zw2l5,zh1u5,zh2u5,zh1d5,zh2d5;
  double pwr5,qwr5,pwl5,qwl5,phu5,qhu5,phd5,qhd5;
  double xintersecwr5,xintersecwl5,yintersechd5,yintersechu5;
  double pwrwt5,qwrwt5,pwlwt5,qwlwt5,phuwt5,qhuwt5,phdwt5,qhdwt5;
  double zw1rwt5,zw2rwt5,zw1lwt5,zw2lwt5,zh1uwt5,zh2uwt5,zh1dwt5,zh2dwt5;
  double xintersecwrwt5,xintersecwlwt5,yintersechdwt5,yintersechuwt5;

  t_Table riTable5,liTable5,uiTable5,diTable5;
  t_Table roTable5,loTable5,uoTable5,doTable5;

  double w1rwt6,w1lwt6,h1uwt6,h1dwt6,w2rwt6,w2lwt6,h2uwt6,h2dwt6;
  double pawr6,pawl6,pbwr6,pbwl6,pahu6,pahd6,pbhu6,pbhd6;
  double awl6,bwl6,awr6,bwr6,ahu6,bhu6,ahd6,bhd6;
  double awlwt6,bwlwt6,awrwt6,bwrwt6,ahuwt6,bhuwt6,ahdwt6,bhdwt6;
  double pawrwt6,pawlwt6,pbwrwt6,pbwlwt6,pahuwt6,pahdwt6,pbhuwt6,pbhdwt6;

  double a2wlwt6,b2wlwt6,a2wrwt6,b2wrwt6,a2huwt6,b2huwt6,a2hdwt6,b2hdwt6;
  double a2wl6,b2wl6,a2wr6,b2wr6,a2hu6,b2hu6,a2hd6,b2hd6;
  double mru16,mru26,nru16,nru26,mrd16,mrd26,nrd16,nrd26,mlu16,mlu26,nlu16,nlu26,mld16,mld26,nld16,nld26;
  double z0wr6,z0wl6,z0hu6,z0hd6;

  double lbwl6,lbwr6,lbhu6,lbhd6;
  double p2parawr6,p2parawl6,p2parahu6,p2parahd6;
  double u1wl6,u2wl6,u1wr6,u2wr6,u1hu6,u2hu6,u1hd6,u2hd6;
  double DIV1wl6,DIV1wr6,DIV1hu6,DIV1hd6;
  double p2parawrwt6,p2parawlwt6,p2parahuwt6,p2parahdwt6;
  double DIV1wlwt6,DIV1wrwt6,DIV1huwt6,DIV1hdwt6;
  double u1wrwt6,u2wrwt6,u1wlwt6,u2wlwt6,u1huwt6,u2huwt6,u1hdwt6,u2hdwt6;
  double dxwr6,dzwr6,dxwl6,dzwl6,dyhu6,dzhu6,dyhd6,dzhd6;


  double zw1r6,zw2r6,zw1l6,zw2l6,zh1u6,zh2u6,zh1d6,zh2d6;
  double pwr6,qwr6,pwl6,qwl6,phu6,qhu6,phd6,qhd6;
  double xintersecwr6,xintersecwl6,yintersechd6,yintersechu6;
  double pwrwt6,qwrwt6,pwlwt6,qwlwt6,phuwt6,qhuwt6,phdwt6,qhdwt6;
  double zw1rwt6,zw2rwt6,zw1lwt6,zw2lwt6,zh1uwt6,zh2uwt6,zh1dwt6,zh2dwt6;
  double xintersecwrwt6,xintersecwlwt6,yintersechdwt6,yintersechuwt6;

  t_Table riTable6,liTable6,uiTable6,diTable6;
  t_Table roTable6,loTable6,uoTable6,doTable6;

  double w1rwt7,w1lwt7,h1uwt7,h1dwt7,w2rwt7,w2lwt7,h2uwt7,h2dwt7;
  double pawr7,pawl7,pbwr7,pbwl7,pahu7,pahd7,pbhu7,pbhd7;
  double awl7,bwl7,awr7,bwr7,ahu7,bhu7,ahd7,bhd7;
  double awlwt7,bwlwt7,awrwt7,bwrwt7,ahuwt7,bhuwt7,ahdwt7,bhdwt7;
  double pawrwt7,pawlwt7,pbwrwt7,pbwlwt7,pahuwt7,pahdwt7,pbhuwt7,pbhdwt7;

  double a2wlwt7,b2wlwt7,a2wrwt7,b2wrwt7,a2huwt7,b2huwt7,a2hdwt7,b2hdwt7;
  double a2wl7,b2wl7,a2wr7,b2wr7,a2hu7,b2hu7,a2hd7,b2hd7;
  double mru17,mru27,nru17,nru27,mrd17,mrd27,nrd17,nrd27,mlu17,mlu27,nlu17,nlu27,mld17,mld27,nld17,nld27;
  double z0wr7,z0wl7,z0hu7,z0hd7;

  double lbwl7,lbwr7,lbhu7,lbhd7;
  double p2parawr7,p2parawl7,p2parahu7,p2parahd7;
  double u1wl7,u2wl7,u1wr7,u2wr7,u1hu7,u2hu7,u1hd7,u2hd7;
  double DIV1wl7,DIV1wr7,DIV1hu7,DIV1hd7;
  double p2parawrwt7,p2parawlwt7,p2parahuwt7,p2parahdwt7;
  double DIV1wlwt7,DIV1wrwt7,DIV1huwt7,DIV1hdwt7;
  double u1wrwt7,u2wrwt7,u1wlwt7,u2wlwt7,u1huwt7,u2huwt7,u1hdwt7,u2hdwt7;
  double dxwr7,dzwr7,dxwl7,dzwl7,dyhu7,dzhu7,dyhd7,dzhd7;


  double zw1r7,zw2r7,zw1l7,zw2l7,zh1u7,zh2u7,zh1d7,zh2d7;
  double pwr7,qwr7,pwl7,qwl7,phu7,qhu7,phd7,qhd7;
  double xintersecwr7,xintersecwl7,yintersechd7,yintersechu7;
  double pwrwt7,qwrwt7,pwlwt7,qwlwt7,phuwt7,qhuwt7,phdwt7,qhdwt7;
  double zw1rwt7,zw2rwt7,zw1lwt7,zw2lwt7,zh1uwt7,zh2uwt7,zh1dwt7,zh2dwt7;
  double xintersecwrwt7,xintersecwlwt7,yintersechdwt7,yintersechuwt7;

  t_Table riTable7,liTable7,uiTable7,diTable7;
  t_Table roTable7,loTable7,uoTable7,doTable7;

  double w1rwt8,w1lwt8,h1uwt8,h1dwt8,w2rwt8,w2lwt8,h2uwt8,h2dwt8;
  double pawr8,pawl8,pbwr8,pbwl8,pahu8,pahd8,pbhu8,pbhd8;
  double awl8,bwl8,awr8,bwr8,ahu8,bhu8,ahd8,bhd8;
  double awlwt8,bwlwt8,awrwt8,bwrwt8,ahuwt8,bhuwt8,ahdwt8,bhdwt8;
  double pawrwt8,pawlwt8,pbwrwt8,pbwlwt8,pahuwt8,pahdwt8,pbhuwt8,pbhdwt8;

  double a2wlwt8,b2wlwt8,a2wrwt8,b2wrwt8,a2huwt8,b2huwt8,a2hdwt8,b2hdwt8;
  double a2wl8,b2wl8,a2wr8,b2wr8,a2hu8,b2hu8,a2hd8,b2hd8;
  double mru18,mru28,nru18,nru28,mrd18,mrd28,nrd18,nrd28,mlu18,mlu28,nlu18,nlu28,mld18,mld28,nld18,nld28;
  double z0wr8,z0wl8,z0hu8,z0hd8;

  double lbwl8,lbwr8,lbhu8,lbhd8;
  double p2parawr8,p2parawl8,p2parahu8,p2parahd8;
  double u1wl8,u2wl8,u1wr8,u2wr8,u1hu8,u2hu8,u1hd8,u2hd8;
  double DIV1wl8,DIV1wr8,DIV1hu8,DIV1hd8;
  double p2parawrwt8,p2parawlwt8,p2parahuwt8,p2parahdwt8;
  double DIV1wlwt8,DIV1wrwt8,DIV1huwt8,DIV1hdwt8;
  double u1wrwt8,u2wrwt8,u1wlwt8,u2wlwt8,u1huwt8,u2huwt8,u1hdwt8,u2hdwt8;
  double dxwr8,dzwr8,dxwl8,dzwl8,dyhu8,dzhu8,dyhd8,dzhd8;


  double zw1r8,zw2r8,zw1l8,zw2l8,zh1u8,zh2u8,zh1d8,zh2d8;
  double pwr8,qwr8,pwl8,qwl8,phu8,qhu8,phd8,qhd8;
  double xintersecwr8,xintersecwl8,yintersechd8,yintersechu8;
  double pwrwt8,qwrwt8,pwlwt8,qwlwt8,phuwt8,qhuwt8,phdwt8,qhdwt8;
  double zw1rwt8,zw2rwt8,zw1lwt8,zw2lwt8,zh1uwt8,zh2uwt8,zh1dwt8,zh2dwt8;
  double xintersecwrwt8,xintersecwlwt8,yintersechdwt8,yintersechuwt8;

  t_Table riTable8,liTable8,uiTable8,diTable8;
  t_Table roTable8,loTable8,uoTable8,doTable8;

  double w1rwt9,w1lwt9,h1uwt9,h1dwt9,w2rwt9,w2lwt9,h2uwt9,h2dwt9;
  double pawr9,pawl9,pbwr9,pbwl9,pahu9,pahd9,pbhu9,pbhd9;
  double awl9,bwl9,awr9,bwr9,ahu9,bhu9,ahd9,bhd9;
  double awlwt9,bwlwt9,awrwt9,bwrwt9,ahuwt9,bhuwt9,ahdwt9,bhdwt9;
  double pawrwt9,pawlwt9,pbwrwt9,pbwlwt9,pahuwt9,pahdwt9,pbhuwt9,pbhdwt9;

  double a2wlwt9,b2wlwt9,a2wrwt9,b2wrwt9,a2huwt9,b2huwt9,a2hdwt9,b2hdwt9;
  double a2wl9,b2wl9,a2wr9,b2wr9,a2hu9,b2hu9,a2hd9,b2hd9;
  double mru19,mru29,nru19,nru29,mrd19,mrd29,nrd19,nrd29,mlu19,mlu29,nlu19,nlu29,mld19,mld29,nld19,nld29;
  double z0wr9,z0wl9,z0hu9,z0hd9;

  double lbwl9,lbwr9,lbhu9,lbhd9;
  double p2parawr9,p2parawl9,p2parahu9,p2parahd9;
  double u1wl9,u2wl9,u1wr9,u2wr9,u1hu9,u2hu9,u1hd9,u2hd9;
  double DIV1wl9,DIV1wr9,DIV1hu9,DIV1hd9;
  double p2parawrwt9,p2parawlwt9,p2parahuwt9,p2parahdwt9;
  double DIV1wlwt9,DIV1wrwt9,DIV1huwt9,DIV1hdwt9;
  double u1wrwt9,u2wrwt9,u1wlwt9,u2wlwt9,u1huwt9,u2huwt9,u1hdwt9,u2hdwt9;
  double dxwr9,dzwr9,dxwl9,dzwl9,dyhu9,dzhu9,dyhd9,dzhd9;


  double zw1r9,zw2r9,zw1l9,zw2l9,zh1u9,zh2u9,zh1d9,zh2d9;
  double pwr9,qwr9,pwl9,qwl9,phu9,qhu9,phd9,qhd9;
  double xintersecwr9,xintersecwl9,yintersechd9,yintersechu9;
  double pwrwt9,qwrwt9,pwlwt9,qwlwt9,phuwt9,qhuwt9,phdwt9,qhdwt9;
  double zw1rwt9,zw2rwt9,zw1lwt9,zw2lwt9,zh1uwt9,zh2uwt9,zh1dwt9,zh2dwt9;
  double xintersecwrwt9,xintersecwlwt9,yintersechdwt9,yintersechuwt9;

  t_Table riTable9,liTable9,uiTable9,diTable9;
  t_Table roTable9,loTable9,uoTable9,doTable9;

  double w1rwt10,w1lwt10,h1uwt10,h1dwt10,w2rwt10,w2lwt10,h2uwt10,h2dwt10;
  double pawr10,pawl10,pbwr10,pbwl10,pahu10,pahd10,pbhu10,pbhd10;
  double awl10,bwl10,awr10,bwr10,ahu10,bhu10,ahd10,bhd10;
  double awlwt10,bwlwt10,awrwt10,bwrwt10,ahuwt10,bhuwt10,ahdwt10,bhdwt10;
  double pawrwt10,pawlwt10,pbwrwt10,pbwlwt10,pahuwt10,pahdwt10,pbhuwt10,pbhdwt10;

  double a2wlwt10,b2wlwt10,a2wrwt10,b2wrwt10,a2huwt10,b2huwt10,a2hdwt10,b2hdwt10;
  double a2wl10,b2wl10,a2wr10,b2wr10,a2hu10,b2hu10,a2hd10,b2hd10;
  double mru110,mru210,nru110,nru210,mrd110,mrd210,nrd110,nrd210,mlu110,mlu210,nlu110,nlu210,mld110,mld210,nld110,nld210;
  double z0wr10,z0wl10,z0hu10,z0hd10;

  double lbwl10,lbwr10,lbhu10,lbhd10;
  double p2parawr10,p2parawl10,p2parahu10,p2parahd10;
  double u1wl10,u2wl10,u1wr10,u2wr10,u1hu10,u2hu10,u1hd10,u2hd10;
  double DIV1wl10,DIV1wr10,DIV1hu10,DIV1hd10;
  double p2parawrwt10,p2parawlwt10,p2parahuwt10,p2parahdwt10;
  double DIV1wlwt10,DIV1wrwt10,DIV1huwt10,DIV1hdwt10;
  double u1wrwt10,u2wrwt10,u1wlwt10,u2wlwt10,u1huwt10,u2huwt10,u1hdwt10,u2hdwt10;
  double dxwr10,dzwr10,dxwl10,dzwl10,dyhu10,dzhu10,dyhd10,dzhd10;


  double zw1r10,zw2r10,zw1l10,zw2l10,zh1u10,zh2u10,zh1d10,zh2d10;
  double pwr10,qwr10,pwl10,qwl10,phu10,qhu10,phd10,qhd10;
  double xintersecwr10,xintersecwl10,yintersechd10,yintersechu10;
  double pwrwt10,qwrwt10,pwlwt10,qwlwt10,phuwt10,qhuwt10,phdwt10,qhdwt10;
  double zw1rwt10,zw2rwt10,zw1lwt10,zw2lwt10,zh1uwt10,zh2uwt10,zh1dwt10,zh2dwt10;
  double xintersecwrwt10,xintersecwlwt10,yintersechdwt10,yintersechuwt10;

  t_Table riTable10,liTable10,uiTable10,diTable10;
  t_Table roTable10,loTable10,uoTable10,doTable10;

%}


INITIALIZE
%{

 int i;

if (RIreflect && strlen(RIreflect)) {
    if (Table_Read(&riTable, RIreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect));
  }

if (LIreflect && strlen(LIreflect)) {
    if (Table_Read(&liTable, LIreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect));
  }

if (UIreflect && strlen(UIreflect)) {
    if (Table_Read(&uiTable, UIreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect));
  }

if (DIreflect && strlen(DIreflect)) {
    if (Table_Read(&diTable, DIreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect));
  }

if (ROreflect && strlen(ROreflect)) {
    if (Table_Read(&roTable, ROreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect));
  }

if (LOreflect && strlen(LOreflect)) {
    if (Table_Read(&loTable, LOreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect));
  }

if (UOreflect && strlen(UOreflect)) {
    if (Table_Read(&uoTable, UOreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect));
  }

if (DOreflect && strlen(DOreflect)) {
    if (Table_Read(&doTable, DOreflect, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect));
  }

if (w1r < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW !=-1 && mxrOW < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW !=-1 && mxlOW<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW !=-1 && myuOW<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW !=-1 && mydOW<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr < 0 && mxr!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl < 0 && mxl!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu < 0 && myu!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd < 0 && myd!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (RIreflect1 && strlen(RIreflect1)) {
    if (Table_Read(&riTable1, RIreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect1));
  }

if (LIreflect1 && strlen(LIreflect1)) {
    if (Table_Read(&liTable1, LIreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect1));
  }

if (UIreflect1 && strlen(UIreflect1)) {
    if (Table_Read(&uiTable1, UIreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect1));
  }

if (DIreflect1 && strlen(DIreflect1)) {
    if (Table_Read(&diTable1, DIreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect1));
  }

if (ROreflect1 && strlen(ROreflect1)) {
    if (Table_Read(&roTable1, ROreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect1));
  }

if (LOreflect1 && strlen(LOreflect1)) {
    if (Table_Read(&loTable1, LOreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect1));
  }

if (UOreflect1 && strlen(UOreflect1)) {
    if (Table_Read(&uoTable1, UOreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect1));
  }

if (DOreflect1 && strlen(DOreflect1)) {
    if (Table_Read(&doTable1, DOreflect1, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect1));
  }


if (w1r1 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d1 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW1 !=-1 && mxrOW1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW1 !=-1 && mxlOW1<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW1 !=-1 && myuOW1<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW1 !=-1 && mydOW1<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick1 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick1 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr1 < 0 && mxr1!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr1 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl1 < 0 && mxl1!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl1 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu1 < 0 && myu1!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu1 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd1 < 0 && myd1!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd1 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr1 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl1 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu1 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd1 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd1 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect2 && strlen(RIreflect2)) {
    if (Table_Read(&riTable2, RIreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect2));
  }

if (LIreflect2 && strlen(LIreflect2)) {
    if (Table_Read(&liTable2, LIreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect2));
  }

if (UIreflect2 && strlen(UIreflect2)) {
    if (Table_Read(&uiTable2, UIreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect2));
  }

if (DIreflect2 && strlen(DIreflect2)) {
    if (Table_Read(&diTable2, DIreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect2));
  }

if (ROreflect2 && strlen(ROreflect2)) {
    if (Table_Read(&roTable2, ROreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect2));
  }

if (LOreflect2 && strlen(LOreflect2)) {
    if (Table_Read(&loTable2, LOreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect2));
  }

if (UOreflect2 && strlen(UOreflect2)) {
    if (Table_Read(&uoTable2, UOreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect2));
  }

if (DOreflect2 && strlen(DOreflect2)) {
    if (Table_Read(&doTable2, DOreflect2, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect2));
  }


if (w1r2 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d2 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW2 !=-1 && mxrOW2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW2 !=-1 && mxlOW2<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW2 !=-1 && myuOW2<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW2 !=-1 && mydOW2<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick2 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick2 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr2 < 0 && mxr2!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr2 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl2 < 0 && mxl2!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl2 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu2 < 0 && myu2!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu2 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd2 < 0 && myd2!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd2 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr2 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl2 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu2 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd2 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd2 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect3 && strlen(RIreflect3)) {
    if (Table_Read(&riTable3, RIreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect3));
  }

if (LIreflect3 && strlen(LIreflect3)) {
    if (Table_Read(&liTable3, LIreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect3));
  }

if (UIreflect3 && strlen(UIreflect3)) {
    if (Table_Read(&uiTable3, UIreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect3));
  }

if (DIreflect3 && strlen(DIreflect3)) {
    if (Table_Read(&diTable3, DIreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect3));
  }

if (ROreflect3 && strlen(ROreflect3)) {
    if (Table_Read(&roTable3, ROreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect3));
  }

if (LOreflect3 && strlen(LOreflect3)) {
    if (Table_Read(&loTable3, LOreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect3));
  }

if (UOreflect3 && strlen(UOreflect3)) {
    if (Table_Read(&uoTable3, UOreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect3));
  }

if (DOreflect3 && strlen(DOreflect3)) {
    if (Table_Read(&doTable3, DOreflect3, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect3));
  }


if (w1r3 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d3 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW3 !=-1 && mxrOW3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW3 !=-1 && mxlOW3<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW3 !=-1 && myuOW3<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW3 !=-1 && mydOW3<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick3 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick3 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr3 < 0 && mxr3!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr3 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl3 < 0 && mxl3!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl3 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu3 < 0 && myu3!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu3 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd3 < 0 && myd3!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd3 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr3 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl3 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu3 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd3 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd3 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect4 && strlen(RIreflect4)) {
    if (Table_Read(&riTable4, RIreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect4));
  }

if (LIreflect4 && strlen(LIreflect4)) {
    if (Table_Read(&liTable4, LIreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect4));
  }

if (UIreflect4 && strlen(UIreflect4)) {
    if (Table_Read(&uiTable4, UIreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect4));
  }

if (DIreflect4 && strlen(DIreflect4)) {
    if (Table_Read(&diTable4, DIreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect4));
  }

if (ROreflect4 && strlen(ROreflect4)) {
    if (Table_Read(&roTable4, ROreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect4));
  }

if (LOreflect4 && strlen(LOreflect4)) {
    if (Table_Read(&loTable4, LOreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect4));
  }

if (UOreflect4 && strlen(UOreflect4)) {
    if (Table_Read(&uoTable4, UOreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect4));
  }

if (DOreflect4 && strlen(DOreflect4)) {
    if (Table_Read(&doTable4, DOreflect4, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect4));
  }


if (w1r4 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d4 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW4 !=-1 && mxrOW4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW4 !=-1 && mxlOW4<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW4 !=-1 && myuOW4<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW4 !=-1 && mydOW4<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick4 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick4 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr4 < 0 && mxr4!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr4 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl4 < 0 && mxl4!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl4 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu4 < 0 && myu4!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu4 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd4 < 0 && myd4!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd4 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr4 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl4 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu4 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd4 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd4 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect5 && strlen(RIreflect5)) {
    if (Table_Read(&riTable5, RIreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect5));
  }

if (LIreflect5 && strlen(LIreflect5)) {
    if (Table_Read(&liTable5, LIreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect5));
  }

if (UIreflect5 && strlen(UIreflect5)) {
    if (Table_Read(&uiTable5, UIreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect5));
  }

if (DIreflect5 && strlen(DIreflect5)) {
    if (Table_Read(&diTable5, DIreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect5));
  }

if (ROreflect5 && strlen(ROreflect5)) {
    if (Table_Read(&roTable5, ROreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect5));
  }

if (LOreflect5 && strlen(LOreflect5)) {
    if (Table_Read(&loTable5, LOreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect5));
  }

if (UOreflect5 && strlen(UOreflect5)) {
    if (Table_Read(&uoTable5, UOreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect5));
  }

if (DOreflect5 && strlen(DOreflect5)) {
    if (Table_Read(&doTable5, DOreflect5, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect5));
  }


if (w1r5 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d5 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW5 !=-1 && mxrOW5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW5 !=-1 && mxlOW5<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW5 !=-1 && myuOW5<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW5 !=-1 && mydOW5<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick5 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick5 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr5 < 0 && mxr5!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr5 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl5 < 0 && mxl5!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl5 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu5 < 0 && myu5!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu5 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd5 < 0 && myd5!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd5 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr5 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl5 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu5 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd5 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd5 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect6 && strlen(RIreflect6)) {
    if (Table_Read(&riTable6, RIreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect6));
  }

if (LIreflect6 && strlen(LIreflect6)) {
    if (Table_Read(&liTable6, LIreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect6));
  }

if (UIreflect6 && strlen(UIreflect6)) {
    if (Table_Read(&uiTable6, UIreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect6));
  }

if (DIreflect6 && strlen(DIreflect6)) {
    if (Table_Read(&diTable6, DIreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect6));
  }

if (ROreflect6 && strlen(ROreflect6)) {
    if (Table_Read(&roTable6, ROreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect6));
  }

if (LOreflect6 && strlen(LOreflect6)) {
    if (Table_Read(&loTable6, LOreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect6));
  }

if (UOreflect6 && strlen(UOreflect6)) {
    if (Table_Read(&uoTable6, UOreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect6));
  }

if (DOreflect6 && strlen(DOreflect6)) {
    if (Table_Read(&doTable6, DOreflect6, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect6));
  }


if (w1r6 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d6 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW6 !=-1 && mxrOW6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW6 !=-1 && mxlOW6<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW6 !=-1 && myuOW6<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW6 !=-1 && mydOW6<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick6 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick6 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr6 < 0 && mxr6!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr6 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl6 < 0 && mxl6!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl6 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu6 < 0 && myu6!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu6 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd6 < 0 && myd6!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd6 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr6 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl6 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu6 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd6 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd6 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect7 && strlen(RIreflect7)) {
    if (Table_Read(&riTable7, RIreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect7));
  }

if (LIreflect7 && strlen(LIreflect7)) {
    if (Table_Read(&liTable7, LIreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect7));
  }

if (UIreflect7 && strlen(UIreflect7)) {
    if (Table_Read(&uiTable7, UIreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect7));
  }

if (DIreflect7 && strlen(DIreflect7)) {
    if (Table_Read(&diTable7, DIreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect7));
  }

if (ROreflect7 && strlen(ROreflect7)) {
    if (Table_Read(&roTable7, ROreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect7));
  }

if (LOreflect7 && strlen(LOreflect7)) {
    if (Table_Read(&loTable7, LOreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect7));
  }

if (UOreflect7 && strlen(UOreflect7)) {
    if (Table_Read(&uoTable7, UOreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect7));
  }

if (DOreflect7 && strlen(DOreflect7)) {
    if (Table_Read(&doTable7, DOreflect7, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect7));
  }


if (w1r7 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d7 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW7 !=-1 && mxrOW7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW7 !=-1 && mxlOW7<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW7 !=-1 && myuOW7<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW7 !=-1 && mydOW7<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick7 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick7 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr7 < 0 && mxr7!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr7 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl7 < 0 && mxl7!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl7 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu7 < 0 && myu7!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu7 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd7 < 0 && myd7!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd7 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr7 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl7 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu7 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd7 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd7 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (RIreflect8 && strlen(RIreflect8)) {
    if (Table_Read(&riTable8, RIreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect8));
  }

if (LIreflect8 && strlen(LIreflect8)) {
    if (Table_Read(&liTable8, LIreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect8));
  }

if (UIreflect8 && strlen(UIreflect8)) {
    if (Table_Read(&uiTable8, UIreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect8));
  }

if (DIreflect8 && strlen(DIreflect8)) {
    if (Table_Read(&diTable8, DIreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect8));
  }

if (ROreflect8 && strlen(ROreflect8)) {
    if (Table_Read(&roTable8, ROreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect8));
  }

if (LOreflect8 && strlen(LOreflect8)) {
    if (Table_Read(&loTable8, LOreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect8));
  }

if (UOreflect8 && strlen(UOreflect8)) {
    if (Table_Read(&uoTable8, UOreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect8));
  }

if (DOreflect8 && strlen(DOreflect8)) {
    if (Table_Read(&doTable8, DOreflect8, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect8));
  }


if (w1r8 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d8 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW8 !=-1 && mxrOW8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW8 !=-1 && mxlOW8<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW8 !=-1 && myuOW8<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW8 !=-1 && mydOW8<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick8 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick8 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr8 < 0 && mxr8!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr8 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl8 < 0 && mxl8!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl8 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu8 < 0 && myu8!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu8 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd8 < 0 && myd8!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd8 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr8 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl8 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu8 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd8 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd8 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect9 && strlen(RIreflect9)) {
    if (Table_Read(&riTable9, RIreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect9));
  }

if (LIreflect9 && strlen(LIreflect9)) {
    if (Table_Read(&liTable9, LIreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect9));
  }

if (UIreflect9 && strlen(UIreflect9)) {
    if (Table_Read(&uiTable9, UIreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect9));
  }

if (DIreflect9 && strlen(DIreflect9)) {
    if (Table_Read(&diTable9, DIreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect9));
  }

if (ROreflect9 && strlen(ROreflect9)) {
    if (Table_Read(&roTable9, ROreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect9));
  }

if (LOreflect9 && strlen(LOreflect9)) {
    if (Table_Read(&loTable9, LOreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect9));
  }

if (UOreflect9 && strlen(UOreflect9)) {
    if (Table_Read(&uoTable9, UOreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect9));
  }

if (DOreflect9 && strlen(DOreflect9)) {
    if (Table_Read(&doTable9, DOreflect9, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect9));
  }


if (w1r9 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d9 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW9 !=-1 && mxrOW9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW9 !=-1 && mxlOW9<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW9 !=-1 && myuOW9<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW9 !=-1 && mydOW9<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick9 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick9 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr9 < 0 && mxr9!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr9 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl9 < 0 && mxl9!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl9 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu9 < 0 && myu9!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu9 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd9 < 0 && myd9!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd9 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr9 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl9 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu9 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd9 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd9 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }


if (RIreflect10 && strlen(RIreflect10)) {
    if (Table_Read(&riTable10, RIreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, RIreflect10));
  }

if (LIreflect10 && strlen(LIreflect10)) {
    if (Table_Read(&liTable10, LIreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LIreflect10));
  }

if (UIreflect10 && strlen(UIreflect10)) {
    if (Table_Read(&uiTable10, UIreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UIreflect10));
  }

if (DIreflect10 && strlen(DIreflect10)) {
    if (Table_Read(&diTable10, DIreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton inner Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DIreflect10));
  }

if (ROreflect10 && strlen(ROreflect10)) {
    if (Table_Read(&roTable10, ROreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"right outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, ROreflect10));
  }

if (LOreflect10 && strlen(LOreflect10)) {
    if (Table_Read(&loTable10, LOreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"left outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, LOreflect10));
  }

if (UOreflect10 && strlen(UOreflect10)) {
    if (Table_Read(&uoTable10, UOreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"top outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, UOreflect10));
  }

if (DOreflect10 && strlen(DOreflect10)) {
    if (Table_Read(&doTable10, DOreflect10, 1) <= 0) 							/* read 1st block data from file into pTable */
      exit(fprintf(stderr,"botton outer Wall: %s: can not read file %s\n", NAME_CURRENT_COMP, DOreflect10));
  }


if (w1r10 < 0)											/* Ceckup for the input variables */
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1r10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w1l10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w1l10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1u10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1u10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h1d10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h1d10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2r10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2r10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (w2l10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) w2l10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2u10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2u10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (h2d10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) h2d10 should  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    fprintf(stderr,"           (for negative values use the global guide position !) \n");
    exit(-1);
  }

if (mxrOW10 !=-1 && mxrOW10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxrOW10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxlOW10 !=-1 && mxlOW10<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxlOW10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myuOW10 !=-1 && myuOW10<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myuOW10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mydOW10 !=-1 && mydOW10<0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mydOW10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Qcxl10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxl10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcxr10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcxr10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyu10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyu10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (Qcyd10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Qcyd10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxl10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxl10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphaxr10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphaxr10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayu10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayu10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (alphayd10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) alphayd10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (rwallthick10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) rwallthick10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (lwallthick10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) lwallthick10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }
if (uwallthick10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) uwallthick10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (dwallthick10 < 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) dwallthick10 can  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           NOT be negative \n");
    exit(-1);
  }

if (mxr10 < 0 && mxr10!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxr10 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (mxl10 < 0 && mxl10!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) mxl10 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myu10 < 0 && myu10!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myu10 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (myd10 < 0 && myd10!=-1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) myd10 must  \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be -1 (transperent) or \n");
    fprintf(stderr,"           be  0 (absorbing) or \n");
    fprintf(stderr,"           be  > 0 (reflecting) \n");
    exit(-1);
  }

if (Wxr10 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxr10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wxl10 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wxl10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyu10 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyu10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }

if (Wyd10 <=0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) Wyd10 must \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           be positive\n");
    exit(-1);
  }



if (l <= 0)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) real guide length \n",
    NAME_CURRENT_COMP);
    fprintf(stderr,"           is <= ZERO ! \n");
    exit(-1);
  }

if (mcgravitation) fprintf(stderr,"WARNING: Guide_four_side: %s: "
    "This component produces wrong results with gravitation !\n"
    "Use Guide_gravity.\n",
    NAME_CURRENT_COMP);


													/* Calculation of curve-parameters for the right side wall - negative x-axis */

													/* elliptic right side wall */

lbwr=linwr+l+loutwr;											/* lenght between the two focal points for the right wall */
z0wr=(linwr-l-loutwr)/2.0;										/* calculation of the z-component of the center of the ellipse for the right wall (with opposite sign)*/

if(loutwr!=0 && linwr!=0)										/* ? elliptic shape ? */
  { 
    u1wr=sqrt((linwr*linwr)+(w1r*w1r));									/* length between entrance focal point and starting point of the elliptic wall (INNER wall)*/
    u2wr=sqrt((w1r*w1r)+((l+loutwr)*(l+loutwr)));							/* length between exit focal point and end point of the elliptic wall (INNER wall) */
    awr=(u1wr+u2wr)/2.0;										/* long half axis a of the ellipse (INNER  wall)*/
    a2wr=awr*awr;											/* square of the long axis a (INNER wall)*/
    bwr=sqrt(a2wr-(lbwr*lbwr/4.0));									/* short half axis b of the ellipse  (INNER wall)*/
    b2wr=bwr*bwr;											/* square of short half axis b of the ellipse  (INNER wall)*/
    DIV1wr=sqrt(1.0-((lbwr/2.0-loutwr)*(lbwr/2.0-loutwr)/a2wr));					/* help variable to calculated the exit width (INNER wall)*/
    w2r=bwr*DIV1wr;											/* exit width (INNER wall)*/
    if(l<lbwr/2-loutwr){										/* if the maximum opening of  the guide is smaller than the small half axis b, the OUTER wall is defined by: */
        dxwr=rwallthick*sin(atan(a2wr*w1r/(b2wr*z0wr)));						/* help variable dx; needed because the wall is not paralell to the z-axis or the wallthickness is not perpendicular to z*/
        dzwr=rwallthick*cos(atan(a2wr*w1r/(b2wr*z0wr)));						/* help variable dz; needed because the wall is not paralell to the z-axis or the wallthickness is not perpendicular to z*/
    	u1wrwt=sqrt(((linwr+dzwr)*(linwr+dzwr))+((w1r+dxwr)*(w1r+dxwr)));				/* length between entrance focal point and starting point of the elliptic wall (OUTER wall)*/
    	u2wrwt=sqrt(((w1r+dxwr)*(w1r+dxwr))+((l+loutwr-dzwr)*(l+loutwr-dzwr)));				/* length between exit focal point and end point of the elliptic wall (OUTER wall) */
    	awrwt=(u1wrwt+u2wrwt)/2.0;									/* long half axis a of the ellipse  (OUTER wall)*/
    	a2wrwt=awrwt*awrwt;										/* square of the long axis a (OUTER wall)*/
    	bwrwt=sqrt(a2wrwt-(lbwr*lbwr/4.0));								/* short half axis b of the ellipse  (OUTER wall)*/
    	b2wrwt=bwrwt*bwrwt;										/* square of short half axis b of the ellipse  (OUTER wall)*/
    	w2rwt=bwrwt*sqrt(1.0-((lbwr/2.0-loutwr)*(lbwr/2.0-loutwr)/a2wrwt));				/* exit width for OUTER right elliptic wall */
        w1rwt=bwrwt*sqrt(1.0-((lbwr/2.0-loutwr-l)*(lbwr/2.0-loutwr-l)/a2wrwt));				/* entrance width for OUTER right elliptic wall */
    }else{												/* if the maximum opening of  the guide is the small half axis bthe OUTER wall is defined by:*/
	bwrwt=bwr+rwallthick;										/* short half axis b of the ellipse  (OUTER wall)*/
        b2wrwt=bwrwt*bwrwt;										/* square of the long axis a (OUTER wall)*/
        awrwt=sqrt(b2wrwt+(lbwr*lbwr/4.0));								/* long half axis a of the ellipse  (OUTER  wall)*/
        a2wrwt=b2wrwt+(lbwr*lbwr/4.0);									/* square of short half axis b of the ellipse  (OUTER wall)*/
        w2rwt=bwrwt*sqrt(1.0-((lbwr/2.0-loutwr)*(lbwr/2.0-loutwr)/a2wrwt));				/* exit width for OUTER right elliptic wall */
        w1rwt=bwrwt*sqrt(1.0-((lbwr/2.0-linwr)*(lbwr/2.0-linwr)/a2wrwt));				/* entrance width for OUTER right elliptic wall */
    }
   }

													/* parabolic focusing right side wall */

if(linwr==0 && loutwr!=0){										/* ? parabolic focusing shape ? */
    DIV1wr=(l+loutwr)*(l+loutwr);									/* help variable to calculate the curve parameters (INNER wall) */
    p2parawr=2.0*(sqrt(DIV1wr+(w1r*w1r))-sqrt(DIV1wr));							/* help variable to calculate the curve parameters (INNER wall) */
    w2r=sqrt(p2parawr*(loutwr+p2parawr/4.0));								/* exit width for right focusing parabolic wall (INNER wall) */
    pbwr=l+loutwr+p2parawr/4.0;										/* parameter b for parabolic equation to define the wall (INNER wall)*/
    pawr=1.0/p2parawr;											/* parameter a for parabolic equation to define the wall (INNER wall)*/
    dxwr=rwallthick*sin(atan(w1r*2*pawr));								/* help variable dx; needed because the wall is not paralell to the z-axis or the wallthickness is not perpendicular to z*/
    dzwr=rwallthick*cos(atan(w1r*2*pawr));								/* help variable dz; needed because the wall is not paralell to the z-axis or the wallthickness is not perpendicular to z*/
    DIV1wrwt=(l+loutwr-dzwr)*(l+loutwl-dzwr);								/* help variable to calculate the curve parameters (OUTER wall) */
    p2parawrwt=2.0*(sqrt(DIV1wrwt+((w1r+dxwr)*(w1r+dxwr)))-sqrt(DIV1wrwt));				/* help variable to calculate the curve parameters (OUTER wall) */
    pbwrwt=l+loutwr+p2parawrwt/4.0;									/* parameter b for parabolic equation to define the wall (OUTER wall)*/
    pawrwt=1.0/p2parawrwt;										/* parameter a for parabolic equation to define the wall (OUTER wall)*/
    w2rwt=sqrt(p2parawrwt*(loutwr+p2parawrwt/4.0));							/* exit width for right focusing parabolic wall (OUTER wall) */
    w1rwt=sqrt(p2parawrwt*(loutwr+l+p2parawrwt/4.0));							/* entrance width for right focusing parabolic wall (OUTER wall) */
   }

													/* parabolic defocusing right side wall */

if (linwr!=0 && loutwr==0)										/* ? parabolic defocusing shape ? */
    {
      DIV1wr=linwr*linwr;										/* help variable to calculate the curve parameters (INNER wall) */
      p2parawr=2.0*(sqrt(DIV1wr+(w1r*w1r))-sqrt(DIV1wr));						/* help variable to calculate the curve parameters (INNER wall) */
      w2r=sqrt(p2parawr*(l+linwr+p2parawr/4.0));							/* exit width for right focusing parabolic wall (INNER wall) */
      pbwr=-(linwr+p2parawr/4.0);									/* parameter b for parabolic equation to define the wall (INNER wall)*/
      pawr=-1.0/p2parawr;										/* parameter a for parabolic equation to define the wall (INNER wall)*/
      dxwr=rwallthick*sin(atan(-w2r*2*pawr));								/* help variable dx; needed because the wall is not paralell to the z-axis or the wallthickness is not perpendicular to z*/
      dzwr=rwallthick*cos(atan(-w2r*2*pawr));								/* help variable dz; needed because the wall is not paralell to the z-axis or the wallthickness is not perpendicular to z*/
      DIV1wrwt=(linwr+l-dzwr)*(linwr+l-dzwr);								/* help variable to calculate the curve parameters (OUTER wall) */
      p2parawrwt=2.0*(sqrt(DIV1wrwt+((w2r+dxwr)*(w2r+dxwr)))-sqrt(DIV1wrwt));				/* help variable to calculate the curve parameters (OUTER wall) */
      w1rwt=sqrt(p2parawrwt*(linwr+p2parawrwt/4.0));							/* entrance width for right focusing parabolic wall (OUTER wall) */
      w2rwt=sqrt(p2parawrwt*(linwr+l+p2parawrwt/4.0));							/* exit width for right focusing parabolic wall (OUTER wall) */
      pbwrwt=-(linwr+p2parawrwt/4.0);									/* parameter b for parabolic equation to define the wall (OUTER wall)*/
      pawrwt=-1.0/p2parawrwt;										/* parameter a for parabolic equation to define the wall (OUTER wall)*/
    }

													/* straight right side wall */

if(linwr==0 && loutwr==0){										/* ? linear shape ? */
    w1rwt=w1r+rwallthick/(cos(atan((w1r-w2r)/l)));							/* entrance width for right focusing parabolic wall (OUTER wall) */
    w2rwt=w2r+rwallthick/(cos(atan((w1r-w2r)/l)));							/* exit width for right focusing parabolic wall (OUTER wall) */
    }


													/* Calculation of curve-parameters for the left side wall - positive x-axis - analog to right side*/

lbwl=linwl+l+loutwl;
z0wl=(linwl-l-loutwl)/2.0;

if((linwl!=0) && (loutwl!=0) ) 										/* elleptic left side wall */
  { 
    u1wl=sqrt((linwl*linwl)+(w1l*w1l));
    u2wl=sqrt((w1l*w1l)+((l+loutwl)*(l+loutwl)));
    awl=(u1wl+u2wl)/2.0;
    a2wl=awl*awl;
    bwl=sqrt(a2wl-(lbwl*lbwl/4.0));
    b2wl=bwl*bwl;
    DIV1wl=sqrt(1.0-((lbwl/2.0-loutwl)*(lbwl/2.0-loutwl)/a2wl));
    w2l=bwl*DIV1wl;
    if(l<lbwl/2-loutwl){
        dxwl=lwallthick*sin(atan(a2wl*w1l/(b2wl*z0wl)));
        dzwl=lwallthick*cos(atan(a2wl*w1l/(b2wl*z0wl)));
    	u1wlwt=sqrt(((linwl+dzwl)*(linwl+dzwl))+((w1l+dxwl)*(w1l+dxwl)));								
    	u2wlwt=sqrt(((w1l+dxwl)*(w1l+dxwl))+((l+loutwl-dzwl)*(l+loutwl-dzwl)));	
    	awlwt=(u1wlwt+u2wlwt)/2.0;
    	a2wlwt=awlwt*awlwt;
    	bwlwt=sqrt(a2wlwt-(lbwl*lbwl/4.0));
    	b2wlwt=bwlwt*bwlwt;
    	w2lwt=bwlwt*sqrt(1.0-((lbwl/2.0-loutwl)*(lbwl/2.0-loutwl)/a2wlwt));
        w1lwt=bwlwt*sqrt(1.0-((lbwl/2.0-loutwl-l)*(lbwl/2.0-loutwl-l)/a2wlwt));
    }else{
	bwlwt=bwl+lwallthick;
        b2wlwt=bwlwt*bwlwt;
        awlwt=sqrt(b2wlwt+(lbwl*lbwl/4.0));
        a2wlwt=b2wlwt+(lbwl*lbwl/4.0);
        w2lwt=bwlwt*sqrt(1.0-((lbwl/2.0-loutwl)*(lbwl/2.0-loutwl)/a2wlwt));
        w1lwt=bwlwt*sqrt(1.0-((lbwl/2.0-linwl)*(lbwl/2.0-linwl)/a2wlwt));
    }
   }


if(linwl==0 && loutwl!=0)										/* parabolic focusing left side wall */
   {
    DIV1wl=(l+loutwl)*(l+loutwl);
    p2parawl=2.0*(sqrt(DIV1wl+(w1l*w1l))-sqrt(DIV1wl));
    w2l=sqrt(p2parawl*(loutwl+p2parawl/4.0));
    pbwl=l+loutwl+p2parawl/4.0;
    pawl=1.0/p2parawl;
    dxwl=lwallthick*sin(atan(w1l*2*pawl));
    dzwl=lwallthick*cos(atan(w1l*2*pawl));
    DIV1wlwt=(l+loutwl-dzwl)*(l+loutwl-dzwl);
    p2parawlwt=2.0*(sqrt(DIV1wlwt+((w1l+dxwl)*(w1l+dxwl)))-sqrt(DIV1wlwt));
    pbwlwt=l+loutwl+p2parawlwt/4.0;
    pawlwt=1.0/p2parawlwt;
    w2lwt=sqrt(p2parawlwt*(loutwl+p2parawlwt/4.0));
    w1lwt=sqrt(p2parawlwt*(loutwl+l+p2parawlwt/4.0));
   }

if (linwl!=0 && loutwl==0)										/* parabolic defocusing left side wall */
    {
      DIV1wl=linwl*linwl;
      p2parawl=2.0*(sqrt(DIV1wl+(w1l*w1l))-sqrt(DIV1wl));
      w2l=sqrt(p2parawl*(l+linwl+p2parawl/4.0));
      pbwl=-(linwl+p2parawl/4.0);
      pawl=-1.0/p2parawl;
      dxwl=lwallthick*sin(atan(-w2l*2*pawl));
      dzwl=lwallthick*cos(atan(-w2l*2*pawl));
      DIV1wlwt=(linwl+l-dzwl)*(linwl+l-dzwl);
      p2parawlwt=2.0*(sqrt(DIV1wlwt+((w2l+dxwl)*(w2l+dxwl)))-sqrt(DIV1wlwt));
      w1lwt=sqrt(p2parawlwt*(linwl+p2parawlwt/4.0));
      w2lwt=sqrt(p2parawlwt*(linwl+l+p2parawlwt/4.0));
      pbwlwt=-(linwl+p2parawlwt/4.0);
      pawlwt=-1.0/p2parawlwt;
    }

if(linwl==0 && loutwl==0){
    w1lwt=w1l+lwallthick/(cos(atan((w2l-w1l)/l)));
    w2lwt=w2l+lwallthick/(cos(atan((w2l-w1l)/l)));
    }


													/* Calculation of curve-parameters for the top wall - positive y-axis - analog  right wall*/

lbhu=linhu+l+louthu;
z0hu=lbhu/2.0-l-louthu;	

if (linhu != 0 && louthu !=0)										/* elliptic top wall */
   {
    u1hu=sqrt((linhu*linhu)+(h1u*h1u));
    u2hu=sqrt((h1u*h1u)+((l+louthu)*(l+louthu)));
    ahu=(u1hu+u2hu)/2.0;
    bhu=sqrt(ahu*ahu-(lbhu*lbhu/4.0));
    a2hu=ahu*ahu;
    b2hu=bhu*bhu;
    DIV1hu=sqrt(1.0-((lbhu/2.0-louthu)*(lbhu/2.0-louthu)/a2hu));
    h2u=bhu*DIV1hu;
    if(l<lbhu/2-louthu){
        dyhu=uwallthick*sin(atan(a2hu*h1u/(b2hu*z0hu)));
        dzhu=uwallthick*cos(atan(a2hu*h1u/(b2hu*z0hu)));
    	u1huwt=sqrt(((linhu+dzhu)*(linhu+dzhu))+((h1u+dyhu)*(h1u+dyhu)));								
    	u2huwt=sqrt(((h1u+dyhu)*(h1u+dyhu))+((l+louthu-dzhu)*(l+louthu-dzhu)));	
    	ahuwt=(u1huwt+u2huwt)/2.0;
    	a2huwt=ahuwt*ahuwt;
    	bhuwt=sqrt(a2huwt-(lbhu*lbhu/4.0));
    	b2huwt=bhuwt*bhuwt;
    	h2uwt=bhuwt*sqrt(1.0-((lbhu/2.0-louthu)*(lbhu/2.0-louthu)/a2huwt));
        h1uwt=bhuwt*sqrt(1.0-((lbhu/2.0-louthu-l)*(lbhu/2.0-louthu-l)/a2huwt));
    }else{
	bhuwt=bhu+uwallthick;
        b2huwt=bhuwt*bhuwt;
        ahuwt=sqrt(b2huwt+(lbhu*lbhu/4.0));
        a2huwt=b2huwt+(lbhu*lbhu/4.0);
        h2uwt=bhuwt*sqrt(1.0-((lbhu/2.0-louthu)*(lbhu/2.0-louthu)/a2huwt));
        h1uwt=bhuwt*sqrt(1.0-((lbhu/2.0-linhu)*(lbhu/2.0-linhu)/a2huwt));
    }
  }

if(linhu==0 && louthu!=0)										/* parabolic focusing top wall */
   { 	
    DIV1hu=(l+louthu)*(l+louthu);
    p2parahu=2.0*(sqrt(DIV1hu+(h1u*h1u))-sqrt(DIV1hu));
    h2u=sqrt(p2parahu*(louthu+p2parahu/4.0));
    pbhu=l+louthu+p2parahu/4.0;
    pahu=1.0/p2parahu;
    dyhu=uwallthick*sin(atan(h1u*2*pahu));
    dzhu=uwallthick*cos(atan(h1u*2*pahu));
    DIV1huwt=(l+louthu-dzhu)*(l+louthu-dzhu);
    p2parahuwt=2.0*(sqrt(DIV1huwt+((h1u+dyhu)*(h1u+dyhu)))-sqrt(DIV1huwt));
    pbhuwt=l+louthu+p2parahuwt/4.0;
    pahuwt=1.0/p2parahuwt;
    h2uwt=sqrt(p2parahuwt*(louthu+p2parahuwt/4.0));
    h1uwt=sqrt(p2parahuwt*(louthu+l+p2parahuwt/4.0));
   } 

if (linhu!=0 && louthu==0)										/* parabolic defocusing top wall */
    {
      DIV1hu=linhu*linhu;
      p2parahu=2.0*(sqrt(DIV1hu+(h1u*h1u))-sqrt(DIV1hu));
      h2u=sqrt(p2parahu*(l+linhu+p2parahu/4.0));
      pbhu=-(linhu+p2parahu/4.0);
      pahu=-1.0/p2parahu;
      dyhu=uwallthick*sin(atan(-h2u*2*pahu));
      dzhu=uwallthick*cos(atan(-h2u*2*pahu));
      DIV1huwt=(linhu+l-dzhu)*(linhu+l-dzhu);
      p2parahuwt=2.0*(sqrt(DIV1huwt+((h2u+dyhu)*(h2u+dyhu)))-sqrt(DIV1huwt));
      h1uwt=sqrt(p2parahuwt*(linhu+p2parahuwt/4.0));
      h2uwt=sqrt(p2parahuwt*(linhu+l+p2parahuwt/4.0));
      pbhuwt=-(linhu+p2parahuwt/4.0);
      pahuwt=-1.0/p2parahuwt;
    }

if(linhu==0 && louthu==0){
    h1uwt=h1u+uwallthick/(cos(atan((h2u-h1u)/l)));
    h2uwt=h2u+uwallthick/(cos(atan((h2u-h1u)/l)));
    }


													/* Calculation of curve-parameters for the bottom wall - negative y-axis - analog right wall */
lbhd=linhd+l+louthd;
z0hd=lbhd/2.0-l-louthd;

if (linhd != 0 && louthd !=0)										/* elliptic bottom wall */
   {
    u1hd=sqrt((linhd*linhd)+(h1d*h1d));
    u2hd=sqrt((h1d*h1d)+((l+louthd)*(l+louthd)));
    ahd=(u1hd+u2hd)/2.0;
    bhd=sqrt(ahd*ahd-(lbhd*lbhd/4.0));
    a2hd=ahd*ahd;
    b2hd=bhd*bhd;
    DIV1hd=sqrt(1.0-((lbhd/2.0-louthd)*(lbhd/2.0-louthd)/a2hd));
    h2d=bhd*DIV1hd;
    if(l<lbhd/2-louthd){
        dyhd=dwallthick*sin(atan(a2hd*h1d/(b2hd*z0hd)));
        dzhd=dwallthick*cos(atan(a2hd*h1d/(b2hd*z0hd)));
    	u1hdwt=sqrt(((linhd+dzhd)*(linhd+dzhd))+((h1d+dyhd)*(h1d+dyhd)));	
    	u2hdwt=sqrt(((h1d+dyhd)*(h1d+dyhd))+((l+louthd-dzhd)*(l+louthd-dzhd)));
    	ahdwt=(u1hdwt+u2hdwt)/2.0;
    	a2hdwt=ahdwt*ahdwt;
    	bhdwt=sqrt(a2hdwt-(lbhd*lbhd/4.0));
    	b2hdwt=bhdwt*bhdwt;
    	h2dwt=bhdwt*sqrt(1.0-((lbhd/2.0-louthd)*(lbhd/2.0-louthd)/a2hdwt));
        h1dwt=bhdwt*sqrt(1.0-((lbhd/2.0-louthd-l)*(lbhd/2.0-louthd-l)/a2hdwt));
    }else{
	bhdwt=bhd+dwallthick;
        b2hdwt=bhdwt*bhdwt;
        ahdwt=sqrt(b2hdwt+(lbhd*lbhd/4.0));
        a2hdwt=b2hdwt+(lbhd*lbhd/4.0);
        h2dwt=bhdwt*sqrt(1.0-((lbhd/2.0-louthd)*(lbhd/2.0-louthd)/a2hdwt));
        h1dwt=bhdwt*sqrt(1.0-((lbhd/2.0-linhd)*(lbhd/2.0-linhd)/a2hdwt));
    }
  }

if(linhd==0 && louthd!=0)										/* parabolic focusing bottom wall */
   {	
    DIV1hd=(l+louthd)*(l+louthd);
    p2parahd=2.0*(sqrt(DIV1hd+(h1d*h1d))-sqrt(DIV1hd));
    h2d=sqrt(p2parahd*(louthd+p2parahd/4.0));
    pbhd=l+louthd+p2parahd/4.0;
    pahd=1.0/p2parahd;
    dyhd=dwallthick*sin(atan(h1d*2*pahd));
    dzhd=dwallthick*cos(atan(h1d*2*pahd));
    DIV1hdwt=(l+louthd-dzhd)*(l+louthd-dzhd);
    p2parahdwt=2.0*(sqrt(DIV1hdwt+((h1d+dyhd)*(h1d+dyhd)))-sqrt(DIV1hdwt));
    pbhdwt=l+louthd+p2parahdwt/4.0;
    pahdwt=1.0/p2parahdwt;
    h2dwt=sqrt(p2parahdwt*(louthd+p2parahdwt/4.0));
    h1dwt=sqrt(p2parahdwt*(louthd+l+p2parahdwt/4.0));
   }

if (linhd!=0 && louthd==0)										/* parabolic defocusing bottom wall */
    {
      DIV1hd=linhd*linhd;
      p2parahd=2.0*(sqrt(DIV1hd+(h1d*h1d))-sqrt(DIV1hd));
      h2d=sqrt(p2parahd*(l+linhd+p2parahd/4.0));
      pbhd=-(linhd+p2parahd/4.0);
      pahd=-1.0/p2parahd;
      dyhd=dwallthick*sin(atan(-h2d*2*pahd));
      dzhd=dwallthick*cos(atan(-h2d*2*pahd));
      DIV1hdwt=(linhd+l-dzhd)*(linhd+l-dzhd);
      p2parahdwt=2.0*(sqrt(DIV1hdwt+((h2d+dyhd)*(h2d+dyhd)))-sqrt(DIV1hdwt));
      h1dwt=sqrt(p2parahdwt*(linhd+p2parahdwt/4.0));
      h2dwt=sqrt(p2parahdwt*(linhd+l+p2parahdwt/4.0));
      pbhdwt=-(linhd+p2parahdwt/4.0);
      pahdwt=-1.0/p2parahdwt;
    }

if(linhd==0 && louthd==0){
    h1dwt=h1d+dwallthick/(cos(atan((h2d-h1d)/l)));
    h2dwt=h2d+dwallthick/(cos(atan((h2d-h1d)/l)));
    }



mru1=(h1uwt-h1u)/(w1r-w1rwt);										/* calculation for entrance and exit absorbing mask for the right upper corner*/
nru1=h1u-mru1*(-w1r);
mru2=(h2uwt-h2u)/(w2r-w2rwt);
nru2=h2u-mru2*(-w2r);

mrd1=(-h1dwt+h1d)/(w1r-w1rwt);										/* calculation for entrance and exit absorbing mask for the right lower corner*/
nrd1=-h1d-mrd1*(-w1r);
mrd2=(-h2dwt+h2d)/(w2r-w2rwt);
nrd2=-h2d-mrd2*(-w2r);

mlu1=(h1uwt-h1u)/(-w1l+w1lwt);										/* calculation for entrance and exit absorbing mask for the left upper corner*/
nlu1=h1u-mlu1*w1l;
mlu2=(h2uwt-h2u)/(-w2l+w2lwt);
nlu2=h2u-mlu2*w2l;

mld1=(-h1dwt+h1d)/(-w1l+w1lwt);										/* calculation for entrance and exit absorbing mask for the left lower corner*/
nld1=-h1d-mld1*w1l;
mld2=(-h2dwt+h2d)/(-w2l+w2lwt);
nld2=-h2d-mld2*w2l;

                                       /*          FIRST SHELL      */

lbwr1=linwr1+l+loutwr1;
z0wr1=(linwr1-l-loutwr1)/2.0;

if(loutwr1!=0 && linwr1!=0)
  { 
    u1wr1=sqrt((linwr1*linwr1)+(w1r1*w1r1));
    u2wr1=sqrt((w1r1*w1r1)+((l+loutwr1)*(l+loutwr1)));
    awr1=(u1wr1+u2wr1)/2.0;
    a2wr1=awr1*awr1;
    bwr1=sqrt(a2wr1-(lbwr1*lbwr1/4.0));
    b2wr1=bwr1*bwr1;
    DIV1wr1=sqrt(1.0-((lbwr1/2.0-loutwr1)*(lbwr1/2.0-loutwr1)/a2wr1));
    w2r1=bwr1*DIV1wr1;
    if(l<lbwr1/2-loutwr1){
        dxwr1=rwallthick1*sin(atan(a2wr1*w1r1/(b2wr1*z0wr1)));
        dzwr1=rwallthick1*cos(atan(a2wr1*w1r1/(b2wr1*z0wr1)));
    	u1wrwt1=sqrt(((linwr1+dzwr1)*(linwr1+dzwr1))+((w1r1+dxwr1)*(w1r1+dxwr1)));
    	u2wrwt1=sqrt(((w1r1+dxwr1)*(w1r1+dxwr1))+((l+loutwr1-dzwr1)*(l+loutwr1-dzwr1)));
    	awrwt1=(u1wrwt1+u2wrwt1)/2.0;
    	a2wrwt1=awrwt1*awrwt1;
    	bwrwt1=sqrt(a2wrwt1-(lbwr1*lbwr1/4.0));
    	b2wrwt1=bwrwt1*bwrwt1;
    	w2rwt1=bwrwt1*sqrt(1.0-((lbwr1/2.0-loutwr1)*(lbwr1/2.0-loutwr1)/a2wrwt1));
        w1rwt1=bwrwt1*sqrt(1.0-((lbwr1/2.0-loutwr1-l)*(lbwr1/2.0-loutwr1-l)/a2wrwt1));
    }else{
	bwrwt1=bwr1+rwallthick1;
        b2wrwt1=bwrwt1*bwrwt1;
        awrwt1=sqrt(b2wrwt1+(lbwr1*lbwr1/4.0));
        a2wrwt1=b2wrwt1+(lbwr1*lbwr1/4.0);
        w2rwt1=bwrwt1*sqrt(1.0-((lbwr1/2.0-loutwr1)*(lbwr1/2.0-loutwr1)/a2wrwt1));
        w1rwt1=bwrwt1*sqrt(1.0-((lbwr1/2.0-linwr1)*(lbwr1/2.0-linwr1)/a2wrwt1));
    }
   }



if(linwr1==0 && loutwr1!=0){
    DIV1wr1=(l+loutwr1)*(l+loutwr1);
    p2parawr1=2.0*(sqrt(DIV1wr1+(w1r1*w1r1))-sqrt(DIV1wr1));
    w2r1=sqrt(p2parawr1*(loutwr1+p2parawr1/4.0));
    pbwr1=l+loutwr1+p2parawr1/4.0;
    pawr1=1.0/p2parawr1;
    dxwr1=rwallthick1*sin(atan(w1r1*2*pawr1));
    dzwr1=rwallthick1*cos(atan(w1r1*2*pawr1));
    DIV1wrwt1=(l+loutwr1-dzwr1)*(l+loutwl1-dzwr1);
    p2parawrwt1=2.0*(sqrt(DIV1wrwt1+((w1r1+dxwr1)*(w1r1+dxwr1)))-sqrt(DIV1wrwt1));
    pbwrwt1=l+loutwr1+p2parawrwt1/4.0;
    pawrwt1=1.0/p2parawrwt1;
    w2rwt1=sqrt(p2parawrwt1*(loutwr1+p2parawrwt1/4.0));
    w1rwt1=sqrt(p2parawrwt1*(loutwr1+l+p2parawrwt1/4.0));
   }



if (linwr1!=0 && loutwr1==0)
    {
      DIV1wr1=linwr1*linwr1;
      p2parawr1=2.0*(sqrt(DIV1wr1+(w1r1*w1r1))-sqrt(DIV1wr1));
      w2r1=sqrt(p2parawr1*(l+linwr1+p2parawr1/4.0));
      pbwr1=-(linwr1+p2parawr1/4.0);
      pawr1=-1.0/p2parawr1;
      dxwr1=rwallthick1*sin(atan(-w2r1*2*pawr1));
      dzwr1=rwallthick1*cos(atan(-w2r1*2*pawr1));
      DIV1wrwt1=(linwr1+l-dzwr1)*(linwr1+l-dzwr1);
      p2parawrwt1=2.0*(sqrt(DIV1wrwt1+((w2r1+dxwr1)*(w2r1+dxwr1)))-sqrt(DIV1wrwt1));
      w1rwt1=sqrt(p2parawrwt1*(linwr1+p2parawrwt1/4.0));
      w2rwt1=sqrt(p2parawrwt1*(linwr1+l+p2parawrwt1/4.0));
      pbwrwt1=-(linwr1+p2parawrwt1/4.0);
      pawrwt1=-1.0/p2parawrwt1;
    }


if(linwr1==0 && loutwr1==0){
    w1rwt1=w1r1+rwallthick1/(cos(atan((w1r1-w2r1)/l)));
    w2rwt1=w2r1+rwallthick1/(cos(atan((w1r1-w2r1)/l)));
    }

lbwl1=linwl1+l+loutwl1;
z0wl1=(linwl1-l-loutwl1)/2.0;

if((linwl1!=0) && (loutwl1!=0) ) 
  { 
    u1wl1=sqrt((linwl1*linwl1)+(w1l1*w1l1));
    u2wl1=sqrt((w1l1*w1l1)+((l+loutwl1)*(l+loutwl1)));
    awl1=(u1wl1+u2wl1)/2.0;
    a2wl1=awl1*awl1;
    bwl1=sqrt(a2wl1-(lbwl1*lbwl1/4.0));
    b2wl1=bwl1*bwl1;
    DIV1wl1=sqrt(1.0-((lbwl1/2.0-loutwl1)*(lbwl1/2.0-loutwl1)/a2wl1));
    w2l1=bwl1*DIV1wl1;
    if(l<lbwl1/2-loutwl1){
        dxwl1=lwallthick1*sin(atan(a2wl1*w1l1/(b2wl1*z0wl1)));
        dzwl1=lwallthick1*cos(atan(a2wl1*w1l1/(b2wl1*z0wl1)));
    	u1wlwt1=sqrt(((linwl1+dzwl1)*(linwl1+dzwl1))+((w1l1+dxwl1)*(w1l1+dxwl1)));								
    	u2wlwt1=sqrt(((w1l1+dxwl1)*(w1l1+dxwl1))+((l+loutwl1-dzwl1)*(l+loutwl1-dzwl1)));	
    	awlwt1=(u1wlwt1+u2wlwt1)/2.0;
    	a2wlwt1=awlwt1*awlwt1;
    	bwlwt1=sqrt(a2wlwt1-(lbwl1*lbwl1/4.0));
    	b2wlwt1=bwlwt1*bwlwt1;
    	w2lwt1=bwlwt1*sqrt(1.0-((lbwl1/2.0-loutwl1)*(lbwl1/2.0-loutwl1)/a2wlwt1));
        w1lwt1=bwlwt1*sqrt(1.0-((lbwl1/2.0-loutwl1-l)*(lbwl1/2.0-loutwl1-l)/a2wlwt1));
    }else{
	bwlwt1=bwl1+lwallthick1;
        b2wlwt1=bwlwt1*bwlwt1;
        awlwt1=sqrt(b2wlwt1+(lbwl1*lbwl1/4.0));
        a2wlwt1=b2wlwt1+(lbwl1*lbwl1/4.0);
        w2lwt1=bwlwt1*sqrt(1.0-((lbwl1/2.0-loutwl1)*(lbwl1/2.0-loutwl1)/a2wlwt1));
        w1lwt1=bwlwt1*sqrt(1.0-((lbwl1/2.0-linwl1)*(lbwl1/2.0-linwl1)/a2wlwt1));
    }
   }


if(linwl1==0 && loutwl1!=0)
   {
    DIV1wl1=(l+loutwl1)*(l+loutwl1);
    p2parawl1=2.0*(sqrt(DIV1wl1+(w1l1*w1l1))-sqrt(DIV1wl1));
    w2l1=sqrt(p2parawl1*(loutwl1+p2parawl1/4.0));
    pbwl1=l+loutwl1+p2parawl1/4.0;
    pawl1=1.0/p2parawl1;
    dxwl1=lwallthick1*sin(atan(w1l1*2*pawl1));
    dzwl1=lwallthick1*cos(atan(w1l1*2*pawl1));
    DIV1wlwt1=(l+loutwl1-dzwl1)*(l+loutwl1-dzwl1);
    p2parawlwt1=2.0*(sqrt(DIV1wlwt1+((w1l1+dxwl1)*(w1l1+dxwl1)))-sqrt(DIV1wlwt1));
    pbwlwt1=l+loutwl1+p2parawlwt1/4.0;
    pawlwt1=1.0/p2parawlwt1;
    w2lwt1=sqrt(p2parawlwt1*(loutwl1+p2parawlwt1/4.0));
    w1lwt1=sqrt(p2parawlwt1*(loutwl1+l+p2parawlwt1/4.0));
   }

if (linwl1!=0 && loutwl1==0)
    {
      DIV1wl1=linwl1*linwl1;
      p2parawl1=2.0*(sqrt(DIV1wl1+(w1l1*w1l1))-sqrt(DIV1wl1));
      w2l1=sqrt(p2parawl1*(l+linwl1+p2parawl1/4.0));
      pbwl1=-(linwl1+p2parawl1/4.0);
      pawl1=-1.0/p2parawl1;
      dxwl1=lwallthick1*sin(atan(-w2l1*2*pawl1));
      dzwl1=lwallthick1*cos(atan(-w2l1*2*pawl1));
      DIV1wlwt1=(linwl1+l-dzwl1)*(linwl1+l-dzwl1);
      p2parawlwt1=2.0*(sqrt(DIV1wlwt1+((w2l1+dxwl1)*(w2l1+dxwl1)))-sqrt(DIV1wlwt1));
      w1lwt1=sqrt(p2parawlwt1*(linwl1+p2parawlwt1/4.0));
      w2lwt1=sqrt(p2parawlwt1*(linwl1+l+p2parawlwt1/4.0));
      pbwlwt1=-(linwl1+p2parawlwt1/4.0);
      pawlwt1=-1.0/p2parawlwt1;
    }

if(linwl1==0 && loutwl1==0){
    w1lwt1=w1l1+lwallthick1/(cos(atan((w2l1-w1l1)/l)));
    w2lwt1=w2l1+lwallthick1/(cos(atan((w2l1-w1l1)/l)));
    }


lbhu1=linhu1+l+louthu1;
z0hu1=lbhu1/2.0-l-louthu1;	

if (linhu1 != 0 && louthu1 !=0)
   {
    u1hu1=sqrt((linhu1*linhu1)+(h1u1*h1u1));
    u2hu1=sqrt((h1u1*h1u1)+((l+louthu1)*(l+louthu1)));
    ahu1=(u1hu1+u2hu1)/2.0;
    bhu1=sqrt(ahu1*ahu1-(lbhu1*lbhu1/4.0));
    a2hu1=ahu1*ahu1;
    b2hu1=bhu1*bhu1;
    DIV1hu1=sqrt(1.0-((lbhu1/2.0-louthu1)*(lbhu1/2.0-louthu1)/a2hu1));
    h2u1=bhu1*DIV1hu1;
    if(l<lbhu1/2-louthu1){
        dyhu1=uwallthick1*sin(atan(a2hu1*h1u1/(b2hu1*z0hu1)));
        dzhu1=uwallthick1*cos(atan(a2hu1*h1u1/(b2hu1*z0hu1)));
    	u1huwt1=sqrt(((linhu1+dzhu1)*(linhu1+dzhu1))+((h1u1+dyhu1)*(h1u1+dyhu1)));								
    	u2huwt1=sqrt(((h1u1+dyhu1)*(h1u1+dyhu1))+((l+louthu1-dzhu1)*(l+louthu1-dzhu1)));	
    	ahuwt1=(u1huwt1+u2huwt1)/2.0;
    	a2huwt1=ahuwt1*ahuwt1;
    	bhuwt1=sqrt(a2huwt1-(lbhu1*lbhu1/4.0));
    	b2huwt1=bhuwt1*bhuwt1;
    	h2uwt1=bhuwt1*sqrt(1.0-((lbhu1/2.0-louthu1)*(lbhu1/2.0-louthu1)/a2huwt1));
        h1uwt1=bhuwt1*sqrt(1.0-((lbhu1/2.0-louthu1-l)*(lbhu1/2.0-louthu1-l)/a2huwt1));
    }else{
	bhuwt1=bhu1+uwallthick1;
        b2huwt1=bhuwt1*bhuwt1;
        ahuwt1=sqrt(b2huwt1+(lbhu1*lbhu1/4.0));
        a2huwt1=b2huwt1+(lbhu1*lbhu1/4.0);
        h2uwt1=bhuwt1*sqrt(1.0-((lbhu1/2.0-louthu1)*(lbhu1/2.0-louthu1)/a2huwt1));
        h1uwt1=bhuwt1*sqrt(1.0-((lbhu1/2.0-linhu1)*(lbhu1/2.0-linhu1)/a2huwt1));
    }
  }

if(linhu1==0 && louthu1!=0)
   { 	
    DIV1hu1=(l+louthu1)*(l+louthu1);
    p2parahu1=2.0*(sqrt(DIV1hu1+(h1u1*h1u1))-sqrt(DIV1hu1));
    h2u1=sqrt(p2parahu1*(louthu1+p2parahu1/4.0));
    pbhu1=l+louthu1+p2parahu1/4.0;
    pahu1=1.0/p2parahu1;
    dyhu1=uwallthick1*sin(atan(h1u1*2*pahu1));
    dzhu1=uwallthick1*cos(atan(h1u1*2*pahu1));
    DIV1huwt1=(l+louthu1-dzhu1)*(l+louthu1-dzhu1);
    p2parahuwt1=2.0*(sqrt(DIV1huwt1+((h1u1+dyhu1)*(h1u1+dyhu1)))-sqrt(DIV1huwt1));
    pbhuwt1=l+louthu1+p2parahuwt1/4.0;
    pahuwt1=1.0/p2parahuwt1;
    h2uwt1=sqrt(p2parahuwt1*(louthu1+p2parahuwt1/4.0));
    h1uwt1=sqrt(p2parahuwt1*(louthu1+l+p2parahuwt1/4.0));
   } 

if (linhu1!=0 && louthu1==0)
    {
      DIV1hu1=linhu1*linhu1;
      p2parahu1=2.0*(sqrt(DIV1hu1+(h1u1*h1u1))-sqrt(DIV1hu1));
      h2u1=sqrt(p2parahu1*(l+linhu1+p2parahu1/4.0));
      pbhu1=-(linhu1+p2parahu1/4.0);
      pahu1=-1.0/p2parahu1;
      dyhu1=uwallthick1*sin(atan(-h2u1*2*pahu1));
      dzhu1=uwallthick1*cos(atan(-h2u1*2*pahu1));
      DIV1huwt1=(linhu1+l-dzhu1)*(linhu1+l-dzhu1);
      p2parahuwt1=2.0*(sqrt(DIV1huwt1+((h2u1+dyhu1)*(h2u1+dyhu1)))-sqrt(DIV1huwt1));
      h1uwt1=sqrt(p2parahuwt1*(linhu1+p2parahuwt1/4.0));
      h2uwt1=sqrt(p2parahuwt1*(linhu1+l+p2parahuwt1/4.0));
      pbhuwt1=-(linhu1+p2parahuwt1/4.0);
      pahuwt1=-1.0/p2parahuwt1;
    }

if(linhu1==0 && louthu1==0){
    h1uwt1=h1u1+uwallthick1/(cos(atan((h2u1-h1u1)/l)));
    h2uwt1=h2u1+uwallthick1/(cos(atan((h2u1-h1u1)/l)));
    }


lbhd1=linhd1+l+louthd1;
z0hd1=lbhd1/2.0-l-louthd1;

if (linhd1 != 0 && louthd1 !=0)
   {
    u1hd1=sqrt((linhd1*linhd1)+(h1d1*h1d1));
    u2hd1=sqrt((h1d1*h1d1)+((l+louthd1)*(l+louthd1)));
    ahd1=(u1hd1+u2hd1)/2.0;
    bhd1=sqrt(ahd1*ahd1-(lbhd1*lbhd1/4.0));
    a2hd1=ahd1*ahd1;
    b2hd1=bhd1*bhd1;
    DIV1hd1=sqrt(1.0-((lbhd1/2.0-louthd1)*(lbhd1/2.0-louthd1)/a2hd1));
    h2d1=bhd1*DIV1hd1;
    if(l<lbhd/21-louthd1){
        dyhd1=dwallthick1*sin(atan(a2hd1*h1d1/(b2hd1*z0hd1)));
        dzhd1=dwallthick1*cos(atan(a2hd1*h1d1/(b2hd1*z0hd1)));
    	u1hdwt1=sqrt(((linhd1+dzhd1)*(linhd1+dzhd1))+((h1d1+dyhd1)*(h1d1+dyhd1)));	
    	u2hdwt1=sqrt(((h1d1+dyhd1)*(h1d1+dyhd1))+((l+louthd1-dzhd1)*(l+louthd1-dzhd1)));
    	ahdwt1=(u1hdwt1+u2hdwt1)/2.0;
    	a2hdwt1=ahdwt1*ahdwt1;
    	bhdwt1=sqrt(a2hdwt1-(lbhd1*lbhd1/4.0));
    	b2hdwt1=bhdwt1*bhdwt1;
    	h2dwt1=bhdwt1*sqrt(1.0-((lbhd1/2.0-louthd1)*(lbhd1/2.0-louthd1)/a2hdwt1));
        h1dwt1=bhdwt1*sqrt(1.0-((lbhd1/2.0-louthd1-l)*(lbhd1/2.0-louthd1-l)/a2hdwt1));
    }else{
	bhdwt1=bhd1+dwallthick1;
        b2hdwt1=bhdwt1*bhdwt1;
        ahdwt1=sqrt(b2hdwt1+(lbhd1*lbhd1/4.0));
        a2hdwt1=b2hdwt1+(lbhd1*lbhd1/4.0);
        h2dwt1=bhdwt1*sqrt(1.0-((lbhd1/2.0-louthd1)*(lbhd1/2.0-louthd1)/a2hdwt1));
        h1dwt1=bhdwt1*sqrt(1.0-((lbhd1/2.0-linhd1)*(lbhd1/2.0-linhd1)/a2hdwt1));
    }
  }

if(linhd1==0 && louthd1!=0)
   {	
    DIV1hd1=(l+louthd1)*(l+louthd1);
    p2parahd1=2.0*(sqrt(DIV1hd1+(h1d1*h1d1))-sqrt(DIV1hd1));
    h2d1=sqrt(p2parahd1*(louthd1+p2parahd1/4.0));
    pbhd1=l+louthd1+p2parahd1/4.0;
    pahd1=1.0/p2parahd1;
    dyhd1=dwallthick1*sin(atan(h1d1*2*pahd1));
    dzhd1=dwallthick1*cos(atan(h1d1*2*pahd1));
    DIV1hdwt1=(l+louthd1-dzhd1)*(l+louthd1-dzhd1);
    p2parahdwt1=2.0*(sqrt(DIV1hdwt1+((h1d1+dyhd1)*(h1d1+dyhd1)))-sqrt(DIV1hdwt1));
    pbhdwt1=l+louthd1+p2parahdwt1/4.0;
    pahdwt1=1.0/p2parahdwt1;
    h2dwt1=sqrt(p2parahdwt1*(louthd1+p2parahdwt1/4.0));
    h1dwt1=sqrt(p2parahdwt1*(louthd1+l+p2parahdwt1/4.0));
   }

if (linhd1!=0 && louthd1==0)
    {
      DIV1hd1=linhd1*linhd1;
      p2parahd1=2.0*(sqrt(DIV1hd1+(h1d1*h1d1))-sqrt(DIV1hd1));
      h2d1=sqrt(p2parahd1*(l+linhd1+p2parahd1/4.0));
      pbhd1=-(linhd1+p2parahd1/4.0);
      pahd1=-1.0/p2parahd1;
      dyhd1=dwallthick1*sin(atan(-h2d1*2*pahd1));
      dzhd1=dwallthick1*cos(atan(-h2d1*2*pahd1));
      DIV1hdwt1=(linhd1+l-dzhd1)*(linhd1+l-dzhd1);
      p2parahdwt1=2.0*(sqrt(DIV1hdwt1+((h2d1+dyhd1)*(h2d1+dyhd1)))-sqrt(DIV1hdwt1));
      h1dwt1=sqrt(p2parahdwt1*(linhd1+p2parahdwt1/4.0));
      h2dwt1=sqrt(p2parahdwt1*(linhd1+l+p2parahdwt1/4.0));
      pbhdwt1=-(linhd1+p2parahdwt1/4.0);
      pahdwt1=-1.0/p2parahdwt1;
    }

if(linhd1==0 && louthd1==0){
    h1dwt1=h1d1+dwallthick1/(cos(atan((h2d1-h1d1)/l)));
    h2dwt1=h2d1+dwallthick1/(cos(atan((h2d1-h1d1)/l)));
    }



mru11=(h1uwt1-h1u1)/(w1r1-w1rwt1);
nru11=h1u1-mru11*(-w1r1);
mru21=(h2uwt1-h2u1)/(w2r1-w2rwt1);
nru21=h2u1-mru21*(-w2r1);

mrd11=(-h1dwt1+h1d1)/(w1r1-w1rwt1);
nrd11=-h1d1-mrd11*(-w1r1);
mrd21=(-h2dwt1+h2d1)/(w2r1-w2rwt1);
nrd21=-h2d1-mrd21*(-w2r1);

mlu11=(h1uwt1-h1u1)/(-w1l1+w1lwt1);
nlu11=h1u1-mlu11*w1l1;
mlu21=(h2uwt1-h2u1)/(-w2l1+w2lwt1);
nlu21=h2u1-mlu21*w2l1;

mld11=(-h1dwt1+h1d1)/(-w1l1+w1lwt1);
nld11=-h1d1-mld11*w1l1;
mld21=(-h2dwt1+h2d1)/(-w2l1+w2lwt1);
nld21=-h2d1-mld21*w2l1;



if (w1r1 < w1rwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r1 have to be bigger or equal w1rwt  \n");
    printf(" w1r1= %f \n",w1r1 );
    printf(" w1rwt = %f \n",w1rwt  );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l1 < w1lwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l1 have to be bigger or equal w1lwt  \n");
    printf(" w1l1= %f \n",w1l1 );
    printf(" w1lwt = %f \n",w1lwt  );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u1 < h1uwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u1 have to be bigger or equal h1uwt  \n");
    printf(" h1u1= %f \n",h1u1 );
    printf(" h1uwt = %f \n",h1uwt  );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d1 < h1dwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d1 have to be bigger or equal h1dwt  \n");
    printf(" h1d1= %f \n",h1d1 );
    printf(" h1dwt = %f \n",h1dwt  );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r1 < w2rwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r1 have to be bigger or equal w2rwt  \n");
    printf(" w2r1= %f \n",w2r1 );
    printf(" w2rwt = %f \n",w2rwt  );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l1 < w2lwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l1 have to be bigger or equal w2lwt  \n");
    printf(" w2l1= %f \n",w2l1 );
    printf(" w2lwt = %f \n",w2lwt  );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u1 < h2uwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u1 have to be bigger or equal h2uwt  \n");
    printf(" h2u1= %f \n",h2u1 );
    printf(" h2uwt = %f \n",h2uwt  );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d1 < h2dwt )
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d1 have to be bigger or equal h2dwt  \n");
    printf(" h2d1= %f \n",h2d1 );
    printf(" h2dwt = %f \n",h2dwt  );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

lbwr2=linwr2+l+loutwr2;
z0wr2=(linwr2-l-loutwr2)/2.0;

if(loutwr2!=0 && linwr2!=0)
  { 
    u1wr2=sqrt((linwr2*linwr2)+(w1r2*w1r2));
    u2wr2=sqrt((w1r2*w1r2)+((l+loutwr2)*(l+loutwr2)));
    awr2=(u1wr2+u2wr2)/2.0;
    a2wr2=awr2*awr2;
    bwr2=sqrt(a2wr2-(lbwr2*lbwr2/4.0));
    b2wr2=bwr2*bwr2;
    DIV1wr2=sqrt(1.0-((lbwr2/2.0-loutwr2)*(lbwr2/2.0-loutwr2)/a2wr2));
    w2r2=bwr2*DIV1wr2;
    if(l<lbwr2/2-loutwr2){
        dxwr2=rwallthick2*sin(atan(a2wr2*w1r2/(b2wr2*z0wr2)));
        dzwr2=rwallthick2*cos(atan(a2wr2*w1r2/(b2wr2*z0wr2)));
    	u1wrwt2=sqrt(((linwr2+dzwr2)*(linwr2+dzwr2))+((w1r2+dxwr2)*(w1r2+dxwr2)));
    	u2wrwt2=sqrt(((w1r2+dxwr2)*(w1r2+dxwr2))+((l+loutwr2-dzwr2)*(l+loutwr2-dzwr2)));
    	awrwt2=(u1wrwt2+u2wrwt2)/2.0;
    	a2wrwt2=awrwt2*awrwt2;
    	bwrwt2=sqrt(a2wrwt2-(lbwr2*lbwr2/4.0));
    	b2wrwt2=bwrwt2*bwrwt2;
    	w2rwt2=bwrwt2*sqrt(1.0-((lbwr2/2.0-loutwr2)*(lbwr2/2.0-loutwr2)/a2wrwt2));
        w1rwt2=bwrwt2*sqrt(1.0-((lbwr2/2.0-loutwr2-l)*(lbwr2/2.0-loutwr2-l)/a2wrwt2));
    }else{
	bwrwt2=bwr2+rwallthick2;
        b2wrwt2=bwrwt2*bwrwt2;
        awrwt2=sqrt(b2wrwt2+(lbwr2*lbwr2/4.0));
        a2wrwt2=b2wrwt2+(lbwr2*lbwr2/4.0);
        w2rwt2=bwrwt2*sqrt(1.0-((lbwr2/2.0-loutwr2)*(lbwr2/2.0-loutwr2)/a2wrwt2));
        w1rwt2=bwrwt2*sqrt(1.0-((lbwr2/2.0-linwr2)*(lbwr2/2.0-linwr2)/a2wrwt2));
    }
   }



if(linwr2==0 && loutwr2!=0){
    DIV1wr2=(l+loutwr2)*(l+loutwr2);
    p2parawr2=2.0*(sqrt(DIV1wr2+(w1r2*w1r2))-sqrt(DIV1wr2));
    w2r2=sqrt(p2parawr2*(loutwr2+p2parawr2/4.0));
    pbwr2=l+loutwr2+p2parawr2/4.0;
    pawr2=1.0/p2parawr2;
    dxwr2=rwallthick2*sin(atan(w1r2*2*pawr2));
    dzwr2=rwallthick2*cos(atan(w1r2*2*pawr2));
    DIV1wrwt2=(l+loutwr2-dzwr2)*(l+loutwl2-dzwr2);
    p2parawrwt2=2.0*(sqrt(DIV1wrwt2+((w1r2+dxwr2)*(w1r2+dxwr2)))-sqrt(DIV1wrwt2));
    pbwrwt2=l+loutwr2+p2parawrwt2/4.0;
    pawrwt2=1.0/p2parawrwt2;
    w2rwt2=sqrt(p2parawrwt2*(loutwr2+p2parawrwt2/4.0));
    w1rwt2=sqrt(p2parawrwt2*(loutwr2+l+p2parawrwt2/4.0));
   }



if (linwr2!=0 && loutwr2==0)
    {
      DIV1wr2=linwr2*linwr2;
      p2parawr2=2.0*(sqrt(DIV1wr2+(w1r2*w1r2))-sqrt(DIV1wr2));
      w2r2=sqrt(p2parawr2*(l+linwr2+p2parawr2/4.0));
      pbwr2=-(linwr2+p2parawr2/4.0);
      pawr2=-1.0/p2parawr2;
      dxwr2=rwallthick2*sin(atan(-w2r2*2*pawr2));
      dzwr2=rwallthick2*cos(atan(-w2r2*2*pawr2));
      DIV1wrwt2=(linwr2+l-dzwr2)*(linwr2+l-dzwr2);
      p2parawrwt2=2.0*(sqrt(DIV1wrwt2+((w2r2+dxwr2)*(w2r2+dxwr2)))-sqrt(DIV1wrwt2));
      w1rwt2=sqrt(p2parawrwt2*(linwr2+p2parawrwt2/4.0));
      w2rwt2=sqrt(p2parawrwt2*(linwr2+l+p2parawrwt2/4.0));
      pbwrwt2=-(linwr2+p2parawrwt2/4.0);
      pawrwt2=-1.0/p2parawrwt2;
    }


if(linwr2==0 && loutwr2==0){
    w1rwt2=w1r2+rwallthick2/(cos(atan((w1r2-w2r2)/l)));
    w2rwt2=w2r2+rwallthick2/(cos(atan((w1r2-w2r2)/l)));
    }

lbwl2=linwl2+l+loutwl2;
z0wl2=(linwl2-l-loutwl2)/2.0;

if((linwl2!=0) && (loutwl2!=0) ) 
  { 
    u1wl2=sqrt((linwl2*linwl2)+(w1l2*w1l2));
    u2wl2=sqrt((w1l2*w1l2)+((l+loutwl2)*(l+loutwl2)));
    awl2=(u1wl2+u2wl2)/2.0;
    a2wl2=awl2*awl2;
    bwl2=sqrt(a2wl2-(lbwl2*lbwl2/4.0));
    b2wl2=bwl2*bwl2;
    DIV1wl2=sqrt(1.0-((lbwl2/2.0-loutwl2)*(lbwl2/2.0-loutwl2)/a2wl2));
    w2l2=bwl2*DIV1wl2;
    if(l<lbwl2/2-loutwl2){
        dxwl2=lwallthick2*sin(atan(a2wl2*w1l2/(b2wl2*z0wl2)));
        dzwl2=lwallthick2*cos(atan(a2wl2*w1l2/(b2wl2*z0wl2)));
    	u1wlwt2=sqrt(((linwl2+dzwl2)*(linwl2+dzwl2))+((w1l2+dxwl2)*(w1l2+dxwl2)));								
    	u2wlwt2=sqrt(((w1l2+dxwl2)*(w1l2+dxwl2))+((l+loutwl2-dzwl2)*(l+loutwl2-dzwl2)));	
    	awlwt2=(u1wlwt2+u2wlwt2)/2.0;
    	a2wlwt2=awlwt2*awlwt2;
    	bwlwt2=sqrt(a2wlwt2-(lbwl2*lbwl2/4.0));
    	b2wlwt2=bwlwt2*bwlwt2;
    	w2lwt2=bwlwt2*sqrt(1.0-((lbwl2/2.0-loutwl2)*(lbwl2/2.0-loutwl2)/a2wlwt2));
        w1lwt2=bwlwt2*sqrt(1.0-((lbwl2/2.0-loutwl2-l)*(lbwl2/2.0-loutwl2-l)/a2wlwt2));
    }else{
	bwlwt2=bwl2+lwallthick2;
        b2wlwt2=bwlwt2*bwlwt2;
        awlwt2=sqrt(b2wlwt2+(lbwl2*lbwl2/4.0));
        a2wlwt2=b2wlwt2+(lbwl2*lbwl2/4.0);
        w2lwt2=bwlwt2*sqrt(1.0-((lbwl2/2.0-loutwl2)*(lbwl2/2.0-loutwl2)/a2wlwt2));
        w1lwt2=bwlwt2*sqrt(1.0-((lbwl2/2.0-linwl2)*(lbwl2/2.0-linwl2)/a2wlwt2));
    }
   }


if(linwl2==0 && loutwl2!=0)
   {
    DIV1wl2=(l+loutwl2)*(l+loutwl2);
    p2parawl2=2.0*(sqrt(DIV1wl2+(w1l2*w1l2))-sqrt(DIV1wl2));
    w2l2=sqrt(p2parawl2*(loutwl2+p2parawl2/4.0));
    pbwl2=l+loutwl2+p2parawl2/4.0;
    pawl2=1.0/p2parawl2;
    dxwl2=lwallthick2*sin(atan(w1l2*2*pawl2));
    dzwl2=lwallthick2*cos(atan(w1l2*2*pawl2));
    DIV1wlwt2=(l+loutwl2-dzwl2)*(l+loutwl2-dzwl2);
    p2parawlwt2=2.0*(sqrt(DIV1wlwt2+((w1l2+dxwl2)*(w1l2+dxwl2)))-sqrt(DIV1wlwt2));
    pbwlwt2=l+loutwl2+p2parawlwt2/4.0;
    pawlwt2=1.0/p2parawlwt2;
    w2lwt2=sqrt(p2parawlwt2*(loutwl2+p2parawlwt2/4.0));
    w1lwt2=sqrt(p2parawlwt2*(loutwl2+l+p2parawlwt2/4.0));
   }

if (linwl2!=0 && loutwl2==0)
    {
      DIV1wl2=linwl2*linwl2;
      p2parawl2=2.0*(sqrt(DIV1wl2+(w1l2*w1l2))-sqrt(DIV1wl2));
      w2l2=sqrt(p2parawl2*(l+linwl2+p2parawl2/4.0));
      pbwl2=-(linwl2+p2parawl2/4.0);
      pawl2=-1.0/p2parawl2;
      dxwl2=lwallthick2*sin(atan(-w2l2*2*pawl2));
      dzwl2=lwallthick2*cos(atan(-w2l2*2*pawl2));
      DIV1wlwt2=(linwl2+l-dzwl2)*(linwl2+l-dzwl2);
      p2parawlwt2=2.0*(sqrt(DIV1wlwt2+((w2l2+dxwl2)*(w2l2+dxwl2)))-sqrt(DIV1wlwt2));
      w1lwt2=sqrt(p2parawlwt2*(linwl2+p2parawlwt2/4.0));
      w2lwt2=sqrt(p2parawlwt2*(linwl2+l+p2parawlwt2/4.0));
      pbwlwt2=-(linwl2+p2parawlwt2/4.0);
      pawlwt2=-1.0/p2parawlwt2;
    }

if(linwl2==0 && loutwl2==0){
    w1lwt2=w1l2+lwallthick2/(cos(atan((w2l2-w1l2)/l)));
    w2lwt2=w2l2+lwallthick2/(cos(atan((w2l2-w1l2)/l)));
    }


lbhu2=linhu2+l+louthu2;
z0hu2=lbhu2/2.0-l-louthu2;	

if (linhu2 != 0 && louthu2 !=0)
   {
    u1hu2=sqrt((linhu2*linhu2)+(h1u2*h1u2));
    u2hu2=sqrt((h1u2*h1u2)+((l+louthu2)*(l+louthu2)));
    ahu2=(u1hu2+u2hu2)/2.0;
    bhu2=sqrt(ahu2*ahu2-(lbhu2*lbhu2/4.0));
    a2hu2=ahu2*ahu2;
    b2hu2=bhu2*bhu2;
    DIV1hu2=sqrt(1.0-((lbhu2/2.0-louthu2)*(lbhu2/2.0-louthu2)/a2hu2));
    h2u2=bhu2*DIV1hu2;
    if(l<lbhu2/2-louthu2){
        dyhu2=uwallthick2*sin(atan(a2hu2*h1u2/(b2hu2*z0hu2)));
        dzhu2=uwallthick2*cos(atan(a2hu2*h1u2/(b2hu2*z0hu2)));
    	u1huwt2=sqrt(((linhu2+dzhu2)*(linhu2+dzhu2))+((h1u2+dyhu2)*(h1u2+dyhu2)));								
    	u2huwt2=sqrt(((h1u2+dyhu2)*(h1u2+dyhu2))+((l+louthu2-dzhu2)*(l+louthu2-dzhu2)));	
    	ahuwt2=(u1huwt2+u2huwt2)/2.0;
    	a2huwt2=ahuwt2*ahuwt2;
    	bhuwt2=sqrt(a2huwt2-(lbhu2*lbhu2/4.0));
    	b2huwt2=bhuwt2*bhuwt2;
    	h2uwt2=bhuwt2*sqrt(1.0-((lbhu2/2.0-louthu2)*(lbhu2/2.0-louthu2)/a2huwt2));
        h1uwt2=bhuwt2*sqrt(1.0-((lbhu2/2.0-louthu2-l)*(lbhu2/2.0-louthu2-l)/a2huwt2));
    }else{
	bhuwt2=bhu2+uwallthick2;
        b2huwt2=bhuwt2*bhuwt2;
        ahuwt2=sqrt(b2huwt2+(lbhu2*lbhu2/4.0));
        a2huwt2=b2huwt2+(lbhu2*lbhu2/4.0);
        h2uwt2=bhuwt2*sqrt(1.0-((lbhu2/2.0-louthu2)*(lbhu2/2.0-louthu2)/a2huwt2));
        h1uwt2=bhuwt2*sqrt(1.0-((lbhu2/2.0-linhu2)*(lbhu2/2.0-linhu2)/a2huwt2));
    }
  }

if(linhu2==0 && louthu2!=0)
   { 	
    DIV1hu2=(l+louthu2)*(l+louthu2);
    p2parahu2=2.0*(sqrt(DIV1hu2+(h1u2*h1u2))-sqrt(DIV1hu2));
    h2u2=sqrt(p2parahu2*(louthu2+p2parahu2/4.0));
    pbhu2=l+louthu2+p2parahu2/4.0;
    pahu2=1.0/p2parahu2;
    dyhu2=uwallthick2*sin(atan(h1u2*2*pahu2));
    dzhu2=uwallthick2*cos(atan(h1u2*2*pahu2));
    DIV1huwt2=(l+louthu2-dzhu2)*(l+louthu2-dzhu2);
    p2parahuwt2=2.0*(sqrt(DIV1huwt2+((h1u2+dyhu2)*(h1u2+dyhu2)))-sqrt(DIV1huwt2));
    pbhuwt2=l+louthu2+p2parahuwt2/4.0;
    pahuwt2=1.0/p2parahuwt2;
    h2uwt2=sqrt(p2parahuwt2*(louthu2+p2parahuwt2/4.0));
    h1uwt2=sqrt(p2parahuwt2*(louthu2+l+p2parahuwt2/4.0));
   } 

if (linhu2!=0 && louthu2==0)
    {
      DIV1hu2=linhu2*linhu2;
      p2parahu2=2.0*(sqrt(DIV1hu2+(h1u2*h1u2))-sqrt(DIV1hu2));
      h2u2=sqrt(p2parahu2*(l+linhu2+p2parahu2/4.0));
      pbhu2=-(linhu2+p2parahu2/4.0);
      pahu2=-1.0/p2parahu2;
      dyhu2=uwallthick2*sin(atan(-h2u2*2*pahu2));
      dzhu2=uwallthick2*cos(atan(-h2u2*2*pahu2));
      DIV1huwt2=(linhu2+l-dzhu2)*(linhu2+l-dzhu2);
      p2parahuwt2=2.0*(sqrt(DIV1huwt2+((h2u2+dyhu2)*(h2u2+dyhu2)))-sqrt(DIV1huwt2));
      h1uwt2=sqrt(p2parahuwt2*(linhu2+p2parahuwt2/4.0));
      h2uwt2=sqrt(p2parahuwt2*(linhu2+l+p2parahuwt2/4.0));
      pbhuwt2=-(linhu2+p2parahuwt2/4.0);
      pahuwt2=-1.0/p2parahuwt2;
    }

if(linhu2==0 && louthu2==0){
    h1uwt2=h1u2+uwallthick2/(cos(atan((h2u2-h1u2)/l)));
    h2uwt2=h2u2+uwallthick2/(cos(atan((h2u2-h1u2)/l)));
    }


lbhd2=linhd2+l+louthd2;
z0hd2=lbhd2/2.0-l-louthd2;

if (linhd2 != 0 && louthd2 !=0)
   {
    u1hd2=sqrt((linhd2*linhd2)+(h1d2*h1d2));
    u2hd2=sqrt((h1d2*h1d2)+((l+louthd2)*(l+louthd2)));
    ahd2=(u1hd2+u2hd2)/2.0;
    bhd2=sqrt(ahd2*ahd2-(lbhd2*lbhd2/4.0));
    a2hd2=ahd2*ahd2;
    b2hd2=bhd2*bhd2;
    DIV1hd2=sqrt(1.0-((lbhd2/2.0-louthd2)*(lbhd2/2.0-louthd2)/a2hd2));
    h2d2=bhd2*DIV1hd2;
    if(l<lbhd2/21-louthd2){
        dyhd2=dwallthick2*sin(atan(a2hd2*h1d2/(b2hd2*z0hd2)));
        dzhd2=dwallthick2*cos(atan(a2hd2*h1d2/(b2hd2*z0hd2)));
    	u1hdwt2=sqrt(((linhd2+dzhd2)*(linhd2+dzhd2))+((h1d2+dyhd2)*(h1d2+dyhd2)));	
    	u2hdwt2=sqrt(((h1d2+dyhd2)*(h1d2+dyhd2))+((l+louthd2-dzhd2)*(l+louthd2-dzhd2)));
    	ahdwt2=(u1hdwt2+u2hdwt2)/2.0;
    	a2hdwt2=ahdwt2*ahdwt2;
    	bhdwt2=sqrt(a2hdwt2-(lbhd2*lbhd2/4.0));
    	b2hdwt2=bhdwt2*bhdwt2;
    	h2dwt2=bhdwt2*sqrt(1.0-((lbhd2/2.0-louthd2)*(lbhd2/2.0-louthd2)/a2hdwt2));
        h1dwt2=bhdwt2*sqrt(1.0-((lbhd2/2.0-louthd2-l)*(lbhd2/2.0-louthd2-l)/a2hdwt2));
    }else{
	bhdwt2=bhd2+dwallthick2;
        b2hdwt2=bhdwt2*bhdwt2;
        ahdwt2=sqrt(b2hdwt2+(lbhd2*lbhd2/4.0));
        a2hdwt2=b2hdwt2+(lbhd2*lbhd2/4.0);
        h2dwt2=bhdwt2*sqrt(1.0-((lbhd2/2.0-louthd2)*(lbhd2/2.0-louthd2)/a2hdwt2));
        h1dwt2=bhdwt2*sqrt(1.0-((lbhd2/2.0-linhd2)*(lbhd2/2.0-linhd2)/a2hdwt2));
    }
  }

if(linhd2==0 && louthd2!=0)
   {	
    DIV1hd2=(l+louthd2)*(l+louthd2);
    p2parahd2=2.0*(sqrt(DIV1hd2+(h1d2*h1d2))-sqrt(DIV1hd2));
    h2d2=sqrt(p2parahd2*(louthd2+p2parahd2/4.0));
    pbhd2=l+louthd2+p2parahd2/4.0;
    pahd2=1.0/p2parahd2;
    dyhd2=dwallthick2*sin(atan(h1d2*2*pahd2));
    dzhd2=dwallthick2*cos(atan(h1d2*2*pahd2));
    DIV1hdwt2=(l+louthd2-dzhd2)*(l+louthd2-dzhd2);
    p2parahdwt2=2.0*(sqrt(DIV1hdwt2+((h1d2+dyhd2)*(h1d2+dyhd2)))-sqrt(DIV1hdwt2));
    pbhdwt2=l+louthd2+p2parahdwt2/4.0;
    pahdwt2=1.0/p2parahdwt2;
    h2dwt2=sqrt(p2parahdwt2*(louthd2+p2parahdwt2/4.0));
    h1dwt2=sqrt(p2parahdwt2*(louthd2+l+p2parahdwt2/4.0));
   }

if (linhd2!=0 && louthd2==0)
    {
      DIV1hd2=linhd2*linhd2;
      p2parahd2=2.0*(sqrt(DIV1hd2+(h1d2*h1d2))-sqrt(DIV1hd2));
      h2d2=sqrt(p2parahd2*(l+linhd2+p2parahd2/4.0));
      pbhd2=-(linhd2+p2parahd2/4.0);
      pahd2=-1.0/p2parahd2;
      dyhd2=dwallthick2*sin(atan(-h2d2*2*pahd2));
      dzhd2=dwallthick2*cos(atan(-h2d2*2*pahd2));
      DIV1hdwt2=(linhd2+l-dzhd2)*(linhd2+l-dzhd2);
      p2parahdwt2=2.0*(sqrt(DIV1hdwt2+((h2d2+dyhd2)*(h2d2+dyhd2)))-sqrt(DIV1hdwt2));
      h1dwt2=sqrt(p2parahdwt2*(linhd2+p2parahdwt2/4.0));
      h2dwt2=sqrt(p2parahdwt2*(linhd2+l+p2parahdwt2/4.0));
      pbhdwt2=-(linhd2+p2parahdwt2/4.0);
      pahdwt2=-1.0/p2parahdwt2;
    }

if(linhd2==0 && louthd2==0){
    h1dwt2=h1d2+dwallthick2/(cos(atan((h2d2-h1d2)/l)));
    h2dwt2=h2d2+dwallthick2/(cos(atan((h2d2-h1d2)/l)));
    }



mru12=(h1uwt2-h1u2)/(w1r2-w1rwt2);
nru12=h1u2-mru12*(-w1r2);
mru22=(h2uwt2-h2u2)/(w2r2-w2rwt2);
nru22=h2u2-mru22*(-w2r2);

mrd12=(-h1dwt2+h1d2)/(w1r2-w1rwt2);
nrd12=-h1d2-mrd12*(-w1r2);
mrd22=(-h2dwt2+h2d2)/(w2r2-w2rwt2);
nrd22=-h2d2-mrd22*(-w2r2);

mlu12=(h1uwt2-h1u2)/(-w1l2+w1lwt2);
nlu12=h1u2-mlu12*w1l2;
mlu22=(h2uwt2-h2u2)/(-w2l2+w2lwt2);
nlu22=h2u2-mlu22*w2l2;

mld12=(-h1dwt2+h1d2)/(-w1l2+w1lwt2);
nld12=-h1d2-mld12*w1l2;
mld22=(-h2dwt2+h2d2)/(-w2l2+w2lwt2);
nld22=-h2d2-mld22*w2l2;



if (w1r2 < w1rwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r2 have to be bigger or equal w1rwt1 \n");
    printf(" w1r2= %f \n",w1r2 );
    printf(" w1rwt1= %f \n",w1rwt1 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l2 < w1lwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l2 have to be bigger or equal w1lwt1 \n");
    printf(" w1l2= %f \n",w1l2 );
    printf(" w1lwt1= %f \n",w1lwt1 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u2 < h1uwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u2 have to be bigger or equal h1uwt1 \n");
    printf(" h1u2= %f \n",h1u2 );
    printf(" h1uwt1= %f \n",h1uwt1 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d2 < h1dwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d2 have to be bigger or equal h1dwt1 \n");
    printf(" h1d2= %f \n",h1d2 );
    printf(" h1dwt1= %f \n",h1dwt1 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r2 < w2rwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r2 have to be bigger or equal w2rwt1 \n");
    printf(" w2r2= %f \n",w2r2 );
    printf(" w2rwt1= %f \n",w2rwt1 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l2 < w2lwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l2 have to be bigger or equal w2lwt1 \n");
    printf(" w2l2= %f \n",w2l2 );
    printf(" w2lwt1= %f \n",w2lwt1 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u2 < h2uwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u2 have to be bigger or equal h2uwt1 \n");
    printf(" h2u2= %f \n",h2u2 );
    printf(" h2uwt1= %f \n",h2uwt1 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d2 < h2dwt1)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d2 have to be bigger or equal h2dwt1 \n");
    printf(" h2d2= %f \n",h2d2 );
    printf(" h2dwt1= %f \n",h2dwt1 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }



lbwr3=linwr3+l+loutwr3;
z0wr3=(linwr3-l-loutwr3)/2.0;

if(loutwr3!=0 && linwr3!=0)
  { 
    u1wr3=sqrt((linwr3*linwr3)+(w1r3*w1r3));
    u2wr3=sqrt((w1r3*w1r3)+((l+loutwr3)*(l+loutwr3)));
    awr3=(u1wr3+u2wr3)/2.0;
    a2wr3=awr3*awr3;
    bwr3=sqrt(a2wr3-(lbwr3*lbwr3/4.0));
    b2wr3=bwr3*bwr3;
    DIV1wr3=sqrt(1.0-((lbwr3/2.0-loutwr3)*(lbwr3/2.0-loutwr3)/a2wr3));
    w2r3=bwr3*DIV1wr3;
    if(l<lbwr3/2-loutwr3){
        dxwr3=rwallthick3*sin(atan(a2wr3*w1r3/(b2wr3*z0wr3)));
        dzwr3=rwallthick3*cos(atan(a2wr3*w1r3/(b2wr3*z0wr3)));
    	u1wrwt3=sqrt(((linwr3+dzwr3)*(linwr3+dzwr3))+((w1r3+dxwr3)*(w1r3+dxwr3)));
    	u2wrwt3=sqrt(((w1r3+dxwr3)*(w1r3+dxwr3))+((l+loutwr3-dzwr3)*(l+loutwr3-dzwr3)));
    	awrwt3=(u1wrwt3+u2wrwt3)/2.0;
    	a2wrwt3=awrwt3*awrwt3;
    	bwrwt3=sqrt(a2wrwt3-(lbwr3*lbwr3/4.0));
    	b2wrwt3=bwrwt3*bwrwt3;
    	w2rwt3=bwrwt3*sqrt(1.0-((lbwr3/2.0-loutwr3)*(lbwr3/2.0-loutwr3)/a2wrwt3));
        w1rwt3=bwrwt3*sqrt(1.0-((lbwr3/2.0-loutwr3-l)*(lbwr3/2.0-loutwr3-l)/a2wrwt3));
    }else{
	bwrwt3=bwr3+rwallthick3;
        b2wrwt3=bwrwt3*bwrwt3;
        awrwt3=sqrt(b2wrwt3+(lbwr3*lbwr3/4.0));
        a2wrwt3=b2wrwt3+(lbwr3*lbwr3/4.0);
        w2rwt3=bwrwt3*sqrt(1.0-((lbwr3/2.0-loutwr3)*(lbwr3/2.0-loutwr3)/a2wrwt3));
        w1rwt3=bwrwt3*sqrt(1.0-((lbwr3/2.0-linwr3)*(lbwr3/2.0-linwr3)/a2wrwt3));
    }
   }



if(linwr3==0 && loutwr3!=0){
    DIV1wr3=(l+loutwr3)*(l+loutwr3);
    p2parawr3=2.0*(sqrt(DIV1wr3+(w1r3*w1r3))-sqrt(DIV1wr3));
    w2r3=sqrt(p2parawr3*(loutwr3+p2parawr3/4.0));
    pbwr3=l+loutwr3+p2parawr3/4.0;
    pawr3=1.0/p2parawr3;
    dxwr3=rwallthick3*sin(atan(w1r3*2*pawr3));
    dzwr3=rwallthick3*cos(atan(w1r3*2*pawr3));
    DIV1wrwt3=(l+loutwr3-dzwr3)*(l+loutwl3-dzwr3);
    p2parawrwt3=2.0*(sqrt(DIV1wrwt3+((w1r3+dxwr3)*(w1r3+dxwr3)))-sqrt(DIV1wrwt3));
    pbwrwt3=l+loutwr3+p2parawrwt3/4.0;
    pawrwt3=1.0/p2parawrwt3;
    w2rwt3=sqrt(p2parawrwt3*(loutwr3+p2parawrwt3/4.0));
    w1rwt3=sqrt(p2parawrwt3*(loutwr3+l+p2parawrwt3/4.0));
   }



if (linwr3!=0 && loutwr3==0)
    {
      DIV1wr3=linwr3*linwr3;
      p2parawr3=2.0*(sqrt(DIV1wr3+(w1r3*w1r3))-sqrt(DIV1wr3));
      w2r3=sqrt(p2parawr3*(l+linwr3+p2parawr3/4.0));
      pbwr3=-(linwr3+p2parawr3/4.0);
      pawr3=-1.0/p2parawr3;
      dxwr3=rwallthick3*sin(atan(-w2r3*2*pawr3));
      dzwr3=rwallthick3*cos(atan(-w2r3*2*pawr3));
      DIV1wrwt3=(linwr3+l-dzwr3)*(linwr3+l-dzwr3);
      p2parawrwt3=2.0*(sqrt(DIV1wrwt3+((w2r3+dxwr3)*(w2r3+dxwr3)))-sqrt(DIV1wrwt3));
      w1rwt3=sqrt(p2parawrwt3*(linwr3+p2parawrwt3/4.0));
      w2rwt3=sqrt(p2parawrwt3*(linwr3+l+p2parawrwt3/4.0));
      pbwrwt3=-(linwr3+p2parawrwt3/4.0);
      pawrwt3=-1.0/p2parawrwt3;
    }


if(linwr3==0 && loutwr3==0){
    w1rwt3=w1r3+rwallthick3/(cos(atan((w1r3-w2r3)/l)));
    w2rwt3=w2r3+rwallthick3/(cos(atan((w1r3-w2r3)/l)));
    }

lbwl3=linwl3+l+loutwl3;
z0wl3=(linwl3-l-loutwl3)/2.0;

if((linwl3!=0) && (loutwl3!=0) ) 
  { 
    u1wl3=sqrt((linwl3*linwl3)+(w1l3*w1l3));
    u2wl3=sqrt((w1l3*w1l3)+((l+loutwl3)*(l+loutwl3)));
    awl3=(u1wl3+u2wl3)/2.0;
    a2wl3=awl3*awl3;
    bwl3=sqrt(a2wl3-(lbwl3*lbwl3/4.0));
    b2wl3=bwl3*bwl3;
    DIV1wl3=sqrt(1.0-((lbwl3/2.0-loutwl3)*(lbwl3/2.0-loutwl3)/a2wl3));
    w2l3=bwl3*DIV1wl3;
    if(l<lbwl3/2-loutwl3){
        dxwl3=lwallthick3*sin(atan(a2wl3*w1l3/(b2wl3*z0wl3)));
        dzwl3=lwallthick3*cos(atan(a2wl3*w1l3/(b2wl3*z0wl3)));
    	u1wlwt3=sqrt(((linwl3+dzwl3)*(linwl3+dzwl3))+((w1l3+dxwl3)*(w1l3+dxwl3)));								
    	u2wlwt3=sqrt(((w1l3+dxwl3)*(w1l3+dxwl3))+((l+loutwl3-dzwl3)*(l+loutwl3-dzwl3)));	
    	awlwt3=(u1wlwt3+u2wlwt3)/2.0;
    	a2wlwt3=awlwt3*awlwt3;
    	bwlwt3=sqrt(a2wlwt3-(lbwl3*lbwl3/4.0));
    	b2wlwt3=bwlwt3*bwlwt3;
    	w2lwt3=bwlwt3*sqrt(1.0-((lbwl3/2.0-loutwl3)*(lbwl3/2.0-loutwl3)/a2wlwt3));
        w1lwt3=bwlwt3*sqrt(1.0-((lbwl3/2.0-loutwl3-l)*(lbwl3/2.0-loutwl3-l)/a2wlwt3));
    }else{
	bwlwt3=bwl3+lwallthick3;
        b2wlwt3=bwlwt3*bwlwt3;
        awlwt3=sqrt(b2wlwt3+(lbwl3*lbwl3/4.0));
        a2wlwt3=b2wlwt3+(lbwl3*lbwl3/4.0);
        w2lwt3=bwlwt3*sqrt(1.0-((lbwl3/2.0-loutwl3)*(lbwl3/2.0-loutwl3)/a2wlwt3));
        w1lwt3=bwlwt3*sqrt(1.0-((lbwl3/2.0-linwl3)*(lbwl3/2.0-linwl3)/a2wlwt3));
    }
   }


if(linwl3==0 && loutwl3!=0)
   {
    DIV1wl3=(l+loutwl3)*(l+loutwl3);
    p2parawl3=2.0*(sqrt(DIV1wl3+(w1l3*w1l3))-sqrt(DIV1wl3));
    w2l3=sqrt(p2parawl3*(loutwl3+p2parawl3/4.0));
    pbwl3=l+loutwl3+p2parawl3/4.0;
    pawl3=1.0/p2parawl3;
    dxwl3=lwallthick3*sin(atan(w1l3*2*pawl3));
    dzwl3=lwallthick3*cos(atan(w1l3*2*pawl3));
    DIV1wlwt3=(l+loutwl3-dzwl3)*(l+loutwl3-dzwl3);
    p2parawlwt3=2.0*(sqrt(DIV1wlwt3+((w1l3+dxwl3)*(w1l3+dxwl3)))-sqrt(DIV1wlwt3));
    pbwlwt3=l+loutwl3+p2parawlwt3/4.0;
    pawlwt3=1.0/p2parawlwt3;
    w2lwt3=sqrt(p2parawlwt3*(loutwl3+p2parawlwt3/4.0));
    w1lwt3=sqrt(p2parawlwt3*(loutwl3+l+p2parawlwt3/4.0));
   }

if (linwl3!=0 && loutwl3==0)
    {
      DIV1wl3=linwl3*linwl3;
      p2parawl3=2.0*(sqrt(DIV1wl3+(w1l3*w1l3))-sqrt(DIV1wl3));
      w2l3=sqrt(p2parawl3*(l+linwl3+p2parawl3/4.0));
      pbwl3=-(linwl3+p2parawl3/4.0);
      pawl3=-1.0/p2parawl3;
      dxwl3=lwallthick3*sin(atan(-w2l3*2*pawl3));
      dzwl3=lwallthick3*cos(atan(-w2l3*2*pawl3));
      DIV1wlwt3=(linwl3+l-dzwl3)*(linwl3+l-dzwl3);
      p2parawlwt3=2.0*(sqrt(DIV1wlwt3+((w2l3+dxwl3)*(w2l3+dxwl3)))-sqrt(DIV1wlwt3));
      w1lwt3=sqrt(p2parawlwt3*(linwl3+p2parawlwt3/4.0));
      w2lwt3=sqrt(p2parawlwt3*(linwl3+l+p2parawlwt3/4.0));
      pbwlwt3=-(linwl3+p2parawlwt3/4.0);
      pawlwt3=-1.0/p2parawlwt3;
    }

if(linwl3==0 && loutwl3==0){
    w1lwt3=w1l3+lwallthick3/(cos(atan((w2l3-w1l3)/l)));
    w2lwt3=w2l3+lwallthick3/(cos(atan((w2l3-w1l3)/l)));
    }


lbhu3=linhu3+l+louthu3;
z0hu3=lbhu3/2.0-l-louthu3;	

if (linhu3 != 0 && louthu3 !=0)
   {
    u1hu3=sqrt((linhu3*linhu3)+(h1u3*h1u3));
    u2hu3=sqrt((h1u3*h1u3)+((l+louthu3)*(l+louthu3)));
    ahu3=(u1hu3+u2hu3)/2.0;
    bhu3=sqrt(ahu3*ahu3-(lbhu3*lbhu3/4.0));
    a2hu3=ahu3*ahu3;
    b2hu3=bhu3*bhu3;
    DIV1hu3=sqrt(1.0-((lbhu3/2.0-louthu3)*(lbhu3/2.0-louthu3)/a2hu3));
    h2u3=bhu3*DIV1hu3;
    if(l<lbhu3/2-louthu3){
        dyhu3=uwallthick3*sin(atan(a2hu3*h1u3/(b2hu3*z0hu3)));
        dzhu3=uwallthick3*cos(atan(a2hu3*h1u3/(b2hu3*z0hu3)));
    	u1huwt3=sqrt(((linhu3+dzhu3)*(linhu3+dzhu3))+((h1u3+dyhu3)*(h1u3+dyhu3)));								
    	u2huwt3=sqrt(((h1u3+dyhu3)*(h1u3+dyhu3))+((l+louthu3-dzhu3)*(l+louthu3-dzhu3)));	
    	ahuwt3=(u1huwt3+u2huwt3)/2.0;
    	a2huwt3=ahuwt3*ahuwt3;
    	bhuwt3=sqrt(a2huwt3-(lbhu3*lbhu3/4.0));
    	b2huwt3=bhuwt3*bhuwt3;
    	h2uwt3=bhuwt3*sqrt(1.0-((lbhu3/2.0-louthu3)*(lbhu3/2.0-louthu3)/a2huwt3));
        h1uwt3=bhuwt3*sqrt(1.0-((lbhu3/2.0-louthu3-l)*(lbhu3/2.0-louthu3-l)/a2huwt3));
    }else{
	bhuwt3=bhu3+uwallthick3;
        b2huwt3=bhuwt3*bhuwt3;
        ahuwt3=sqrt(b2huwt3+(lbhu3*lbhu3/4.0));
        a2huwt3=b2huwt3+(lbhu3*lbhu3/4.0);
        h2uwt3=bhuwt3*sqrt(1.0-((lbhu3/2.0-louthu3)*(lbhu3/2.0-louthu3)/a2huwt3));
        h1uwt3=bhuwt3*sqrt(1.0-((lbhu3/2.0-linhu3)*(lbhu3/2.0-linhu3)/a2huwt3));
    }
  }

if(linhu3==0 && louthu3!=0)
   { 	
    DIV1hu3=(l+louthu3)*(l+louthu3);
    p2parahu3=2.0*(sqrt(DIV1hu3+(h1u3*h1u3))-sqrt(DIV1hu3));
    h2u3=sqrt(p2parahu3*(louthu3+p2parahu3/4.0));
    pbhu3=l+louthu3+p2parahu3/4.0;
    pahu3=1.0/p2parahu3;
    dyhu3=uwallthick3*sin(atan(h1u3*2*pahu3));
    dzhu3=uwallthick3*cos(atan(h1u3*2*pahu3));
    DIV1huwt3=(l+louthu3-dzhu3)*(l+louthu3-dzhu3);
    p2parahuwt3=2.0*(sqrt(DIV1huwt3+((h1u3+dyhu3)*(h1u3+dyhu3)))-sqrt(DIV1huwt3));
    pbhuwt3=l+louthu3+p2parahuwt3/4.0;
    pahuwt3=1.0/p2parahuwt3;
    h2uwt3=sqrt(p2parahuwt3*(louthu3+p2parahuwt3/4.0));
    h1uwt3=sqrt(p2parahuwt3*(louthu3+l+p2parahuwt3/4.0));
   } 

if (linhu3!=0 && louthu3==0)
    {
      DIV1hu3=linhu3*linhu3;
      p2parahu3=2.0*(sqrt(DIV1hu3+(h1u3*h1u3))-sqrt(DIV1hu3));
      h2u3=sqrt(p2parahu3*(l+linhu3+p2parahu3/4.0));
      pbhu3=-(linhu3+p2parahu3/4.0);
      pahu3=-1.0/p2parahu3;
      dyhu3=uwallthick3*sin(atan(-h2u3*2*pahu3));
      dzhu3=uwallthick3*cos(atan(-h2u3*2*pahu3));
      DIV1huwt3=(linhu3+l-dzhu3)*(linhu3+l-dzhu3);
      p2parahuwt3=2.0*(sqrt(DIV1huwt3+((h2u3+dyhu3)*(h2u3+dyhu3)))-sqrt(DIV1huwt3));
      h1uwt3=sqrt(p2parahuwt3*(linhu3+p2parahuwt3/4.0));
      h2uwt3=sqrt(p2parahuwt3*(linhu3+l+p2parahuwt3/4.0));
      pbhuwt3=-(linhu3+p2parahuwt3/4.0);
      pahuwt3=-1.0/p2parahuwt3;
    }

if(linhu3==0 && louthu3==0){
    h1uwt3=h1u3+uwallthick3/(cos(atan((h2u3-h1u3)/l)));
    h2uwt3=h2u3+uwallthick3/(cos(atan((h2u3-h1u3)/l)));
    }


lbhd3=linhd3+l+louthd3;
z0hd3=lbhd3/2.0-l-louthd3;

if (linhd3 != 0 && louthd3 !=0)
   {
    u1hd3=sqrt((linhd3*linhd3)+(h1d3*h1d3));
    u2hd3=sqrt((h1d3*h1d3)+((l+louthd3)*(l+louthd3)));
    ahd3=(u1hd3+u2hd3)/2.0;
    bhd3=sqrt(ahd3*ahd3-(lbhd3*lbhd3/4.0));
    a2hd3=ahd3*ahd3;
    b2hd3=bhd3*bhd3;
    DIV1hd3=sqrt(1.0-((lbhd3/2.0-louthd3)*(lbhd3/2.0-louthd3)/a2hd3));
    h2d3=bhd3*DIV1hd3;
    if(l<lbhd3/21-louthd3){
        dyhd3=dwallthick3*sin(atan(a2hd3*h1d3/(b2hd3*z0hd3)));
        dzhd3=dwallthick3*cos(atan(a2hd3*h1d3/(b2hd3*z0hd3)));
    	u1hdwt3=sqrt(((linhd3+dzhd3)*(linhd3+dzhd3))+((h1d3+dyhd3)*(h1d3+dyhd3)));	
    	u2hdwt3=sqrt(((h1d3+dyhd3)*(h1d3+dyhd3))+((l+louthd3-dzhd3)*(l+louthd3-dzhd3)));
    	ahdwt3=(u1hdwt3+u2hdwt3)/2.0;
    	a2hdwt3=ahdwt3*ahdwt3;
    	bhdwt3=sqrt(a2hdwt3-(lbhd3*lbhd3/4.0));
    	b2hdwt3=bhdwt3*bhdwt3;
    	h2dwt3=bhdwt3*sqrt(1.0-((lbhd3/2.0-louthd3)*(lbhd3/2.0-louthd3)/a2hdwt3));
        h1dwt3=bhdwt3*sqrt(1.0-((lbhd3/2.0-louthd3-l)*(lbhd3/2.0-louthd3-l)/a2hdwt3));
    }else{
	bhdwt3=bhd3+dwallthick3;
        b2hdwt3=bhdwt3*bhdwt3;
        ahdwt3=sqrt(b2hdwt3+(lbhd3*lbhd3/4.0));
        a2hdwt3=b2hdwt3+(lbhd3*lbhd3/4.0);
        h2dwt3=bhdwt3*sqrt(1.0-((lbhd3/2.0-louthd3)*(lbhd3/2.0-louthd3)/a2hdwt3));
        h1dwt3=bhdwt3*sqrt(1.0-((lbhd3/2.0-linhd3)*(lbhd3/2.0-linhd3)/a2hdwt3));
    }
  }

if(linhd3==0 && louthd3!=0)
   {	
    DIV1hd3=(l+louthd3)*(l+louthd3);
    p2parahd3=2.0*(sqrt(DIV1hd3+(h1d3*h1d3))-sqrt(DIV1hd3));
    h2d3=sqrt(p2parahd3*(louthd3+p2parahd3/4.0));
    pbhd3=l+louthd3+p2parahd3/4.0;
    pahd3=1.0/p2parahd3;
    dyhd3=dwallthick3*sin(atan(h1d3*2*pahd3));
    dzhd3=dwallthick3*cos(atan(h1d3*2*pahd3));
    DIV1hdwt3=(l+louthd3-dzhd3)*(l+louthd3-dzhd3);
    p2parahdwt3=2.0*(sqrt(DIV1hdwt3+((h1d3+dyhd3)*(h1d3+dyhd3)))-sqrt(DIV1hdwt3));
    pbhdwt3=l+louthd3+p2parahdwt3/4.0;
    pahdwt3=1.0/p2parahdwt3;
    h2dwt3=sqrt(p2parahdwt3*(louthd3+p2parahdwt3/4.0));
    h1dwt3=sqrt(p2parahdwt3*(louthd3+l+p2parahdwt3/4.0));
   }

if (linhd3!=0 && louthd3==0)
    {
      DIV1hd3=linhd3*linhd3;
      p2parahd3=2.0*(sqrt(DIV1hd3+(h1d3*h1d3))-sqrt(DIV1hd3));
      h2d3=sqrt(p2parahd3*(l+linhd3+p2parahd3/4.0));
      pbhd3=-(linhd3+p2parahd3/4.0);
      pahd3=-1.0/p2parahd3;
      dyhd3=dwallthick3*sin(atan(-h2d3*2*pahd3));
      dzhd3=dwallthick3*cos(atan(-h2d3*2*pahd3));
      DIV1hdwt3=(linhd3+l-dzhd3)*(linhd3+l-dzhd3);
      p2parahdwt3=2.0*(sqrt(DIV1hdwt3+((h2d3+dyhd3)*(h2d3+dyhd3)))-sqrt(DIV1hdwt3));
      h1dwt3=sqrt(p2parahdwt3*(linhd3+p2parahdwt3/4.0));
      h2dwt3=sqrt(p2parahdwt3*(linhd3+l+p2parahdwt3/4.0));
      pbhdwt3=-(linhd3+p2parahdwt3/4.0);
      pahdwt3=-1.0/p2parahdwt3;
    }

if(linhd3==0 && louthd3==0){
    h1dwt3=h1d3+dwallthick3/(cos(atan((h2d3-h1d3)/l)));
    h2dwt3=h2d3+dwallthick3/(cos(atan((h2d3-h1d3)/l)));
    }



mru13=(h1uwt3-h1u3)/(w1r3-w1rwt3);
nru13=h1u3-mru13*(-w1r3);
mru23=(h2uwt3-h2u3)/(w2r3-w2rwt3);
nru23=h2u3-mru23*(-w2r3);

mrd13=(-h1dwt3+h1d3)/(w1r3-w1rwt3);
nrd13=-h1d3-mrd13*(-w1r3);
mrd23=(-h2dwt3+h2d3)/(w2r3-w2rwt3);
nrd23=-h2d3-mrd23*(-w2r3);

mlu13=(h1uwt3-h1u3)/(-w1l3+w1lwt3);
nlu13=h1u3-mlu13*w1l3;
mlu23=(h2uwt3-h2u3)/(-w2l3+w2lwt3);
nlu23=h2u3-mlu23*w2l3;

mld13=(-h1dwt3+h1d3)/(-w1l3+w1lwt3);
nld13=-h1d3-mld13*w1l3;
mld23=(-h2dwt3+h2d3)/(-w2l3+w2lwt3);
nld23=-h2d3-mld23*w2l3;



if (w1r3 < w1rwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r3 have to be bigger or equal w1rwt2 \n");
    printf(" w1r3= %f \n",w1r3 );
    printf(" w1rwt2= %f \n",w1rwt2 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l3 < w1lwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l3 have to be bigger or equal w1lwt2 \n");
    printf(" w1l3= %f \n",w1l3 );
    printf(" w1lwt2= %f \n",w1lwt2 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u3 < h1uwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u3 have to be bigger or equal h1uwt2 \n");
    printf(" h1u3= %f \n",h1u3 );
    printf(" h1uwt2= %f \n",h1uwt2 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d3 < h1dwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d3 have to be bigger or equal h1dwt2 \n");
    printf(" h1d3= %f \n",h1d3 );
    printf(" h1dwt2= %f \n",h1dwt2 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r3 < w2rwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r3 have to be bigger or equal w2rwt2 \n");
    printf(" w2r3= %f \n",w2r3 );
    printf(" w2rwt2= %f \n",w2rwt2 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l3 < w2lwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l3 have to be bigger or equal w2lwt2 \n");
    printf(" w2l3= %f \n",w2l3 );
    printf(" w2lwt2= %f \n",w2lwt2 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u3 < h2uwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u3 have to be bigger or equal h2uwt2 \n");
    printf(" h2u3= %f \n",h2u3 );
    printf(" h2uwt2= %f \n",h2uwt2 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d3 < h2dwt2)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d3 have to be bigger or equal h2dwt2 \n");
    printf(" h2d3= %f \n",h2d3 );
    printf(" h2dwt2= %f \n",h2dwt2 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }



lbwr4=linwr4+l+loutwr4;
z0wr4=(linwr4-l-loutwr4)/2.0;

if(loutwr4!=0 && linwr4!=0)
  { 
    u1wr4=sqrt((linwr4*linwr4)+(w1r4*w1r4));
    u2wr4=sqrt((w1r4*w1r4)+((l+loutwr4)*(l+loutwr4)));
    awr4=(u1wr4+u2wr4)/2.0;
    a2wr4=awr4*awr4;
    bwr4=sqrt(a2wr4-(lbwr4*lbwr4/4.0));
    b2wr4=bwr4*bwr4;
    DIV1wr4=sqrt(1.0-((lbwr4/2.0-loutwr4)*(lbwr4/2.0-loutwr4)/a2wr4));
    w2r4=bwr4*DIV1wr4;
    if(l<lbwr4/2-loutwr4){
        dxwr4=rwallthick4*sin(atan(a2wr4*w1r4/(b2wr4*z0wr4)));
        dzwr4=rwallthick4*cos(atan(a2wr4*w1r4/(b2wr4*z0wr4)));
    	u1wrwt4=sqrt(((linwr4+dzwr4)*(linwr4+dzwr4))+((w1r4+dxwr4)*(w1r4+dxwr4)));
    	u2wrwt4=sqrt(((w1r4+dxwr4)*(w1r4+dxwr4))+((l+loutwr4-dzwr4)*(l+loutwr4-dzwr4)));
    	awrwt4=(u1wrwt4+u2wrwt4)/2.0;
    	a2wrwt4=awrwt4*awrwt4;
    	bwrwt4=sqrt(a2wrwt4-(lbwr4*lbwr4/4.0));
    	b2wrwt4=bwrwt4*bwrwt4;
    	w2rwt4=bwrwt4*sqrt(1.0-((lbwr4/2.0-loutwr4)*(lbwr4/2.0-loutwr4)/a2wrwt4));
        w1rwt4=bwrwt4*sqrt(1.0-((lbwr4/2.0-loutwr4-l)*(lbwr4/2.0-loutwr4-l)/a2wrwt4));
    }else{
	bwrwt4=bwr4+rwallthick4;
        b2wrwt4=bwrwt4*bwrwt4;
        awrwt4=sqrt(b2wrwt4+(lbwr4*lbwr4/4.0));
        a2wrwt4=b2wrwt4+(lbwr4*lbwr4/4.0);
        w2rwt4=bwrwt4*sqrt(1.0-((lbwr4/2.0-loutwr4)*(lbwr4/2.0-loutwr4)/a2wrwt4));
        w1rwt4=bwrwt4*sqrt(1.0-((lbwr4/2.0-linwr4)*(lbwr4/2.0-linwr4)/a2wrwt4));
    }
   }



if(linwr4==0 && loutwr4!=0){
    DIV1wr4=(l+loutwr4)*(l+loutwr4);
    p2parawr4=2.0*(sqrt(DIV1wr4+(w1r4*w1r4))-sqrt(DIV1wr4));
    w2r4=sqrt(p2parawr4*(loutwr4+p2parawr4/4.0));
    pbwr4=l+loutwr4+p2parawr4/4.0;
    pawr4=1.0/p2parawr4;
    dxwr4=rwallthick4*sin(atan(w1r4*2*pawr4));
    dzwr4=rwallthick4*cos(atan(w1r4*2*pawr4));
    DIV1wrwt4=(l+loutwr4-dzwr4)*(l+loutwl4-dzwr4);
    p2parawrwt4=2.0*(sqrt(DIV1wrwt4+((w1r4+dxwr4)*(w1r4+dxwr4)))-sqrt(DIV1wrwt4));
    pbwrwt4=l+loutwr4+p2parawrwt4/4.0;
    pawrwt4=1.0/p2parawrwt4;
    w2rwt4=sqrt(p2parawrwt4*(loutwr4+p2parawrwt4/4.0));
    w1rwt4=sqrt(p2parawrwt4*(loutwr4+l+p2parawrwt4/4.0));
   }



if (linwr4!=0 && loutwr4==0)
    {
      DIV1wr4=linwr4*linwr4;
      p2parawr4=2.0*(sqrt(DIV1wr4+(w1r4*w1r4))-sqrt(DIV1wr4));
      w2r4=sqrt(p2parawr4*(l+linwr4+p2parawr4/4.0));
      pbwr4=-(linwr4+p2parawr4/4.0);
      pawr4=-1.0/p2parawr4;
      dxwr4=rwallthick4*sin(atan(-w2r4*2*pawr4));
      dzwr4=rwallthick4*cos(atan(-w2r4*2*pawr4));
      DIV1wrwt4=(linwr4+l-dzwr4)*(linwr4+l-dzwr4);
      p2parawrwt4=2.0*(sqrt(DIV1wrwt4+((w2r4+dxwr4)*(w2r4+dxwr4)))-sqrt(DIV1wrwt4));
      w1rwt4=sqrt(p2parawrwt4*(linwr4+p2parawrwt4/4.0));
      w2rwt4=sqrt(p2parawrwt4*(linwr4+l+p2parawrwt4/4.0));
      pbwrwt4=-(linwr4+p2parawrwt4/4.0);
      pawrwt4=-1.0/p2parawrwt4;
    }


if(linwr4==0 && loutwr4==0){
    w1rwt4=w1r4+rwallthick4/(cos(atan((w1r4-w2r4)/l)));
    w2rwt4=w2r4+rwallthick4/(cos(atan((w1r4-w2r4)/l)));
    }

lbwl4=linwl4+l+loutwl4;
z0wl4=(linwl4-l-loutwl4)/2.0;

if((linwl4!=0) && (loutwl4!=0) ) 
  { 
    u1wl4=sqrt((linwl4*linwl4)+(w1l4*w1l4));
    u2wl4=sqrt((w1l4*w1l4)+((l+loutwl4)*(l+loutwl4)));
    awl4=(u1wl4+u2wl4)/2.0;
    a2wl4=awl4*awl4;
    bwl4=sqrt(a2wl4-(lbwl4*lbwl4/4.0));
    b2wl4=bwl4*bwl4;
    DIV1wl4=sqrt(1.0-((lbwl4/2.0-loutwl4)*(lbwl4/2.0-loutwl4)/a2wl4));
    w2l4=bwl4*DIV1wl4;
    if(l<lbwl4/2-loutwl4){
        dxwl4=lwallthick4*sin(atan(a2wl4*w1l4/(b2wl4*z0wl4)));
        dzwl4=lwallthick4*cos(atan(a2wl4*w1l4/(b2wl4*z0wl4)));
    	u1wlwt4=sqrt(((linwl4+dzwl4)*(linwl4+dzwl4))+((w1l4+dxwl4)*(w1l4+dxwl4)));								
    	u2wlwt4=sqrt(((w1l4+dxwl4)*(w1l4+dxwl4))+((l+loutwl4-dzwl4)*(l+loutwl4-dzwl4)));	
    	awlwt4=(u1wlwt4+u2wlwt4)/2.0;
    	a2wlwt4=awlwt4*awlwt4;
    	bwlwt4=sqrt(a2wlwt4-(lbwl4*lbwl4/4.0));
    	b2wlwt4=bwlwt4*bwlwt4;
    	w2lwt4=bwlwt4*sqrt(1.0-((lbwl4/2.0-loutwl4)*(lbwl4/2.0-loutwl4)/a2wlwt4));
        w1lwt4=bwlwt4*sqrt(1.0-((lbwl4/2.0-loutwl4-l)*(lbwl4/2.0-loutwl4-l)/a2wlwt4));
    }else{
	bwlwt4=bwl4+lwallthick4;
        b2wlwt4=bwlwt4*bwlwt4;
        awlwt4=sqrt(b2wlwt4+(lbwl4*lbwl4/4.0));
        a2wlwt4=b2wlwt4+(lbwl4*lbwl4/4.0);
        w2lwt4=bwlwt4*sqrt(1.0-((lbwl4/2.0-loutwl4)*(lbwl4/2.0-loutwl4)/a2wlwt4));
        w1lwt4=bwlwt4*sqrt(1.0-((lbwl4/2.0-linwl4)*(lbwl4/2.0-linwl4)/a2wlwt4));
    }
   }


if(linwl4==0 && loutwl4!=0)
   {
    DIV1wl4=(l+loutwl4)*(l+loutwl4);
    p2parawl4=2.0*(sqrt(DIV1wl4+(w1l4*w1l4))-sqrt(DIV1wl4));
    w2l4=sqrt(p2parawl4*(loutwl4+p2parawl4/4.0));
    pbwl4=l+loutwl4+p2parawl4/4.0;
    pawl4=1.0/p2parawl4;
    dxwl4=lwallthick4*sin(atan(w1l4*2*pawl4));
    dzwl4=lwallthick4*cos(atan(w1l4*2*pawl4));
    DIV1wlwt4=(l+loutwl4-dzwl4)*(l+loutwl4-dzwl4);
    p2parawlwt4=2.0*(sqrt(DIV1wlwt4+((w1l4+dxwl4)*(w1l4+dxwl4)))-sqrt(DIV1wlwt4));
    pbwlwt4=l+loutwl4+p2parawlwt4/4.0;
    pawlwt4=1.0/p2parawlwt4;
    w2lwt4=sqrt(p2parawlwt4*(loutwl4+p2parawlwt4/4.0));
    w1lwt4=sqrt(p2parawlwt4*(loutwl4+l+p2parawlwt4/4.0));
   }

if (linwl4!=0 && loutwl4==0)
    {
      DIV1wl4=linwl4*linwl4;
      p2parawl4=2.0*(sqrt(DIV1wl4+(w1l4*w1l4))-sqrt(DIV1wl4));
      w2l4=sqrt(p2parawl4*(l+linwl4+p2parawl4/4.0));
      pbwl4=-(linwl4+p2parawl4/4.0);
      pawl4=-1.0/p2parawl4;
      dxwl4=lwallthick4*sin(atan(-w2l4*2*pawl4));
      dzwl4=lwallthick4*cos(atan(-w2l4*2*pawl4));
      DIV1wlwt4=(linwl4+l-dzwl4)*(linwl4+l-dzwl4);
      p2parawlwt4=2.0*(sqrt(DIV1wlwt4+((w2l4+dxwl4)*(w2l4+dxwl4)))-sqrt(DIV1wlwt4));
      w1lwt4=sqrt(p2parawlwt4*(linwl4+p2parawlwt4/4.0));
      w2lwt4=sqrt(p2parawlwt4*(linwl4+l+p2parawlwt4/4.0));
      pbwlwt4=-(linwl4+p2parawlwt4/4.0);
      pawlwt4=-1.0/p2parawlwt4;
    }

if(linwl4==0 && loutwl4==0){
    w1lwt4=w1l4+lwallthick4/(cos(atan((w2l4-w1l4)/l)));
    w2lwt4=w2l4+lwallthick4/(cos(atan((w2l4-w1l4)/l)));
    }


lbhu4=linhu4+l+louthu4;
z0hu4=lbhu4/2.0-l-louthu4;	

if (linhu4 != 0 && louthu4 !=0)
   {
    u1hu4=sqrt((linhu4*linhu4)+(h1u4*h1u4));
    u2hu4=sqrt((h1u4*h1u4)+((l+louthu4)*(l+louthu4)));
    ahu4=(u1hu4+u2hu4)/2.0;
    bhu4=sqrt(ahu4*ahu4-(lbhu4*lbhu4/4.0));
    a2hu4=ahu4*ahu4;
    b2hu4=bhu4*bhu4;
    DIV1hu4=sqrt(1.0-((lbhu4/2.0-louthu4)*(lbhu4/2.0-louthu4)/a2hu4));
    h2u4=bhu4*DIV1hu4;
    if(l<lbhu4/2-louthu4){
        dyhu4=uwallthick4*sin(atan(a2hu4*h1u4/(b2hu4*z0hu4)));
        dzhu4=uwallthick4*cos(atan(a2hu4*h1u4/(b2hu4*z0hu4)));
    	u1huwt4=sqrt(((linhu4+dzhu4)*(linhu4+dzhu4))+((h1u4+dyhu4)*(h1u4+dyhu4)));								
    	u2huwt4=sqrt(((h1u4+dyhu4)*(h1u4+dyhu4))+((l+louthu4-dzhu4)*(l+louthu4-dzhu4)));	
    	ahuwt4=(u1huwt4+u2huwt4)/2.0;
    	a2huwt4=ahuwt4*ahuwt4;
    	bhuwt4=sqrt(a2huwt4-(lbhu4*lbhu4/4.0));
    	b2huwt4=bhuwt4*bhuwt4;
    	h2uwt4=bhuwt4*sqrt(1.0-((lbhu4/2.0-louthu4)*(lbhu4/2.0-louthu4)/a2huwt4));
        h1uwt4=bhuwt4*sqrt(1.0-((lbhu4/2.0-louthu4-l)*(lbhu4/2.0-louthu4-l)/a2huwt4));
    }else{
	bhuwt4=bhu4+uwallthick4;
        b2huwt4=bhuwt4*bhuwt4;
        ahuwt4=sqrt(b2huwt4+(lbhu4*lbhu4/4.0));
        a2huwt4=b2huwt4+(lbhu4*lbhu4/4.0);
        h2uwt4=bhuwt4*sqrt(1.0-((lbhu4/2.0-louthu4)*(lbhu4/2.0-louthu4)/a2huwt4));
        h1uwt4=bhuwt4*sqrt(1.0-((lbhu4/2.0-linhu4)*(lbhu4/2.0-linhu4)/a2huwt4));
    }
  }

if(linhu4==0 && louthu4!=0)
   { 	
    DIV1hu4=(l+louthu4)*(l+louthu4);
    p2parahu4=2.0*(sqrt(DIV1hu4+(h1u4*h1u4))-sqrt(DIV1hu4));
    h2u4=sqrt(p2parahu4*(louthu4+p2parahu4/4.0));
    pbhu4=l+louthu4+p2parahu4/4.0;
    pahu4=1.0/p2parahu4;
    dyhu4=uwallthick4*sin(atan(h1u4*2*pahu4));
    dzhu4=uwallthick4*cos(atan(h1u4*2*pahu4));
    DIV1huwt4=(l+louthu4-dzhu4)*(l+louthu4-dzhu4);
    p2parahuwt4=2.0*(sqrt(DIV1huwt4+((h1u4+dyhu4)*(h1u4+dyhu4)))-sqrt(DIV1huwt4));
    pbhuwt4=l+louthu4+p2parahuwt4/4.0;
    pahuwt4=1.0/p2parahuwt4;
    h2uwt4=sqrt(p2parahuwt4*(louthu4+p2parahuwt4/4.0));
    h1uwt4=sqrt(p2parahuwt4*(louthu4+l+p2parahuwt4/4.0));
   } 

if (linhu4!=0 && louthu4==0)
    {
      DIV1hu4=linhu4*linhu4;
      p2parahu4=2.0*(sqrt(DIV1hu4+(h1u4*h1u4))-sqrt(DIV1hu4));
      h2u4=sqrt(p2parahu4*(l+linhu4+p2parahu4/4.0));
      pbhu4=-(linhu4+p2parahu4/4.0);
      pahu4=-1.0/p2parahu4;
      dyhu4=uwallthick4*sin(atan(-h2u4*2*pahu4));
      dzhu4=uwallthick4*cos(atan(-h2u4*2*pahu4));
      DIV1huwt4=(linhu4+l-dzhu4)*(linhu4+l-dzhu4);
      p2parahuwt4=2.0*(sqrt(DIV1huwt4+((h2u4+dyhu4)*(h2u4+dyhu4)))-sqrt(DIV1huwt4));
      h1uwt4=sqrt(p2parahuwt4*(linhu4+p2parahuwt4/4.0));
      h2uwt4=sqrt(p2parahuwt4*(linhu4+l+p2parahuwt4/4.0));
      pbhuwt4=-(linhu4+p2parahuwt4/4.0);
      pahuwt4=-1.0/p2parahuwt4;
    }

if(linhu4==0 && louthu4==0){
    h1uwt4=h1u4+uwallthick4/(cos(atan((h2u4-h1u4)/l)));
    h2uwt4=h2u4+uwallthick4/(cos(atan((h2u4-h1u4)/l)));
    }


lbhd4=linhd4+l+louthd4;
z0hd4=lbhd4/2.0-l-louthd4;

if (linhd4 != 0 && louthd4 !=0)
   {
    u1hd4=sqrt((linhd4*linhd4)+(h1d4*h1d4));
    u2hd4=sqrt((h1d4*h1d4)+((l+louthd4)*(l+louthd4)));
    ahd4=(u1hd4+u2hd4)/2.0;
    bhd4=sqrt(ahd4*ahd4-(lbhd4*lbhd4/4.0));
    a2hd4=ahd4*ahd4;
    b2hd4=bhd4*bhd4;
    DIV1hd4=sqrt(1.0-((lbhd4/2.0-louthd4)*(lbhd4/2.0-louthd4)/a2hd4));
    h2d4=bhd4*DIV1hd4;
    if(l<lbhd4/21-louthd4){
        dyhd4=dwallthick4*sin(atan(a2hd4*h1d4/(b2hd4*z0hd4)));
        dzhd4=dwallthick4*cos(atan(a2hd4*h1d4/(b2hd4*z0hd4)));
    	u1hdwt4=sqrt(((linhd4+dzhd4)*(linhd4+dzhd4))+((h1d4+dyhd4)*(h1d4+dyhd4)));	
    	u2hdwt4=sqrt(((h1d4+dyhd4)*(h1d4+dyhd4))+((l+louthd4-dzhd4)*(l+louthd4-dzhd4)));
    	ahdwt4=(u1hdwt4+u2hdwt4)/2.0;
    	a2hdwt4=ahdwt4*ahdwt4;
    	bhdwt4=sqrt(a2hdwt4-(lbhd4*lbhd4/4.0));
    	b2hdwt4=bhdwt4*bhdwt4;
    	h2dwt4=bhdwt4*sqrt(1.0-((lbhd4/2.0-louthd4)*(lbhd4/2.0-louthd4)/a2hdwt4));
        h1dwt4=bhdwt4*sqrt(1.0-((lbhd4/2.0-louthd4-l)*(lbhd4/2.0-louthd4-l)/a2hdwt4));
    }else{
	bhdwt4=bhd4+dwallthick4;
        b2hdwt4=bhdwt4*bhdwt4;
        ahdwt4=sqrt(b2hdwt4+(lbhd4*lbhd4/4.0));
        a2hdwt4=b2hdwt4+(lbhd4*lbhd4/4.0);
        h2dwt4=bhdwt4*sqrt(1.0-((lbhd4/2.0-louthd4)*(lbhd4/2.0-louthd4)/a2hdwt4));
        h1dwt4=bhdwt4*sqrt(1.0-((lbhd4/2.0-linhd4)*(lbhd4/2.0-linhd4)/a2hdwt4));
    }
  }

if(linhd4==0 && louthd4!=0)
   {	
    DIV1hd4=(l+louthd4)*(l+louthd4);
    p2parahd4=2.0*(sqrt(DIV1hd4+(h1d4*h1d4))-sqrt(DIV1hd4));
    h2d4=sqrt(p2parahd4*(louthd4+p2parahd4/4.0));
    pbhd4=l+louthd4+p2parahd4/4.0;
    pahd4=1.0/p2parahd4;
    dyhd4=dwallthick4*sin(atan(h1d4*2*pahd4));
    dzhd4=dwallthick4*cos(atan(h1d4*2*pahd4));
    DIV1hdwt4=(l+louthd4-dzhd4)*(l+louthd4-dzhd4);
    p2parahdwt4=2.0*(sqrt(DIV1hdwt4+((h1d4+dyhd4)*(h1d4+dyhd4)))-sqrt(DIV1hdwt4));
    pbhdwt4=l+louthd4+p2parahdwt4/4.0;
    pahdwt4=1.0/p2parahdwt4;
    h2dwt4=sqrt(p2parahdwt4*(louthd4+p2parahdwt4/4.0));
    h1dwt4=sqrt(p2parahdwt4*(louthd4+l+p2parahdwt4/4.0));
   }

if (linhd4!=0 && louthd4==0)
    {
      DIV1hd4=linhd4*linhd4;
      p2parahd4=2.0*(sqrt(DIV1hd4+(h1d4*h1d4))-sqrt(DIV1hd4));
      h2d4=sqrt(p2parahd4*(l+linhd4+p2parahd4/4.0));
      pbhd4=-(linhd4+p2parahd4/4.0);
      pahd4=-1.0/p2parahd4;
      dyhd4=dwallthick4*sin(atan(-h2d4*2*pahd4));
      dzhd4=dwallthick4*cos(atan(-h2d4*2*pahd4));
      DIV1hdwt4=(linhd4+l-dzhd4)*(linhd4+l-dzhd4);
      p2parahdwt4=2.0*(sqrt(DIV1hdwt4+((h2d4+dyhd4)*(h2d4+dyhd4)))-sqrt(DIV1hdwt4));
      h1dwt4=sqrt(p2parahdwt4*(linhd4+p2parahdwt4/4.0));
      h2dwt4=sqrt(p2parahdwt4*(linhd4+l+p2parahdwt4/4.0));
      pbhdwt4=-(linhd4+p2parahdwt4/4.0);
      pahdwt4=-1.0/p2parahdwt4;
    }

if(linhd4==0 && louthd4==0){
    h1dwt4=h1d4+dwallthick4/(cos(atan((h2d4-h1d4)/l)));
    h2dwt4=h2d4+dwallthick4/(cos(atan((h2d4-h1d4)/l)));
    }



mru14=(h1uwt4-h1u4)/(w1r4-w1rwt4);
nru14=h1u4-mru14*(-w1r4);
mru24=(h2uwt4-h2u4)/(w2r4-w2rwt4);
nru24=h2u4-mru24*(-w2r4);

mrd14=(-h1dwt4+h1d4)/(w1r4-w1rwt4);
nrd14=-h1d4-mrd14*(-w1r4);
mrd24=(-h2dwt4+h2d4)/(w2r4-w2rwt4);
nrd24=-h2d4-mrd24*(-w2r4);

mlu14=(h1uwt4-h1u4)/(-w1l4+w1lwt4);
nlu14=h1u4-mlu14*w1l4;
mlu24=(h2uwt4-h2u4)/(-w2l4+w2lwt4);
nlu24=h2u4-mlu24*w2l4;

mld14=(-h1dwt4+h1d4)/(-w1l4+w1lwt4);
nld14=-h1d4-mld14*w1l4;
mld24=(-h2dwt4+h2d4)/(-w2l4+w2lwt4);
nld24=-h2d4-mld24*w2l4;



if (w1r4 < w1rwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r4 have to be bigger or equal w1rwt3 \n");
    printf(" w1r4= %f \n",w1r4 );
    printf(" w1rwt3= %f \n",w1rwt3 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l4 < w1lwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l4 have to be bigger or equal w1lwt3 \n");
    printf(" w1l4= %f \n",w1l4 );
    printf(" w1lwt3= %f \n",w1lwt3 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u4 < h1uwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u4 have to be bigger or equal h1uwt3 \n");
    printf(" h1u4= %f \n",h1u4 );
    printf(" h1uwt3= %f \n",h1uwt3 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d4 < h1dwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d4 have to be bigger or equal h1dwt3 \n");
    printf(" h1d4= %f \n",h1d4 );
    printf(" h1dwt3= %f \n",h1dwt3 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r4 < w2rwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r4 have to be bigger or equal w2rwt3 \n");
    printf(" w2r4= %f \n",w2r4 );
    printf(" w2rwt3= %f \n",w2rwt3 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l4 < w2lwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l4 have to be bigger or equal w2lwt3 \n");
    printf(" w2l4= %f \n",w2l4 );
    printf(" w2lwt3= %f \n",w2lwt3 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u4 < h2uwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u4 have to be bigger or equal h2uwt3 \n");
    printf(" h2u4= %f \n",h2u4 );
    printf(" h2uwt3= %f \n",h2uwt3 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d4 < h2dwt3)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d4 have to be bigger or equal h2dwt3 \n");
    printf(" h2d4= %f \n",h2d4 );
    printf(" h2dwt3= %f \n",h2dwt3 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }


lbwr5=linwr5+l+loutwr5;
z0wr5=(linwr5-l-loutwr5)/2.0;

if(loutwr5!=0 && linwr5!=0)
  { 
    u1wr5=sqrt((linwr5*linwr5)+(w1r5*w1r5));
    u2wr5=sqrt((w1r5*w1r5)+((l+loutwr5)*(l+loutwr5)));
    awr5=(u1wr5+u2wr5)/2.0;
    a2wr5=awr5*awr5;
    bwr5=sqrt(a2wr5-(lbwr5*lbwr5/4.0));
    b2wr5=bwr5*bwr5;
    DIV1wr5=sqrt(1.0-((lbwr5/2.0-loutwr5)*(lbwr5/2.0-loutwr5)/a2wr5));
    w2r5=bwr5*DIV1wr5;
    if(l<lbwr5/2-loutwr5){
        dxwr5=rwallthick5*sin(atan(a2wr5*w1r5/(b2wr5*z0wr5)));
        dzwr5=rwallthick5*cos(atan(a2wr5*w1r5/(b2wr5*z0wr5)));
    	u1wrwt5=sqrt(((linwr5+dzwr5)*(linwr5+dzwr5))+((w1r5+dxwr5)*(w1r5+dxwr5)));
    	u2wrwt5=sqrt(((w1r5+dxwr5)*(w1r5+dxwr5))+((l+loutwr5-dzwr5)*(l+loutwr5-dzwr5)));
    	awrwt5=(u1wrwt5+u2wrwt5)/2.0;
    	a2wrwt5=awrwt5*awrwt5;
    	bwrwt5=sqrt(a2wrwt5-(lbwr5*lbwr5/4.0));
    	b2wrwt5=bwrwt5*bwrwt5;
    	w2rwt5=bwrwt5*sqrt(1.0-((lbwr5/2.0-loutwr5)*(lbwr5/2.0-loutwr5)/a2wrwt5));
        w1rwt5=bwrwt5*sqrt(1.0-((lbwr5/2.0-loutwr5-l)*(lbwr5/2.0-loutwr5-l)/a2wrwt5));
    }else{
	bwrwt5=bwr5+rwallthick5;
        b2wrwt5=bwrwt5*bwrwt5;
        awrwt5=sqrt(b2wrwt5+(lbwr5*lbwr5/4.0));
        a2wrwt5=b2wrwt5+(lbwr5*lbwr5/4.0);
        w2rwt5=bwrwt5*sqrt(1.0-((lbwr5/2.0-loutwr5)*(lbwr5/2.0-loutwr5)/a2wrwt5));
        w1rwt5=bwrwt5*sqrt(1.0-((lbwr5/2.0-linwr5)*(lbwr5/2.0-linwr5)/a2wrwt5));
    }
   }



if(linwr5==0 && loutwr5!=0){
    DIV1wr5=(l+loutwr5)*(l+loutwr5);
    p2parawr5=2.0*(sqrt(DIV1wr5+(w1r5*w1r5))-sqrt(DIV1wr5));
    w2r5=sqrt(p2parawr5*(loutwr5+p2parawr5/4.0));
    pbwr5=l+loutwr5+p2parawr5/4.0;
    pawr5=1.0/p2parawr5;
    dxwr5=rwallthick5*sin(atan(w1r5*2*pawr5));
    dzwr5=rwallthick5*cos(atan(w1r5*2*pawr5));
    DIV1wrwt5=(l+loutwr5-dzwr5)*(l+loutwl5-dzwr5);
    p2parawrwt5=2.0*(sqrt(DIV1wrwt5+((w1r5+dxwr5)*(w1r5+dxwr5)))-sqrt(DIV1wrwt5));
    pbwrwt5=l+loutwr5+p2parawrwt5/4.0;
    pawrwt5=1.0/p2parawrwt5;
    w2rwt5=sqrt(p2parawrwt5*(loutwr5+p2parawrwt5/4.0));
    w1rwt5=sqrt(p2parawrwt5*(loutwr5+l+p2parawrwt5/4.0));
   }



if (linwr5!=0 && loutwr5==0)
    {
      DIV1wr5=linwr5*linwr5;
      p2parawr5=2.0*(sqrt(DIV1wr5+(w1r5*w1r5))-sqrt(DIV1wr5));
      w2r5=sqrt(p2parawr5*(l+linwr5+p2parawr5/4.0));
      pbwr5=-(linwr5+p2parawr5/4.0);
      pawr5=-1.0/p2parawr5;
      dxwr5=rwallthick5*sin(atan(-w2r5*2*pawr5));
      dzwr5=rwallthick5*cos(atan(-w2r5*2*pawr5));
      DIV1wrwt5=(linwr5+l-dzwr5)*(linwr5+l-dzwr5);
      p2parawrwt5=2.0*(sqrt(DIV1wrwt5+((w2r5+dxwr5)*(w2r5+dxwr5)))-sqrt(DIV1wrwt5));
      w1rwt5=sqrt(p2parawrwt5*(linwr5+p2parawrwt5/4.0));
      w2rwt5=sqrt(p2parawrwt5*(linwr5+l+p2parawrwt5/4.0));
      pbwrwt5=-(linwr5+p2parawrwt5/4.0);
      pawrwt5=-1.0/p2parawrwt5;
    }


if(linwr5==0 && loutwr5==0){
    w1rwt5=w1r5+rwallthick5/(cos(atan((w1r5-w2r5)/l)));
    w2rwt5=w2r5+rwallthick5/(cos(atan((w1r5-w2r5)/l)));
    }

lbwl5=linwl5+l+loutwl5;
z0wl5=(linwl5-l-loutwl5)/2.0;

if((linwl5!=0) && (loutwl5!=0) ) 
  { 
    u1wl5=sqrt((linwl5*linwl5)+(w1l5*w1l5));
    u2wl5=sqrt((w1l5*w1l5)+((l+loutwl5)*(l+loutwl5)));
    awl5=(u1wl5+u2wl5)/2.0;
    a2wl5=awl5*awl5;
    bwl5=sqrt(a2wl5-(lbwl5*lbwl5/4.0));
    b2wl5=bwl5*bwl5;
    DIV1wl5=sqrt(1.0-((lbwl5/2.0-loutwl5)*(lbwl5/2.0-loutwl5)/a2wl5));
    w2l5=bwl5*DIV1wl5;
    if(l<lbwl5/2-loutwl5){
        dxwl5=lwallthick5*sin(atan(a2wl5*w1l5/(b2wl5*z0wl5)));
        dzwl5=lwallthick5*cos(atan(a2wl5*w1l5/(b2wl5*z0wl5)));
    	u1wlwt5=sqrt(((linwl5+dzwl5)*(linwl5+dzwl5))+((w1l5+dxwl5)*(w1l5+dxwl5)));								
    	u2wlwt5=sqrt(((w1l5+dxwl5)*(w1l5+dxwl5))+((l+loutwl5-dzwl5)*(l+loutwl5-dzwl5)));	
    	awlwt5=(u1wlwt5+u2wlwt5)/2.0;
    	a2wlwt5=awlwt5*awlwt5;
    	bwlwt5=sqrt(a2wlwt5-(lbwl5*lbwl5/4.0));
    	b2wlwt5=bwlwt5*bwlwt5;
    	w2lwt5=bwlwt5*sqrt(1.0-((lbwl5/2.0-loutwl5)*(lbwl5/2.0-loutwl5)/a2wlwt5));
        w1lwt5=bwlwt5*sqrt(1.0-((lbwl5/2.0-loutwl5-l)*(lbwl5/2.0-loutwl5-l)/a2wlwt5));
    }else{
	bwlwt5=bwl5+lwallthick5;
        b2wlwt5=bwlwt5*bwlwt5;
        awlwt5=sqrt(b2wlwt5+(lbwl5*lbwl5/4.0));
        a2wlwt5=b2wlwt5+(lbwl5*lbwl5/4.0);
        w2lwt5=bwlwt5*sqrt(1.0-((lbwl5/2.0-loutwl5)*(lbwl5/2.0-loutwl5)/a2wlwt5));
        w1lwt5=bwlwt5*sqrt(1.0-((lbwl5/2.0-linwl5)*(lbwl5/2.0-linwl5)/a2wlwt5));
    }
   }


if(linwl5==0 && loutwl5!=0)
   {
    DIV1wl5=(l+loutwl5)*(l+loutwl5);
    p2parawl5=2.0*(sqrt(DIV1wl5+(w1l5*w1l5))-sqrt(DIV1wl5));
    w2l5=sqrt(p2parawl5*(loutwl5+p2parawl5/4.0));
    pbwl5=l+loutwl5+p2parawl5/4.0;
    pawl5=1.0/p2parawl5;
    dxwl5=lwallthick5*sin(atan(w1l5*2*pawl5));
    dzwl5=lwallthick5*cos(atan(w1l5*2*pawl5));
    DIV1wlwt5=(l+loutwl5-dzwl5)*(l+loutwl5-dzwl5);
    p2parawlwt5=2.0*(sqrt(DIV1wlwt5+((w1l5+dxwl5)*(w1l5+dxwl5)))-sqrt(DIV1wlwt5));
    pbwlwt5=l+loutwl5+p2parawlwt5/4.0;
    pawlwt5=1.0/p2parawlwt5;
    w2lwt5=sqrt(p2parawlwt5*(loutwl5+p2parawlwt5/4.0));
    w1lwt5=sqrt(p2parawlwt5*(loutwl5+l+p2parawlwt5/4.0));
   }

if (linwl5!=0 && loutwl5==0)
    {
      DIV1wl5=linwl5*linwl5;
      p2parawl5=2.0*(sqrt(DIV1wl5+(w1l5*w1l5))-sqrt(DIV1wl5));
      w2l5=sqrt(p2parawl5*(l+linwl5+p2parawl5/4.0));
      pbwl5=-(linwl5+p2parawl5/4.0);
      pawl5=-1.0/p2parawl5;
      dxwl5=lwallthick5*sin(atan(-w2l5*2*pawl5));
      dzwl5=lwallthick5*cos(atan(-w2l5*2*pawl5));
      DIV1wlwt5=(linwl5+l-dzwl5)*(linwl5+l-dzwl5);
      p2parawlwt5=2.0*(sqrt(DIV1wlwt5+((w2l5+dxwl5)*(w2l5+dxwl5)))-sqrt(DIV1wlwt5));
      w1lwt5=sqrt(p2parawlwt5*(linwl5+p2parawlwt5/4.0));
      w2lwt5=sqrt(p2parawlwt5*(linwl5+l+p2parawlwt5/4.0));
      pbwlwt5=-(linwl5+p2parawlwt5/4.0);
      pawlwt5=-1.0/p2parawlwt5;
    }

if(linwl5==0 && loutwl5==0){
    w1lwt5=w1l5+lwallthick5/(cos(atan((w2l5-w1l5)/l)));
    w2lwt5=w2l5+lwallthick5/(cos(atan((w2l5-w1l5)/l)));
    }


lbhu5=linhu5+l+louthu5;
z0hu5=lbhu5/2.0-l-louthu5;	

if (linhu5 != 0 && louthu5 !=0)
   {
    u1hu5=sqrt((linhu5*linhu5)+(h1u5*h1u5));
    u2hu5=sqrt((h1u5*h1u5)+((l+louthu5)*(l+louthu5)));
    ahu5=(u1hu5+u2hu5)/2.0;
    bhu5=sqrt(ahu5*ahu5-(lbhu5*lbhu5/4.0));
    a2hu5=ahu5*ahu5;
    b2hu5=bhu5*bhu5;
    DIV1hu5=sqrt(1.0-((lbhu5/2.0-louthu5)*(lbhu5/2.0-louthu5)/a2hu5));
    h2u5=bhu5*DIV1hu5;
    if(l<lbhu5/2-louthu5){
        dyhu5=uwallthick5*sin(atan(a2hu5*h1u5/(b2hu5*z0hu5)));
        dzhu5=uwallthick5*cos(atan(a2hu5*h1u5/(b2hu5*z0hu5)));
    	u1huwt5=sqrt(((linhu5+dzhu5)*(linhu5+dzhu5))+((h1u5+dyhu5)*(h1u5+dyhu5)));								
    	u2huwt5=sqrt(((h1u5+dyhu5)*(h1u5+dyhu5))+((l+louthu5-dzhu5)*(l+louthu5-dzhu5)));	
    	ahuwt5=(u1huwt5+u2huwt5)/2.0;
    	a2huwt5=ahuwt5*ahuwt5;
    	bhuwt5=sqrt(a2huwt5-(lbhu5*lbhu5/4.0));
    	b2huwt5=bhuwt5*bhuwt5;
    	h2uwt5=bhuwt5*sqrt(1.0-((lbhu5/2.0-louthu5)*(lbhu5/2.0-louthu5)/a2huwt5));
        h1uwt5=bhuwt5*sqrt(1.0-((lbhu5/2.0-louthu5-l)*(lbhu5/2.0-louthu5-l)/a2huwt5));
    }else{
	bhuwt5=bhu5+uwallthick5;
        b2huwt5=bhuwt5*bhuwt5;
        ahuwt5=sqrt(b2huwt5+(lbhu5*lbhu5/4.0));
        a2huwt5=b2huwt5+(lbhu5*lbhu5/4.0);
        h2uwt5=bhuwt5*sqrt(1.0-((lbhu5/2.0-louthu5)*(lbhu5/2.0-louthu5)/a2huwt5));
        h1uwt5=bhuwt5*sqrt(1.0-((lbhu5/2.0-linhu5)*(lbhu5/2.0-linhu5)/a2huwt5));
    }
  }

if(linhu5==0 && louthu5!=0)
   { 	
    DIV1hu5=(l+louthu5)*(l+louthu5);
    p2parahu5=2.0*(sqrt(DIV1hu5+(h1u5*h1u5))-sqrt(DIV1hu5));
    h2u5=sqrt(p2parahu5*(louthu5+p2parahu5/4.0));
    pbhu5=l+louthu5+p2parahu5/4.0;
    pahu5=1.0/p2parahu5;
    dyhu5=uwallthick5*sin(atan(h1u5*2*pahu5));
    dzhu5=uwallthick5*cos(atan(h1u5*2*pahu5));
    DIV1huwt5=(l+louthu5-dzhu5)*(l+louthu5-dzhu5);
    p2parahuwt5=2.0*(sqrt(DIV1huwt5+((h1u5+dyhu5)*(h1u5+dyhu5)))-sqrt(DIV1huwt5));
    pbhuwt5=l+louthu5+p2parahuwt5/4.0;
    pahuwt5=1.0/p2parahuwt5;
    h2uwt5=sqrt(p2parahuwt5*(louthu5+p2parahuwt5/4.0));
    h1uwt5=sqrt(p2parahuwt5*(louthu5+l+p2parahuwt5/4.0));
   } 

if (linhu5!=0 && louthu5==0)
    {
      DIV1hu5=linhu5*linhu5;
      p2parahu5=2.0*(sqrt(DIV1hu5+(h1u5*h1u5))-sqrt(DIV1hu5));
      h2u5=sqrt(p2parahu5*(l+linhu5+p2parahu5/4.0));
      pbhu5=-(linhu5+p2parahu5/4.0);
      pahu5=-1.0/p2parahu5;
      dyhu5=uwallthick5*sin(atan(-h2u5*2*pahu5));
      dzhu5=uwallthick5*cos(atan(-h2u5*2*pahu5));
      DIV1huwt5=(linhu5+l-dzhu5)*(linhu5+l-dzhu5);
      p2parahuwt5=2.0*(sqrt(DIV1huwt5+((h2u5+dyhu5)*(h2u5+dyhu5)))-sqrt(DIV1huwt5));
      h1uwt5=sqrt(p2parahuwt5*(linhu5+p2parahuwt5/4.0));
      h2uwt5=sqrt(p2parahuwt5*(linhu5+l+p2parahuwt5/4.0));
      pbhuwt5=-(linhu5+p2parahuwt5/4.0);
      pahuwt5=-1.0/p2parahuwt5;
    }

if(linhu5==0 && louthu5==0){
    h1uwt5=h1u5+uwallthick5/(cos(atan((h2u5-h1u5)/l)));
    h2uwt5=h2u5+uwallthick5/(cos(atan((h2u5-h1u5)/l)));
    }


lbhd5=linhd5+l+louthd5;
z0hd5=lbhd5/2.0-l-louthd5;

if (linhd5 != 0 && louthd5 !=0)
   {
    u1hd5=sqrt((linhd5*linhd5)+(h1d5*h1d5));
    u2hd5=sqrt((h1d5*h1d5)+((l+louthd5)*(l+louthd5)));
    ahd5=(u1hd5+u2hd5)/2.0;
    bhd5=sqrt(ahd5*ahd5-(lbhd5*lbhd5/4.0));
    a2hd5=ahd5*ahd5;
    b2hd5=bhd5*bhd5;
    DIV1hd5=sqrt(1.0-((lbhd5/2.0-louthd5)*(lbhd5/2.0-louthd5)/a2hd5));
    h2d5=bhd5*DIV1hd5;
    if(l<lbhd5/21-louthd5){
        dyhd5=dwallthick5*sin(atan(a2hd5*h1d5/(b2hd5*z0hd5)));
        dzhd5=dwallthick5*cos(atan(a2hd5*h1d5/(b2hd5*z0hd5)));
    	u1hdwt5=sqrt(((linhd5+dzhd5)*(linhd5+dzhd5))+((h1d5+dyhd5)*(h1d5+dyhd5)));	
    	u2hdwt5=sqrt(((h1d5+dyhd5)*(h1d5+dyhd5))+((l+louthd5-dzhd5)*(l+louthd5-dzhd5)));
    	ahdwt5=(u1hdwt5+u2hdwt5)/2.0;
    	a2hdwt5=ahdwt5*ahdwt5;
    	bhdwt5=sqrt(a2hdwt5-(lbhd5*lbhd5/4.0));
    	b2hdwt5=bhdwt5*bhdwt5;
    	h2dwt5=bhdwt5*sqrt(1.0-((lbhd5/2.0-louthd5)*(lbhd5/2.0-louthd5)/a2hdwt5));
        h1dwt5=bhdwt5*sqrt(1.0-((lbhd5/2.0-louthd5-l)*(lbhd5/2.0-louthd5-l)/a2hdwt5));
    }else{
	bhdwt5=bhd5+dwallthick5;
        b2hdwt5=bhdwt5*bhdwt5;
        ahdwt5=sqrt(b2hdwt5+(lbhd5*lbhd5/4.0));
        a2hdwt5=b2hdwt5+(lbhd5*lbhd5/4.0);
        h2dwt5=bhdwt5*sqrt(1.0-((lbhd5/2.0-louthd5)*(lbhd5/2.0-louthd5)/a2hdwt5));
        h1dwt5=bhdwt5*sqrt(1.0-((lbhd5/2.0-linhd5)*(lbhd5/2.0-linhd5)/a2hdwt5));
    }
  }

if(linhd5==0 && louthd5!=0)
   {	
    DIV1hd5=(l+louthd5)*(l+louthd5);
    p2parahd5=2.0*(sqrt(DIV1hd5+(h1d5*h1d5))-sqrt(DIV1hd5));
    h2d5=sqrt(p2parahd5*(louthd5+p2parahd5/4.0));
    pbhd5=l+louthd5+p2parahd5/4.0;
    pahd5=1.0/p2parahd5;
    dyhd5=dwallthick5*sin(atan(h1d5*2*pahd5));
    dzhd5=dwallthick5*cos(atan(h1d5*2*pahd5));
    DIV1hdwt5=(l+louthd5-dzhd5)*(l+louthd5-dzhd5);
    p2parahdwt5=2.0*(sqrt(DIV1hdwt5+((h1d5+dyhd5)*(h1d5+dyhd5)))-sqrt(DIV1hdwt5));
    pbhdwt5=l+louthd5+p2parahdwt5/4.0;
    pahdwt5=1.0/p2parahdwt5;
    h2dwt5=sqrt(p2parahdwt5*(louthd5+p2parahdwt5/4.0));
    h1dwt5=sqrt(p2parahdwt5*(louthd5+l+p2parahdwt5/4.0));
   }

if (linhd5!=0 && louthd5==0)
    {
      DIV1hd5=linhd5*linhd5;
      p2parahd5=2.0*(sqrt(DIV1hd5+(h1d5*h1d5))-sqrt(DIV1hd5));
      h2d5=sqrt(p2parahd5*(l+linhd5+p2parahd5/4.0));
      pbhd5=-(linhd5+p2parahd5/4.0);
      pahd5=-1.0/p2parahd5;
      dyhd5=dwallthick5*sin(atan(-h2d5*2*pahd5));
      dzhd5=dwallthick5*cos(atan(-h2d5*2*pahd5));
      DIV1hdwt5=(linhd5+l-dzhd5)*(linhd5+l-dzhd5);
      p2parahdwt5=2.0*(sqrt(DIV1hdwt5+((h2d5+dyhd5)*(h2d5+dyhd5)))-sqrt(DIV1hdwt5));
      h1dwt5=sqrt(p2parahdwt5*(linhd5+p2parahdwt5/4.0));
      h2dwt5=sqrt(p2parahdwt5*(linhd5+l+p2parahdwt5/4.0));
      pbhdwt5=-(linhd5+p2parahdwt5/4.0);
      pahdwt5=-1.0/p2parahdwt5;
    }

if(linhd5==0 && louthd5==0){
    h1dwt5=h1d5+dwallthick5/(cos(atan((h2d5-h1d5)/l)));
    h2dwt5=h2d5+dwallthick5/(cos(atan((h2d5-h1d5)/l)));
    }



mru15=(h1uwt5-h1u5)/(w1r5-w1rwt5);
nru15=h1u5-mru15*(-w1r5);
mru25=(h2uwt5-h2u5)/(w2r5-w2rwt5);
nru25=h2u5-mru25*(-w2r5);

mrd15=(-h1dwt5+h1d5)/(w1r5-w1rwt5);
nrd15=-h1d5-mrd15*(-w1r5);
mrd25=(-h2dwt5+h2d5)/(w2r5-w2rwt5);
nrd25=-h2d5-mrd25*(-w2r5);

mlu15=(h1uwt5-h1u5)/(-w1l5+w1lwt5);
nlu15=h1u5-mlu15*w1l5;
mlu25=(h2uwt5-h2u5)/(-w2l5+w2lwt5);
nlu25=h2u5-mlu25*w2l5;

mld15=(-h1dwt5+h1d5)/(-w1l5+w1lwt5);
nld15=-h1d5-mld15*w1l5;
mld25=(-h2dwt5+h2d5)/(-w2l5+w2lwt5);
nld25=-h2d5-mld25*w2l5;



if (w1r5 < w1rwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r5 have to be bigger or equal w1rwt4 \n");
    printf(" w1r5= %f \n",w1r5 );
    printf(" w1rwt4= %f \n",w1rwt4 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l5 < w1lwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l5 have to be bigger or equal w1lwt4 \n");
    printf(" w1l5= %f \n",w1l5 );
    printf(" w1lwt4= %f \n",w1lwt4 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u5 < h1uwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u5 have to be bigger or equal h1uwt4 \n");
    printf(" h1u5= %f \n",h1u5 );
    printf(" h1uwt4= %f \n",h1uwt4 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d5 < h1dwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d5 have to be bigger or equal h1dwt4 \n");
    printf(" h1d5= %f \n",h1d5 );
    printf(" h1dwt4= %f \n",h1dwt4 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r5 < w2rwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r5 have to be bigger or equal w2rwt4 \n");
    printf(" w2r5= %f \n",w2r5 );
    printf(" w2rwt4= %f \n",w2rwt4 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l5 < w2lwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l5 have to be bigger or equal w2lwt4 \n");
    printf(" w2l5= %f \n",w2l5 );
    printf(" w2lwt4= %f \n",w2lwt4 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u5 < h2uwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u5 have to be bigger or equal h2uwt4 \n");
    printf(" h2u5= %f \n",h2u5 );
    printf(" h2uwt4= %f \n",h2uwt4 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d5 < h2dwt4)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d5 have to be bigger or equal h2dwt4 \n");
    printf(" h2d5= %f \n",h2d5 );
    printf(" h2dwt4= %f \n",h2dwt4 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }



lbwr6=linwr6+l+loutwr6;
z0wr6=(linwr6-l-loutwr6)/2.0;

if(loutwr6!=0 && linwr6!=0)
  { 
    u1wr6=sqrt((linwr6*linwr6)+(w1r6*w1r6));
    u2wr6=sqrt((w1r6*w1r6)+((l+loutwr6)*(l+loutwr6)));
    awr6=(u1wr6+u2wr6)/2.0;
    a2wr6=awr6*awr6;
    bwr6=sqrt(a2wr6-(lbwr6*lbwr6/4.0));
    b2wr6=bwr6*bwr6;
    DIV1wr6=sqrt(1.0-((lbwr6/2.0-loutwr6)*(lbwr6/2.0-loutwr6)/a2wr6));
    w2r6=bwr6*DIV1wr6;
    if(l<lbwr6/2-loutwr6){
        dxwr6=rwallthick6*sin(atan(a2wr6*w1r6/(b2wr6*z0wr6)));
        dzwr6=rwallthick6*cos(atan(a2wr6*w1r6/(b2wr6*z0wr6)));
    	u1wrwt6=sqrt(((linwr6+dzwr6)*(linwr6+dzwr6))+((w1r6+dxwr6)*(w1r6+dxwr6)));
    	u2wrwt6=sqrt(((w1r6+dxwr6)*(w1r6+dxwr6))+((l+loutwr6-dzwr6)*(l+loutwr6-dzwr6)));
    	awrwt6=(u1wrwt6+u2wrwt6)/2.0;
    	a2wrwt6=awrwt6*awrwt6;
    	bwrwt6=sqrt(a2wrwt6-(lbwr6*lbwr6/4.0));
    	b2wrwt6=bwrwt6*bwrwt6;
    	w2rwt6=bwrwt6*sqrt(1.0-((lbwr6/2.0-loutwr6)*(lbwr6/2.0-loutwr6)/a2wrwt6));
        w1rwt6=bwrwt6*sqrt(1.0-((lbwr6/2.0-loutwr6-l)*(lbwr6/2.0-loutwr6-l)/a2wrwt6));
    }else{
	bwrwt6=bwr6+rwallthick6;
        b2wrwt6=bwrwt6*bwrwt6;
        awrwt6=sqrt(b2wrwt6+(lbwr6*lbwr6/4.0));
        a2wrwt6=b2wrwt6+(lbwr6*lbwr6/4.0);
        w2rwt6=bwrwt6*sqrt(1.0-((lbwr6/2.0-loutwr6)*(lbwr6/2.0-loutwr6)/a2wrwt6));
        w1rwt6=bwrwt6*sqrt(1.0-((lbwr6/2.0-linwr6)*(lbwr6/2.0-linwr6)/a2wrwt6));
    }
   }



if(linwr6==0 && loutwr6!=0){
    DIV1wr6=(l+loutwr6)*(l+loutwr6);
    p2parawr6=2.0*(sqrt(DIV1wr6+(w1r6*w1r6))-sqrt(DIV1wr6));
    w2r6=sqrt(p2parawr6*(loutwr6+p2parawr6/4.0));
    pbwr6=l+loutwr6+p2parawr6/4.0;
    pawr6=1.0/p2parawr6;
    dxwr6=rwallthick6*sin(atan(w1r6*2*pawr6));
    dzwr6=rwallthick6*cos(atan(w1r6*2*pawr6));
    DIV1wrwt6=(l+loutwr6-dzwr6)*(l+loutwl6-dzwr6);
    p2parawrwt6=2.0*(sqrt(DIV1wrwt6+((w1r6+dxwr6)*(w1r6+dxwr6)))-sqrt(DIV1wrwt6));
    pbwrwt6=l+loutwr6+p2parawrwt6/4.0;
    pawrwt6=1.0/p2parawrwt6;
    w2rwt6=sqrt(p2parawrwt6*(loutwr6+p2parawrwt6/4.0));
    w1rwt6=sqrt(p2parawrwt6*(loutwr6+l+p2parawrwt6/4.0));
   }



if (linwr6!=0 && loutwr6==0)
    {
      DIV1wr6=linwr6*linwr6;
      p2parawr6=2.0*(sqrt(DIV1wr6+(w1r6*w1r6))-sqrt(DIV1wr6));
      w2r6=sqrt(p2parawr6*(l+linwr6+p2parawr6/4.0));
      pbwr6=-(linwr6+p2parawr6/4.0);
      pawr6=-1.0/p2parawr6;
      dxwr6=rwallthick6*sin(atan(-w2r6*2*pawr6));
      dzwr6=rwallthick6*cos(atan(-w2r6*2*pawr6));
      DIV1wrwt6=(linwr6+l-dzwr6)*(linwr6+l-dzwr6);
      p2parawrwt6=2.0*(sqrt(DIV1wrwt6+((w2r6+dxwr6)*(w2r6+dxwr6)))-sqrt(DIV1wrwt6));
      w1rwt6=sqrt(p2parawrwt6*(linwr6+p2parawrwt6/4.0));
      w2rwt6=sqrt(p2parawrwt6*(linwr6+l+p2parawrwt6/4.0));
      pbwrwt6=-(linwr6+p2parawrwt6/4.0);
      pawrwt6=-1.0/p2parawrwt6;
    }


if(linwr6==0 && loutwr6==0){
    w1rwt6=w1r6+rwallthick6/(cos(atan((w1r6-w2r6)/l)));
    w2rwt6=w2r6+rwallthick6/(cos(atan((w1r6-w2r6)/l)));
    }

lbwl6=linwl6+l+loutwl6;
z0wl6=(linwl6-l-loutwl6)/2.0;

if((linwl6!=0) && (loutwl6!=0) ) 
  { 
    u1wl6=sqrt((linwl6*linwl6)+(w1l6*w1l6));
    u2wl6=sqrt((w1l6*w1l6)+((l+loutwl6)*(l+loutwl6)));
    awl6=(u1wl6+u2wl6)/2.0;
    a2wl6=awl6*awl6;
    bwl6=sqrt(a2wl6-(lbwl6*lbwl6/4.0));
    b2wl6=bwl6*bwl6;
    DIV1wl6=sqrt(1.0-((lbwl6/2.0-loutwl6)*(lbwl6/2.0-loutwl6)/a2wl6));
    w2l6=bwl6*DIV1wl6;
    if(l<lbwl6/2-loutwl6){
        dxwl6=lwallthick6*sin(atan(a2wl6*w1l6/(b2wl6*z0wl6)));
        dzwl6=lwallthick6*cos(atan(a2wl6*w1l6/(b2wl6*z0wl6)));
    	u1wlwt6=sqrt(((linwl6+dzwl6)*(linwl6+dzwl6))+((w1l6+dxwl6)*(w1l6+dxwl6)));								
    	u2wlwt6=sqrt(((w1l6+dxwl6)*(w1l6+dxwl6))+((l+loutwl6-dzwl6)*(l+loutwl6-dzwl6)));	
    	awlwt6=(u1wlwt6+u2wlwt6)/2.0;
    	a2wlwt6=awlwt6*awlwt6;
    	bwlwt6=sqrt(a2wlwt6-(lbwl6*lbwl6/4.0));
    	b2wlwt6=bwlwt6*bwlwt6;
    	w2lwt6=bwlwt6*sqrt(1.0-((lbwl6/2.0-loutwl6)*(lbwl6/2.0-loutwl6)/a2wlwt6));
        w1lwt6=bwlwt6*sqrt(1.0-((lbwl6/2.0-loutwl6-l)*(lbwl6/2.0-loutwl6-l)/a2wlwt6));
    }else{
	bwlwt6=bwl6+lwallthick6;
        b2wlwt6=bwlwt6*bwlwt6;
        awlwt6=sqrt(b2wlwt6+(lbwl6*lbwl6/4.0));
        a2wlwt6=b2wlwt6+(lbwl6*lbwl6/4.0);
        w2lwt6=bwlwt6*sqrt(1.0-((lbwl6/2.0-loutwl6)*(lbwl6/2.0-loutwl6)/a2wlwt6));
        w1lwt6=bwlwt6*sqrt(1.0-((lbwl6/2.0-linwl6)*(lbwl6/2.0-linwl6)/a2wlwt6));
    }
   }


if(linwl6==0 && loutwl6!=0)
   {
    DIV1wl6=(l+loutwl6)*(l+loutwl6);
    p2parawl6=2.0*(sqrt(DIV1wl6+(w1l6*w1l6))-sqrt(DIV1wl6));
    w2l6=sqrt(p2parawl6*(loutwl6+p2parawl6/4.0));
    pbwl6=l+loutwl6+p2parawl6/4.0;
    pawl6=1.0/p2parawl6;
    dxwl6=lwallthick6*sin(atan(w1l6*2*pawl6));
    dzwl6=lwallthick6*cos(atan(w1l6*2*pawl6));
    DIV1wlwt6=(l+loutwl6-dzwl6)*(l+loutwl6-dzwl6);
    p2parawlwt6=2.0*(sqrt(DIV1wlwt6+((w1l6+dxwl6)*(w1l6+dxwl6)))-sqrt(DIV1wlwt6));
    pbwlwt6=l+loutwl6+p2parawlwt6/4.0;
    pawlwt6=1.0/p2parawlwt6;
    w2lwt6=sqrt(p2parawlwt6*(loutwl6+p2parawlwt6/4.0));
    w1lwt6=sqrt(p2parawlwt6*(loutwl6+l+p2parawlwt6/4.0));
   }

if (linwl6!=0 && loutwl6==0)
    {
      DIV1wl6=linwl6*linwl6;
      p2parawl6=2.0*(sqrt(DIV1wl6+(w1l6*w1l6))-sqrt(DIV1wl6));
      w2l6=sqrt(p2parawl6*(l+linwl6+p2parawl6/4.0));
      pbwl6=-(linwl6+p2parawl6/4.0);
      pawl6=-1.0/p2parawl6;
      dxwl6=lwallthick6*sin(atan(-w2l6*2*pawl6));
      dzwl6=lwallthick6*cos(atan(-w2l6*2*pawl6));
      DIV1wlwt6=(linwl6+l-dzwl6)*(linwl6+l-dzwl6);
      p2parawlwt6=2.0*(sqrt(DIV1wlwt6+((w2l6+dxwl6)*(w2l6+dxwl6)))-sqrt(DIV1wlwt6));
      w1lwt6=sqrt(p2parawlwt6*(linwl6+p2parawlwt6/4.0));
      w2lwt6=sqrt(p2parawlwt6*(linwl6+l+p2parawlwt6/4.0));
      pbwlwt6=-(linwl6+p2parawlwt6/4.0);
      pawlwt6=-1.0/p2parawlwt6;
    }

if(linwl6==0 && loutwl6==0){
    w1lwt6=w1l6+lwallthick6/(cos(atan((w2l6-w1l6)/l)));
    w2lwt6=w2l6+lwallthick6/(cos(atan((w2l6-w1l6)/l)));
    }


lbhu6=linhu6+l+louthu6;
z0hu6=lbhu6/2.0-l-louthu6;	

if (linhu6 != 0 && louthu6 !=0)
   {
    u1hu6=sqrt((linhu6*linhu6)+(h1u6*h1u6));
    u2hu6=sqrt((h1u6*h1u6)+((l+louthu6)*(l+louthu6)));
    ahu6=(u1hu6+u2hu6)/2.0;
    bhu6=sqrt(ahu6*ahu6-(lbhu6*lbhu6/4.0));
    a2hu6=ahu6*ahu6;
    b2hu6=bhu6*bhu6;
    DIV1hu6=sqrt(1.0-((lbhu6/2.0-louthu6)*(lbhu6/2.0-louthu6)/a2hu6));
    h2u6=bhu6*DIV1hu6;
    if(l<lbhu6/2-louthu6){
        dyhu6=uwallthick6*sin(atan(a2hu6*h1u6/(b2hu6*z0hu6)));
        dzhu6=uwallthick6*cos(atan(a2hu6*h1u6/(b2hu6*z0hu6)));
    	u1huwt6=sqrt(((linhu6+dzhu6)*(linhu6+dzhu6))+((h1u6+dyhu6)*(h1u6+dyhu6)));								
    	u2huwt6=sqrt(((h1u6+dyhu6)*(h1u6+dyhu6))+((l+louthu6-dzhu6)*(l+louthu6-dzhu6)));	
    	ahuwt6=(u1huwt6+u2huwt6)/2.0;
    	a2huwt6=ahuwt6*ahuwt6;
    	bhuwt6=sqrt(a2huwt6-(lbhu6*lbhu6/4.0));
    	b2huwt6=bhuwt6*bhuwt6;
    	h2uwt6=bhuwt6*sqrt(1.0-((lbhu6/2.0-louthu6)*(lbhu6/2.0-louthu6)/a2huwt6));
        h1uwt6=bhuwt6*sqrt(1.0-((lbhu6/2.0-louthu6-l)*(lbhu6/2.0-louthu6-l)/a2huwt6));
    }else{
	bhuwt6=bhu6+uwallthick6;
        b2huwt6=bhuwt6*bhuwt6;
        ahuwt6=sqrt(b2huwt6+(lbhu6*lbhu6/4.0));
        a2huwt6=b2huwt6+(lbhu6*lbhu6/4.0);
        h2uwt6=bhuwt6*sqrt(1.0-((lbhu6/2.0-louthu6)*(lbhu6/2.0-louthu6)/a2huwt6));
        h1uwt6=bhuwt6*sqrt(1.0-((lbhu6/2.0-linhu6)*(lbhu6/2.0-linhu6)/a2huwt6));
    }
  }

if(linhu6==0 && louthu6!=0)
   { 	
    DIV1hu6=(l+louthu6)*(l+louthu6);
    p2parahu6=2.0*(sqrt(DIV1hu6+(h1u6*h1u6))-sqrt(DIV1hu6));
    h2u6=sqrt(p2parahu6*(louthu6+p2parahu6/4.0));
    pbhu6=l+louthu6+p2parahu6/4.0;
    pahu6=1.0/p2parahu6;
    dyhu6=uwallthick6*sin(atan(h1u6*2*pahu6));
    dzhu6=uwallthick6*cos(atan(h1u6*2*pahu6));
    DIV1huwt6=(l+louthu6-dzhu6)*(l+louthu6-dzhu6);
    p2parahuwt6=2.0*(sqrt(DIV1huwt6+((h1u6+dyhu6)*(h1u6+dyhu6)))-sqrt(DIV1huwt6));
    pbhuwt6=l+louthu6+p2parahuwt6/4.0;
    pahuwt6=1.0/p2parahuwt6;
    h2uwt6=sqrt(p2parahuwt6*(louthu6+p2parahuwt6/4.0));
    h1uwt6=sqrt(p2parahuwt6*(louthu6+l+p2parahuwt6/4.0));
   } 

if (linhu6!=0 && louthu6==0)
    {
      DIV1hu6=linhu6*linhu6;
      p2parahu6=2.0*(sqrt(DIV1hu6+(h1u6*h1u6))-sqrt(DIV1hu6));
      h2u6=sqrt(p2parahu6*(l+linhu6+p2parahu6/4.0));
      pbhu6=-(linhu6+p2parahu6/4.0);
      pahu6=-1.0/p2parahu6;
      dyhu6=uwallthick6*sin(atan(-h2u6*2*pahu6));
      dzhu6=uwallthick6*cos(atan(-h2u6*2*pahu6));
      DIV1huwt6=(linhu6+l-dzhu6)*(linhu6+l-dzhu6);
      p2parahuwt6=2.0*(sqrt(DIV1huwt6+((h2u6+dyhu6)*(h2u6+dyhu6)))-sqrt(DIV1huwt6));
      h1uwt6=sqrt(p2parahuwt6*(linhu6+p2parahuwt6/4.0));
      h2uwt6=sqrt(p2parahuwt6*(linhu6+l+p2parahuwt6/4.0));
      pbhuwt6=-(linhu6+p2parahuwt6/4.0);
      pahuwt6=-1.0/p2parahuwt6;
    }

if(linhu6==0 && louthu6==0){
    h1uwt6=h1u6+uwallthick6/(cos(atan((h2u6-h1u6)/l)));
    h2uwt6=h2u6+uwallthick6/(cos(atan((h2u6-h1u6)/l)));
    }


lbhd6=linhd6+l+louthd6;
z0hd6=lbhd6/2.0-l-louthd6;

if (linhd6 != 0 && louthd6 !=0)
   {
    u1hd6=sqrt((linhd6*linhd6)+(h1d6*h1d6));
    u2hd6=sqrt((h1d6*h1d6)+((l+louthd6)*(l+louthd6)));
    ahd6=(u1hd6+u2hd6)/2.0;
    bhd6=sqrt(ahd6*ahd6-(lbhd6*lbhd6/4.0));
    a2hd6=ahd6*ahd6;
    b2hd6=bhd6*bhd6;
    DIV1hd6=sqrt(1.0-((lbhd6/2.0-louthd6)*(lbhd6/2.0-louthd6)/a2hd6));
    h2d6=bhd6*DIV1hd6;
    if(l<lbhd6/21-louthd6){
        dyhd6=dwallthick6*sin(atan(a2hd6*h1d6/(b2hd6*z0hd6)));
        dzhd6=dwallthick6*cos(atan(a2hd6*h1d6/(b2hd6*z0hd6)));
    	u1hdwt6=sqrt(((linhd6+dzhd6)*(linhd6+dzhd6))+((h1d6+dyhd6)*(h1d6+dyhd6)));	
    	u2hdwt6=sqrt(((h1d6+dyhd6)*(h1d6+dyhd6))+((l+louthd6-dzhd6)*(l+louthd6-dzhd6)));
    	ahdwt6=(u1hdwt6+u2hdwt6)/2.0;
    	a2hdwt6=ahdwt6*ahdwt6;
    	bhdwt6=sqrt(a2hdwt6-(lbhd6*lbhd6/4.0));
    	b2hdwt6=bhdwt6*bhdwt6;
    	h2dwt6=bhdwt6*sqrt(1.0-((lbhd6/2.0-louthd6)*(lbhd6/2.0-louthd6)/a2hdwt6));
        h1dwt6=bhdwt6*sqrt(1.0-((lbhd6/2.0-louthd6-l)*(lbhd6/2.0-louthd6-l)/a2hdwt6));
    }else{
	bhdwt6=bhd6+dwallthick6;
        b2hdwt6=bhdwt6*bhdwt6;
        ahdwt6=sqrt(b2hdwt6+(lbhd6*lbhd6/4.0));
        a2hdwt6=b2hdwt6+(lbhd6*lbhd6/4.0);
        h2dwt6=bhdwt6*sqrt(1.0-((lbhd6/2.0-louthd6)*(lbhd6/2.0-louthd6)/a2hdwt6));
        h1dwt6=bhdwt6*sqrt(1.0-((lbhd6/2.0-linhd6)*(lbhd6/2.0-linhd6)/a2hdwt6));
    }
  }

if(linhd6==0 && louthd6!=0)
   {	
    DIV1hd6=(l+louthd6)*(l+louthd6);
    p2parahd6=2.0*(sqrt(DIV1hd6+(h1d6*h1d6))-sqrt(DIV1hd6));
    h2d6=sqrt(p2parahd6*(louthd6+p2parahd6/4.0));
    pbhd6=l+louthd6+p2parahd6/4.0;
    pahd6=1.0/p2parahd6;
    dyhd6=dwallthick6*sin(atan(h1d6*2*pahd6));
    dzhd6=dwallthick6*cos(atan(h1d6*2*pahd6));
    DIV1hdwt6=(l+louthd6-dzhd6)*(l+louthd6-dzhd6);
    p2parahdwt6=2.0*(sqrt(DIV1hdwt6+((h1d6+dyhd6)*(h1d6+dyhd6)))-sqrt(DIV1hdwt6));
    pbhdwt6=l+louthd6+p2parahdwt6/4.0;
    pahdwt6=1.0/p2parahdwt6;
    h2dwt6=sqrt(p2parahdwt6*(louthd6+p2parahdwt6/4.0));
    h1dwt6=sqrt(p2parahdwt6*(louthd6+l+p2parahdwt6/4.0));
   }

if (linhd6!=0 && louthd6==0)
    {
      DIV1hd6=linhd6*linhd6;
      p2parahd6=2.0*(sqrt(DIV1hd6+(h1d6*h1d6))-sqrt(DIV1hd6));
      h2d6=sqrt(p2parahd6*(l+linhd6+p2parahd6/4.0));
      pbhd6=-(linhd6+p2parahd6/4.0);
      pahd6=-1.0/p2parahd6;
      dyhd6=dwallthick6*sin(atan(-h2d6*2*pahd6));
      dzhd6=dwallthick6*cos(atan(-h2d6*2*pahd6));
      DIV1hdwt6=(linhd6+l-dzhd6)*(linhd6+l-dzhd6);
      p2parahdwt6=2.0*(sqrt(DIV1hdwt6+((h2d6+dyhd6)*(h2d6+dyhd6)))-sqrt(DIV1hdwt6));
      h1dwt6=sqrt(p2parahdwt6*(linhd6+p2parahdwt6/4.0));
      h2dwt6=sqrt(p2parahdwt6*(linhd6+l+p2parahdwt6/4.0));
      pbhdwt6=-(linhd6+p2parahdwt6/4.0);
      pahdwt6=-1.0/p2parahdwt6;
    }

if(linhd6==0 && louthd6==0){
    h1dwt6=h1d6+dwallthick6/(cos(atan((h2d6-h1d6)/l)));
    h2dwt6=h2d6+dwallthick6/(cos(atan((h2d6-h1d6)/l)));
    }



mru16=(h1uwt6-h1u6)/(w1r6-w1rwt6);
nru16=h1u6-mru16*(-w1r6);
mru26=(h2uwt6-h2u6)/(w2r6-w2rwt6);
nru26=h2u6-mru26*(-w2r6);

mrd16=(-h1dwt6+h1d6)/(w1r6-w1rwt6);
nrd16=-h1d6-mrd16*(-w1r6);
mrd26=(-h2dwt6+h2d6)/(w2r6-w2rwt6);
nrd26=-h2d6-mrd26*(-w2r6);

mlu16=(h1uwt6-h1u6)/(-w1l6+w1lwt6);
nlu16=h1u6-mlu16*w1l6;
mlu26=(h2uwt6-h2u6)/(-w2l6+w2lwt6);
nlu26=h2u6-mlu26*w2l6;

mld16=(-h1dwt6+h1d6)/(-w1l6+w1lwt6);
nld16=-h1d6-mld16*w1l6;
mld26=(-h2dwt6+h2d6)/(-w2l6+w2lwt6);
nld26=-h2d6-mld26*w2l6;



if (w1r6 < w1rwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r6 have to be bigger or equal w1rwt5 \n");
    printf(" w1r6= %f \n",w1r6 );
    printf(" w1rwt5= %f \n",w1rwt5 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l6 < w1lwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l6 have to be bigger or equal w1lwt5 \n");
    printf(" w1l6= %f \n",w1l6 );
    printf(" w1lwt5= %f \n",w1lwt5 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u6 < h1uwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u6 have to be bigger or equal h1uwt5 \n");
    printf(" h1u6= %f \n",h1u6 );
    printf(" h1uwt5= %f \n",h1uwt5 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d6 < h1dwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d6 have to be bigger or equal h1dwt5 \n");
    printf(" h1d6= %f \n",h1d6 );
    printf(" h1dwt5= %f \n",h1dwt5 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r6 < w2rwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r6 have to be bigger or equal w2rwt5 \n");
    printf(" w2r6= %f \n",w2r6 );
    printf(" w2rwt5= %f \n",w2rwt5 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l6 < w2lwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l6 have to be bigger or equal w2lwt5 \n");
    printf(" w2l6= %f \n",w2l6 );
    printf(" w2lwt5= %f \n",w2lwt5 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u6 < h2uwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u6 have to be bigger or equal h2uwt5 \n");
    printf(" h2u6= %f \n",h2u6 );
    printf(" h2uwt5= %f \n",h2uwt5 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d6 < h2dwt5)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d6 have to be bigger or equal h2dwt5 \n");
    printf(" h2d6= %f \n",h2d6 );
    printf(" h2dwt5= %f \n",h2dwt5 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

lbwr7=linwr7+l+loutwr7;
z0wr7=(linwr7-l-loutwr7)/2.0;

if(loutwr7!=0 && linwr7!=0)
  { 
    u1wr7=sqrt((linwr7*linwr7)+(w1r7*w1r7));
    u2wr7=sqrt((w1r7*w1r7)+((l+loutwr7)*(l+loutwr7)));
    awr7=(u1wr7+u2wr7)/2.0;
    a2wr7=awr7*awr7;
    bwr7=sqrt(a2wr7-(lbwr7*lbwr7/4.0));
    b2wr7=bwr7*bwr7;
    DIV1wr7=sqrt(1.0-((lbwr7/2.0-loutwr7)*(lbwr7/2.0-loutwr7)/a2wr7));
    w2r7=bwr7*DIV1wr7;
    if(l<lbwr7/2-loutwr7){
        dxwr7=rwallthick7*sin(atan(a2wr7*w1r7/(b2wr7*z0wr7)));
        dzwr7=rwallthick7*cos(atan(a2wr7*w1r7/(b2wr7*z0wr7)));
    	u1wrwt7=sqrt(((linwr7+dzwr7)*(linwr7+dzwr7))+((w1r7+dxwr7)*(w1r7+dxwr7)));
    	u2wrwt7=sqrt(((w1r7+dxwr7)*(w1r7+dxwr7))+((l+loutwr7-dzwr7)*(l+loutwr7-dzwr7)));
    	awrwt7=(u1wrwt7+u2wrwt7)/2.0;
    	a2wrwt7=awrwt7*awrwt7;
    	bwrwt7=sqrt(a2wrwt7-(lbwr7*lbwr7/4.0));
    	b2wrwt7=bwrwt7*bwrwt7;
    	w2rwt7=bwrwt7*sqrt(1.0-((lbwr7/2.0-loutwr7)*(lbwr7/2.0-loutwr7)/a2wrwt7));
        w1rwt7=bwrwt7*sqrt(1.0-((lbwr7/2.0-loutwr7-l)*(lbwr7/2.0-loutwr7-l)/a2wrwt7));
    }else{
	bwrwt7=bwr7+rwallthick7;
        b2wrwt7=bwrwt7*bwrwt7;
        awrwt7=sqrt(b2wrwt7+(lbwr7*lbwr7/4.0));
        a2wrwt7=b2wrwt7+(lbwr7*lbwr7/4.0);
        w2rwt7=bwrwt7*sqrt(1.0-((lbwr7/2.0-loutwr7)*(lbwr7/2.0-loutwr7)/a2wrwt7));
        w1rwt7=bwrwt7*sqrt(1.0-((lbwr7/2.0-linwr7)*(lbwr7/2.0-linwr7)/a2wrwt7));
    }
   }



if(linwr7==0 && loutwr7!=0){
    DIV1wr7=(l+loutwr7)*(l+loutwr7);
    p2parawr7=2.0*(sqrt(DIV1wr7+(w1r7*w1r7))-sqrt(DIV1wr7));
    w2r7=sqrt(p2parawr7*(loutwr7+p2parawr7/4.0));
    pbwr7=l+loutwr7+p2parawr7/4.0;
    pawr7=1.0/p2parawr7;
    dxwr7=rwallthick7*sin(atan(w1r7*2*pawr7));
    dzwr7=rwallthick7*cos(atan(w1r7*2*pawr7));
    DIV1wrwt7=(l+loutwr7-dzwr7)*(l+loutwl7-dzwr7);
    p2parawrwt7=2.0*(sqrt(DIV1wrwt7+((w1r7+dxwr7)*(w1r7+dxwr7)))-sqrt(DIV1wrwt7));
    pbwrwt7=l+loutwr7+p2parawrwt7/4.0;
    pawrwt7=1.0/p2parawrwt7;
    w2rwt7=sqrt(p2parawrwt7*(loutwr7+p2parawrwt7/4.0));
    w1rwt7=sqrt(p2parawrwt7*(loutwr7+l+p2parawrwt7/4.0));
   }



if (linwr7!=0 && loutwr7==0)
    {
      DIV1wr7=linwr7*linwr7;
      p2parawr7=2.0*(sqrt(DIV1wr7+(w1r7*w1r7))-sqrt(DIV1wr7));
      w2r7=sqrt(p2parawr7*(l+linwr7+p2parawr7/4.0));
      pbwr7=-(linwr7+p2parawr7/4.0);
      pawr7=-1.0/p2parawr7;
      dxwr7=rwallthick7*sin(atan(-w2r7*2*pawr7));
      dzwr7=rwallthick7*cos(atan(-w2r7*2*pawr7));
      DIV1wrwt7=(linwr7+l-dzwr7)*(linwr7+l-dzwr7);
      p2parawrwt7=2.0*(sqrt(DIV1wrwt7+((w2r7+dxwr7)*(w2r7+dxwr7)))-sqrt(DIV1wrwt7));
      w1rwt7=sqrt(p2parawrwt7*(linwr7+p2parawrwt7/4.0));
      w2rwt7=sqrt(p2parawrwt7*(linwr7+l+p2parawrwt7/4.0));
      pbwrwt7=-(linwr7+p2parawrwt7/4.0);
      pawrwt7=-1.0/p2parawrwt7;
    }


if(linwr7==0 && loutwr7==0){
    w1rwt7=w1r7+rwallthick7/(cos(atan((w1r7-w2r7)/l)));
    w2rwt7=w2r7+rwallthick7/(cos(atan((w1r7-w2r7)/l)));
    }

lbwl7=linwl7+l+loutwl7;
z0wl7=(linwl7-l-loutwl7)/2.0;

if((linwl7!=0) && (loutwl7!=0) ) 
  { 
    u1wl7=sqrt((linwl7*linwl7)+(w1l7*w1l7));
    u2wl7=sqrt((w1l7*w1l7)+((l+loutwl7)*(l+loutwl7)));
    awl7=(u1wl7+u2wl7)/2.0;
    a2wl7=awl7*awl7;
    bwl7=sqrt(a2wl7-(lbwl7*lbwl7/4.0));
    b2wl7=bwl7*bwl7;
    DIV1wl7=sqrt(1.0-((lbwl7/2.0-loutwl7)*(lbwl7/2.0-loutwl7)/a2wl7));
    w2l7=bwl7*DIV1wl7;
    if(l<lbwl7/2-loutwl7){
        dxwl7=lwallthick7*sin(atan(a2wl7*w1l7/(b2wl7*z0wl7)));
        dzwl7=lwallthick7*cos(atan(a2wl7*w1l7/(b2wl7*z0wl7)));
    	u1wlwt7=sqrt(((linwl7+dzwl7)*(linwl7+dzwl7))+((w1l7+dxwl7)*(w1l7+dxwl7)));								
    	u2wlwt7=sqrt(((w1l7+dxwl7)*(w1l7+dxwl7))+((l+loutwl7-dzwl7)*(l+loutwl7-dzwl7)));	
    	awlwt7=(u1wlwt7+u2wlwt7)/2.0;
    	a2wlwt7=awlwt7*awlwt7;
    	bwlwt7=sqrt(a2wlwt7-(lbwl7*lbwl7/4.0));
    	b2wlwt7=bwlwt7*bwlwt7;
    	w2lwt7=bwlwt7*sqrt(1.0-((lbwl7/2.0-loutwl7)*(lbwl7/2.0-loutwl7)/a2wlwt7));
        w1lwt7=bwlwt7*sqrt(1.0-((lbwl7/2.0-loutwl7-l)*(lbwl7/2.0-loutwl7-l)/a2wlwt7));
    }else{
	bwlwt7=bwl7+lwallthick7;
        b2wlwt7=bwlwt7*bwlwt7;
        awlwt7=sqrt(b2wlwt7+(lbwl7*lbwl7/4.0));
        a2wlwt7=b2wlwt7+(lbwl7*lbwl7/4.0);
        w2lwt7=bwlwt7*sqrt(1.0-((lbwl7/2.0-loutwl7)*(lbwl7/2.0-loutwl7)/a2wlwt7));
        w1lwt7=bwlwt7*sqrt(1.0-((lbwl7/2.0-linwl7)*(lbwl7/2.0-linwl7)/a2wlwt7));
    }
   }


if(linwl7==0 && loutwl7!=0)
   {
    DIV1wl7=(l+loutwl7)*(l+loutwl7);
    p2parawl7=2.0*(sqrt(DIV1wl7+(w1l7*w1l7))-sqrt(DIV1wl7));
    w2l7=sqrt(p2parawl7*(loutwl7+p2parawl7/4.0));
    pbwl7=l+loutwl7+p2parawl7/4.0;
    pawl7=1.0/p2parawl7;
    dxwl7=lwallthick7*sin(atan(w1l7*2*pawl7));
    dzwl7=lwallthick7*cos(atan(w1l7*2*pawl7));
    DIV1wlwt7=(l+loutwl7-dzwl7)*(l+loutwl7-dzwl7);
    p2parawlwt7=2.0*(sqrt(DIV1wlwt7+((w1l7+dxwl7)*(w1l7+dxwl7)))-sqrt(DIV1wlwt7));
    pbwlwt7=l+loutwl7+p2parawlwt7/4.0;
    pawlwt7=1.0/p2parawlwt7;
    w2lwt7=sqrt(p2parawlwt7*(loutwl7+p2parawlwt7/4.0));
    w1lwt7=sqrt(p2parawlwt7*(loutwl7+l+p2parawlwt7/4.0));
   }

if (linwl7!=0 && loutwl7==0)
    {
      DIV1wl7=linwl7*linwl7;
      p2parawl7=2.0*(sqrt(DIV1wl7+(w1l7*w1l7))-sqrt(DIV1wl7));
      w2l7=sqrt(p2parawl7*(l+linwl7+p2parawl7/4.0));
      pbwl7=-(linwl7+p2parawl7/4.0);
      pawl7=-1.0/p2parawl7;
      dxwl7=lwallthick7*sin(atan(-w2l7*2*pawl7));
      dzwl7=lwallthick7*cos(atan(-w2l7*2*pawl7));
      DIV1wlwt7=(linwl7+l-dzwl7)*(linwl7+l-dzwl7);
      p2parawlwt7=2.0*(sqrt(DIV1wlwt7+((w2l7+dxwl7)*(w2l7+dxwl7)))-sqrt(DIV1wlwt7));
      w1lwt7=sqrt(p2parawlwt7*(linwl7+p2parawlwt7/4.0));
      w2lwt7=sqrt(p2parawlwt7*(linwl7+l+p2parawlwt7/4.0));
      pbwlwt7=-(linwl7+p2parawlwt7/4.0);
      pawlwt7=-1.0/p2parawlwt7;
    }

if(linwl7==0 && loutwl7==0){
    w1lwt7=w1l7+lwallthick7/(cos(atan((w2l7-w1l7)/l)));
    w2lwt7=w2l7+lwallthick7/(cos(atan((w2l7-w1l7)/l)));
    }


lbhu7=linhu7+l+louthu7;
z0hu7=lbhu7/2.0-l-louthu7;	

if (linhu7 != 0 && louthu7 !=0)
   {
    u1hu7=sqrt((linhu7*linhu7)+(h1u7*h1u7));
    u2hu7=sqrt((h1u7*h1u7)+((l+louthu7)*(l+louthu7)));
    ahu7=(u1hu7+u2hu7)/2.0;
    bhu7=sqrt(ahu7*ahu7-(lbhu7*lbhu7/4.0));
    a2hu7=ahu7*ahu7;
    b2hu7=bhu7*bhu7;
    DIV1hu7=sqrt(1.0-((lbhu7/2.0-louthu7)*(lbhu7/2.0-louthu7)/a2hu7));
    h2u7=bhu7*DIV1hu7;
    if(l<lbhu7/2-louthu7){
        dyhu7=uwallthick7*sin(atan(a2hu7*h1u7/(b2hu7*z0hu7)));
        dzhu7=uwallthick7*cos(atan(a2hu7*h1u7/(b2hu7*z0hu7)));
    	u1huwt7=sqrt(((linhu7+dzhu7)*(linhu7+dzhu7))+((h1u7+dyhu7)*(h1u7+dyhu7)));								
    	u2huwt7=sqrt(((h1u7+dyhu7)*(h1u7+dyhu7))+((l+louthu7-dzhu7)*(l+louthu7-dzhu7)));	
    	ahuwt7=(u1huwt7+u2huwt7)/2.0;
    	a2huwt7=ahuwt7*ahuwt7;
    	bhuwt7=sqrt(a2huwt7-(lbhu7*lbhu7/4.0));
    	b2huwt7=bhuwt7*bhuwt7;
    	h2uwt7=bhuwt7*sqrt(1.0-((lbhu7/2.0-louthu7)*(lbhu7/2.0-louthu7)/a2huwt7));
        h1uwt7=bhuwt7*sqrt(1.0-((lbhu7/2.0-louthu7-l)*(lbhu7/2.0-louthu7-l)/a2huwt7));
    }else{
	bhuwt7=bhu7+uwallthick7;
        b2huwt7=bhuwt7*bhuwt7;
        ahuwt7=sqrt(b2huwt7+(lbhu7*lbhu7/4.0));
        a2huwt7=b2huwt7+(lbhu7*lbhu7/4.0);
        h2uwt7=bhuwt7*sqrt(1.0-((lbhu7/2.0-louthu7)*(lbhu7/2.0-louthu7)/a2huwt7));
        h1uwt7=bhuwt7*sqrt(1.0-((lbhu7/2.0-linhu7)*(lbhu7/2.0-linhu7)/a2huwt7));
    }
  }

if(linhu7==0 && louthu7!=0)
   { 	
    DIV1hu7=(l+louthu7)*(l+louthu7);
    p2parahu7=2.0*(sqrt(DIV1hu7+(h1u7*h1u7))-sqrt(DIV1hu7));
    h2u7=sqrt(p2parahu7*(louthu7+p2parahu7/4.0));
    pbhu7=l+louthu7+p2parahu7/4.0;
    pahu7=1.0/p2parahu7;
    dyhu7=uwallthick7*sin(atan(h1u7*2*pahu7));
    dzhu7=uwallthick7*cos(atan(h1u7*2*pahu7));
    DIV1huwt7=(l+louthu7-dzhu7)*(l+louthu7-dzhu7);
    p2parahuwt7=2.0*(sqrt(DIV1huwt7+((h1u7+dyhu7)*(h1u7+dyhu7)))-sqrt(DIV1huwt7));
    pbhuwt7=l+louthu7+p2parahuwt7/4.0;
    pahuwt7=1.0/p2parahuwt7;
    h2uwt7=sqrt(p2parahuwt7*(louthu7+p2parahuwt7/4.0));
    h1uwt7=sqrt(p2parahuwt7*(louthu7+l+p2parahuwt7/4.0));
   } 

if (linhu7!=0 && louthu7==0)
    {
      DIV1hu7=linhu7*linhu7;
      p2parahu7=2.0*(sqrt(DIV1hu7+(h1u7*h1u7))-sqrt(DIV1hu7));
      h2u7=sqrt(p2parahu7*(l+linhu7+p2parahu7/4.0));
      pbhu7=-(linhu7+p2parahu7/4.0);
      pahu7=-1.0/p2parahu7;
      dyhu7=uwallthick7*sin(atan(-h2u7*2*pahu7));
      dzhu7=uwallthick7*cos(atan(-h2u7*2*pahu7));
      DIV1huwt7=(linhu7+l-dzhu7)*(linhu7+l-dzhu7);
      p2parahuwt7=2.0*(sqrt(DIV1huwt7+((h2u7+dyhu7)*(h2u7+dyhu7)))-sqrt(DIV1huwt7));
      h1uwt7=sqrt(p2parahuwt7*(linhu7+p2parahuwt7/4.0));
      h2uwt7=sqrt(p2parahuwt7*(linhu7+l+p2parahuwt7/4.0));
      pbhuwt7=-(linhu7+p2parahuwt7/4.0);
      pahuwt7=-1.0/p2parahuwt7;
    }

if(linhu7==0 && louthu7==0){
    h1uwt7=h1u7+uwallthick7/(cos(atan((h2u7-h1u7)/l)));
    h2uwt7=h2u7+uwallthick7/(cos(atan((h2u7-h1u7)/l)));
    }


lbhd7=linhd7+l+louthd7;
z0hd7=lbhd7/2.0-l-louthd7;

if (linhd7 != 0 && louthd7 !=0)
   {
    u1hd7=sqrt((linhd7*linhd7)+(h1d7*h1d7));
    u2hd7=sqrt((h1d7*h1d7)+((l+louthd7)*(l+louthd7)));
    ahd7=(u1hd7+u2hd7)/2.0;
    bhd7=sqrt(ahd7*ahd7-(lbhd7*lbhd7/4.0));
    a2hd7=ahd7*ahd7;
    b2hd7=bhd7*bhd7;
    DIV1hd7=sqrt(1.0-((lbhd7/2.0-louthd7)*(lbhd7/2.0-louthd7)/a2hd7));
    h2d7=bhd7*DIV1hd7;
    if(l<lbhd7/21-louthd7){
        dyhd7=dwallthick7*sin(atan(a2hd7*h1d7/(b2hd7*z0hd7)));
        dzhd7=dwallthick7*cos(atan(a2hd7*h1d7/(b2hd7*z0hd7)));
    	u1hdwt7=sqrt(((linhd7+dzhd7)*(linhd7+dzhd7))+((h1d7+dyhd7)*(h1d7+dyhd7)));	
    	u2hdwt7=sqrt(((h1d7+dyhd7)*(h1d7+dyhd7))+((l+louthd7-dzhd7)*(l+louthd7-dzhd7)));
    	ahdwt7=(u1hdwt7+u2hdwt7)/2.0;
    	a2hdwt7=ahdwt7*ahdwt7;
    	bhdwt7=sqrt(a2hdwt7-(lbhd7*lbhd7/4.0));
    	b2hdwt7=bhdwt7*bhdwt7;
    	h2dwt7=bhdwt7*sqrt(1.0-((lbhd7/2.0-louthd7)*(lbhd7/2.0-louthd7)/a2hdwt7));
        h1dwt7=bhdwt7*sqrt(1.0-((lbhd7/2.0-louthd7-l)*(lbhd7/2.0-louthd7-l)/a2hdwt7));
    }else{
	bhdwt7=bhd7+dwallthick7;
        b2hdwt7=bhdwt7*bhdwt7;
        ahdwt7=sqrt(b2hdwt7+(lbhd7*lbhd7/4.0));
        a2hdwt7=b2hdwt7+(lbhd7*lbhd7/4.0);
        h2dwt7=bhdwt7*sqrt(1.0-((lbhd7/2.0-louthd7)*(lbhd7/2.0-louthd7)/a2hdwt7));
        h1dwt7=bhdwt7*sqrt(1.0-((lbhd7/2.0-linhd7)*(lbhd7/2.0-linhd7)/a2hdwt7));
    }
  }

if(linhd7==0 && louthd7!=0)
   {	
    DIV1hd7=(l+louthd7)*(l+louthd7);
    p2parahd7=2.0*(sqrt(DIV1hd7+(h1d7*h1d7))-sqrt(DIV1hd7));
    h2d7=sqrt(p2parahd7*(louthd7+p2parahd7/4.0));
    pbhd7=l+louthd7+p2parahd7/4.0;
    pahd7=1.0/p2parahd7;
    dyhd7=dwallthick7*sin(atan(h1d7*2*pahd7));
    dzhd7=dwallthick7*cos(atan(h1d7*2*pahd7));
    DIV1hdwt7=(l+louthd7-dzhd7)*(l+louthd7-dzhd7);
    p2parahdwt7=2.0*(sqrt(DIV1hdwt7+((h1d7+dyhd7)*(h1d7+dyhd7)))-sqrt(DIV1hdwt7));
    pbhdwt7=l+louthd7+p2parahdwt7/4.0;
    pahdwt7=1.0/p2parahdwt7;
    h2dwt7=sqrt(p2parahdwt7*(louthd7+p2parahdwt7/4.0));
    h1dwt7=sqrt(p2parahdwt7*(louthd7+l+p2parahdwt7/4.0));
   }

if (linhd7!=0 && louthd7==0)
    {
      DIV1hd7=linhd7*linhd7;
      p2parahd7=2.0*(sqrt(DIV1hd7+(h1d7*h1d7))-sqrt(DIV1hd7));
      h2d7=sqrt(p2parahd7*(l+linhd7+p2parahd7/4.0));
      pbhd7=-(linhd7+p2parahd7/4.0);
      pahd7=-1.0/p2parahd7;
      dyhd7=dwallthick7*sin(atan(-h2d7*2*pahd7));
      dzhd7=dwallthick7*cos(atan(-h2d7*2*pahd7));
      DIV1hdwt7=(linhd7+l-dzhd7)*(linhd7+l-dzhd7);
      p2parahdwt7=2.0*(sqrt(DIV1hdwt7+((h2d7+dyhd7)*(h2d7+dyhd7)))-sqrt(DIV1hdwt7));
      h1dwt7=sqrt(p2parahdwt7*(linhd7+p2parahdwt7/4.0));
      h2dwt7=sqrt(p2parahdwt7*(linhd7+l+p2parahdwt7/4.0));
      pbhdwt7=-(linhd7+p2parahdwt7/4.0);
      pahdwt7=-1.0/p2parahdwt7;
    }

if(linhd7==0 && louthd7==0){
    h1dwt7=h1d7+dwallthick7/(cos(atan((h2d7-h1d7)/l)));
    h2dwt7=h2d7+dwallthick7/(cos(atan((h2d7-h1d7)/l)));
    }



mru17=(h1uwt7-h1u7)/(w1r7-w1rwt7);
nru17=h1u7-mru17*(-w1r7);
mru27=(h2uwt7-h2u7)/(w2r7-w2rwt7);
nru27=h2u7-mru27*(-w2r7);

mrd17=(-h1dwt7+h1d7)/(w1r7-w1rwt7);
nrd17=-h1d7-mrd17*(-w1r7);
mrd27=(-h2dwt7+h2d7)/(w2r7-w2rwt7);
nrd27=-h2d7-mrd27*(-w2r7);

mlu17=(h1uwt7-h1u7)/(-w1l7+w1lwt7);
nlu17=h1u7-mlu17*w1l7;
mlu27=(h2uwt7-h2u7)/(-w2l7+w2lwt7);
nlu27=h2u7-mlu27*w2l7;

mld17=(-h1dwt7+h1d7)/(-w1l7+w1lwt7);
nld17=-h1d7-mld17*w1l7;
mld27=(-h2dwt7+h2d7)/(-w2l7+w2lwt7);
nld27=-h2d7-mld27*w2l7;



if (w1r7 < w1rwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r7 have to be bigger or equal w1rwt6 \n");
    printf(" w1r7= %f \n",w1r7 );
    printf(" w1rwt6= %f \n",w1rwt6 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l7 < w1lwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l7 have to be bigger or equal w1lwt6 \n");
    printf(" w1l7= %f \n",w1l7 );
    printf(" w1lwt6= %f \n",w1lwt6 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u7 < h1uwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u7 have to be bigger or equal h1uwt6 \n");
    printf(" h1u7= %f \n",h1u7 );
    printf(" h1uwt6= %f \n",h1uwt6 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d7 < h1dwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d7 have to be bigger or equal h1dwt6 \n");
    printf(" h1d7= %f \n",h1d7 );
    printf(" h1dwt6= %f \n",h1dwt6 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r7 < w2rwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r7 have to be bigger or equal w2rwt6 \n");
    printf(" w2r7= %f \n",w2r7 );
    printf(" w2rwt6= %f \n",w2rwt6 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l7 < w2lwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l7 have to be bigger or equal w2lwt6 \n");
    printf(" w2l7= %f \n",w2l7 );
    printf(" w2lwt6= %f \n",w2lwt6 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u7 < h2uwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u7 have to be bigger or equal h2uwt6 \n");
    printf(" h2u7= %f \n",h2u7 );
    printf(" h2uwt6= %f \n",h2uwt6 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d7 < h2dwt6)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d7 have to be bigger or equal h2dwt6 \n");
    printf(" h2d7= %f \n",h2d7 );
    printf(" h2dwt6= %f \n",h2dwt6 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }


lbwr8=linwr8+l+loutwr8;
z0wr8=(linwr8-l-loutwr8)/2.0;

if(loutwr8!=0 && linwr8!=0)
  { 
    u1wr8=sqrt((linwr8*linwr8)+(w1r8*w1r8));
    u2wr8=sqrt((w1r8*w1r8)+((l+loutwr8)*(l+loutwr8)));
    awr8=(u1wr8+u2wr8)/2.0;
    a2wr8=awr8*awr8;
    bwr8=sqrt(a2wr8-(lbwr8*lbwr8/4.0));
    b2wr8=bwr8*bwr8;
    DIV1wr8=sqrt(1.0-((lbwr8/2.0-loutwr8)*(lbwr8/2.0-loutwr8)/a2wr8));
    w2r8=bwr8*DIV1wr8;
    if(l<lbwr8/2-loutwr8){
        dxwr8=rwallthick8*sin(atan(a2wr8*w1r8/(b2wr8*z0wr8)));
        dzwr8=rwallthick8*cos(atan(a2wr8*w1r8/(b2wr8*z0wr8)));
    	u1wrwt8=sqrt(((linwr8+dzwr8)*(linwr8+dzwr8))+((w1r8+dxwr8)*(w1r8+dxwr8)));
    	u2wrwt8=sqrt(((w1r8+dxwr8)*(w1r8+dxwr8))+((l+loutwr8-dzwr8)*(l+loutwr8-dzwr8)));
    	awrwt8=(u1wrwt8+u2wrwt8)/2.0;
    	a2wrwt8=awrwt8*awrwt8;
    	bwrwt8=sqrt(a2wrwt8-(lbwr8*lbwr8/4.0));
    	b2wrwt8=bwrwt8*bwrwt8;
    	w2rwt8=bwrwt8*sqrt(1.0-((lbwr8/2.0-loutwr8)*(lbwr8/2.0-loutwr8)/a2wrwt8));
        w1rwt8=bwrwt8*sqrt(1.0-((lbwr8/2.0-loutwr8-l)*(lbwr8/2.0-loutwr8-l)/a2wrwt8));
    }else{
	bwrwt8=bwr8+rwallthick8;
        b2wrwt8=bwrwt8*bwrwt8;
        awrwt8=sqrt(b2wrwt8+(lbwr8*lbwr8/4.0));
        a2wrwt8=b2wrwt8+(lbwr8*lbwr8/4.0);
        w2rwt8=bwrwt8*sqrt(1.0-((lbwr8/2.0-loutwr8)*(lbwr8/2.0-loutwr8)/a2wrwt8));
        w1rwt8=bwrwt8*sqrt(1.0-((lbwr8/2.0-linwr8)*(lbwr8/2.0-linwr8)/a2wrwt8));
    }
   }



if(linwr8==0 && loutwr8!=0){
    DIV1wr8=(l+loutwr8)*(l+loutwr8);
    p2parawr8=2.0*(sqrt(DIV1wr8+(w1r8*w1r8))-sqrt(DIV1wr8));
    w2r8=sqrt(p2parawr8*(loutwr8+p2parawr8/4.0));
    pbwr8=l+loutwr8+p2parawr8/4.0;
    pawr8=1.0/p2parawr8;
    dxwr8=rwallthick8*sin(atan(w1r8*2*pawr8));
    dzwr8=rwallthick8*cos(atan(w1r8*2*pawr8));
    DIV1wrwt8=(l+loutwr8-dzwr8)*(l+loutwl8-dzwr8);
    p2parawrwt8=2.0*(sqrt(DIV1wrwt8+((w1r8+dxwr8)*(w1r8+dxwr8)))-sqrt(DIV1wrwt8));
    pbwrwt8=l+loutwr8+p2parawrwt8/4.0;
    pawrwt8=1.0/p2parawrwt8;
    w2rwt8=sqrt(p2parawrwt8*(loutwr8+p2parawrwt8/4.0));
    w1rwt8=sqrt(p2parawrwt8*(loutwr8+l+p2parawrwt8/4.0));
   }



if (linwr8!=0 && loutwr8==0)
    {
      DIV1wr8=linwr8*linwr8;
      p2parawr8=2.0*(sqrt(DIV1wr8+(w1r8*w1r8))-sqrt(DIV1wr8));
      w2r8=sqrt(p2parawr8*(l+linwr8+p2parawr8/4.0));
      pbwr8=-(linwr8+p2parawr8/4.0);
      pawr8=-1.0/p2parawr8;
      dxwr8=rwallthick8*sin(atan(-w2r8*2*pawr8));
      dzwr8=rwallthick8*cos(atan(-w2r8*2*pawr8));
      DIV1wrwt8=(linwr8+l-dzwr8)*(linwr8+l-dzwr8);
      p2parawrwt8=2.0*(sqrt(DIV1wrwt8+((w2r8+dxwr8)*(w2r8+dxwr8)))-sqrt(DIV1wrwt8));
      w1rwt8=sqrt(p2parawrwt8*(linwr8+p2parawrwt8/4.0));
      w2rwt8=sqrt(p2parawrwt8*(linwr8+l+p2parawrwt8/4.0));
      pbwrwt8=-(linwr8+p2parawrwt8/4.0);
      pawrwt8=-1.0/p2parawrwt8;
    }


if(linwr8==0 && loutwr8==0){
    w1rwt8=w1r8+rwallthick8/(cos(atan((w1r8-w2r8)/l)));
    w2rwt8=w2r8+rwallthick8/(cos(atan((w1r8-w2r8)/l)));
    }

lbwl8=linwl8+l+loutwl8;
z0wl8=(linwl8-l-loutwl8)/2.0;

if((linwl8!=0) && (loutwl8!=0) ) 
  { 
    u1wl8=sqrt((linwl8*linwl8)+(w1l8*w1l8));
    u2wl8=sqrt((w1l8*w1l8)+((l+loutwl8)*(l+loutwl8)));
    awl8=(u1wl8+u2wl8)/2.0;
    a2wl8=awl8*awl8;
    bwl8=sqrt(a2wl8-(lbwl8*lbwl8/4.0));
    b2wl8=bwl8*bwl8;
    DIV1wl8=sqrt(1.0-((lbwl8/2.0-loutwl8)*(lbwl8/2.0-loutwl8)/a2wl8));
    w2l8=bwl8*DIV1wl8;
    if(l<lbwl8/2-loutwl8){
        dxwl8=lwallthick8*sin(atan(a2wl8*w1l8/(b2wl8*z0wl8)));
        dzwl8=lwallthick8*cos(atan(a2wl8*w1l8/(b2wl8*z0wl8)));
    	u1wlwt8=sqrt(((linwl8+dzwl8)*(linwl8+dzwl8))+((w1l8+dxwl8)*(w1l8+dxwl8)));								
    	u2wlwt8=sqrt(((w1l8+dxwl8)*(w1l8+dxwl8))+((l+loutwl8-dzwl8)*(l+loutwl8-dzwl8)));	
    	awlwt8=(u1wlwt8+u2wlwt8)/2.0;
    	a2wlwt8=awlwt8*awlwt8;
    	bwlwt8=sqrt(a2wlwt8-(lbwl8*lbwl8/4.0));
    	b2wlwt8=bwlwt8*bwlwt8;
    	w2lwt8=bwlwt8*sqrt(1.0-((lbwl8/2.0-loutwl8)*(lbwl8/2.0-loutwl8)/a2wlwt8));
        w1lwt8=bwlwt8*sqrt(1.0-((lbwl8/2.0-loutwl8-l)*(lbwl8/2.0-loutwl8-l)/a2wlwt8));
    }else{
	bwlwt8=bwl8+lwallthick8;
        b2wlwt8=bwlwt8*bwlwt8;
        awlwt8=sqrt(b2wlwt8+(lbwl8*lbwl8/4.0));
        a2wlwt8=b2wlwt8+(lbwl8*lbwl8/4.0);
        w2lwt8=bwlwt8*sqrt(1.0-((lbwl8/2.0-loutwl8)*(lbwl8/2.0-loutwl8)/a2wlwt8));
        w1lwt8=bwlwt8*sqrt(1.0-((lbwl8/2.0-linwl8)*(lbwl8/2.0-linwl8)/a2wlwt8));
    }
   }


if(linwl8==0 && loutwl8!=0)
   {
    DIV1wl8=(l+loutwl8)*(l+loutwl8);
    p2parawl8=2.0*(sqrt(DIV1wl8+(w1l8*w1l8))-sqrt(DIV1wl8));
    w2l8=sqrt(p2parawl8*(loutwl8+p2parawl8/4.0));
    pbwl8=l+loutwl8+p2parawl8/4.0;
    pawl8=1.0/p2parawl8;
    dxwl8=lwallthick8*sin(atan(w1l8*2*pawl8));
    dzwl8=lwallthick8*cos(atan(w1l8*2*pawl8));
    DIV1wlwt8=(l+loutwl8-dzwl8)*(l+loutwl8-dzwl8);
    p2parawlwt8=2.0*(sqrt(DIV1wlwt8+((w1l8+dxwl8)*(w1l8+dxwl8)))-sqrt(DIV1wlwt8));
    pbwlwt8=l+loutwl8+p2parawlwt8/4.0;
    pawlwt8=1.0/p2parawlwt8;
    w2lwt8=sqrt(p2parawlwt8*(loutwl8+p2parawlwt8/4.0));
    w1lwt8=sqrt(p2parawlwt8*(loutwl8+l+p2parawlwt8/4.0));
   }

if (linwl8!=0 && loutwl8==0)
    {
      DIV1wl8=linwl8*linwl8;
      p2parawl8=2.0*(sqrt(DIV1wl8+(w1l8*w1l8))-sqrt(DIV1wl8));
      w2l8=sqrt(p2parawl8*(l+linwl8+p2parawl8/4.0));
      pbwl8=-(linwl8+p2parawl8/4.0);
      pawl8=-1.0/p2parawl8;
      dxwl8=lwallthick8*sin(atan(-w2l8*2*pawl8));
      dzwl8=lwallthick8*cos(atan(-w2l8*2*pawl8));
      DIV1wlwt8=(linwl8+l-dzwl8)*(linwl8+l-dzwl8);
      p2parawlwt8=2.0*(sqrt(DIV1wlwt8+((w2l8+dxwl8)*(w2l8+dxwl8)))-sqrt(DIV1wlwt8));
      w1lwt8=sqrt(p2parawlwt8*(linwl8+p2parawlwt8/4.0));
      w2lwt8=sqrt(p2parawlwt8*(linwl8+l+p2parawlwt8/4.0));
      pbwlwt8=-(linwl8+p2parawlwt8/4.0);
      pawlwt8=-1.0/p2parawlwt8;
    }

if(linwl8==0 && loutwl8==0){
    w1lwt8=w1l8+lwallthick8/(cos(atan((w2l8-w1l8)/l)));
    w2lwt8=w2l8+lwallthick8/(cos(atan((w2l8-w1l8)/l)));
    }


lbhu8=linhu8+l+louthu8;
z0hu8=lbhu8/2.0-l-louthu8;	

if (linhu8 != 0 && louthu8 !=0)
   {
    u1hu8=sqrt((linhu8*linhu8)+(h1u8*h1u8));
    u2hu8=sqrt((h1u8*h1u8)+((l+louthu8)*(l+louthu8)));
    ahu8=(u1hu8+u2hu8)/2.0;
    bhu8=sqrt(ahu8*ahu8-(lbhu8*lbhu8/4.0));
    a2hu8=ahu8*ahu8;
    b2hu8=bhu8*bhu8;
    DIV1hu8=sqrt(1.0-((lbhu8/2.0-louthu8)*(lbhu8/2.0-louthu8)/a2hu8));
    h2u8=bhu8*DIV1hu8;
    if(l<lbhu8/2-louthu8){
        dyhu8=uwallthick8*sin(atan(a2hu8*h1u8/(b2hu8*z0hu8)));
        dzhu8=uwallthick8*cos(atan(a2hu8*h1u8/(b2hu8*z0hu8)));
    	u1huwt8=sqrt(((linhu8+dzhu8)*(linhu8+dzhu8))+((h1u8+dyhu8)*(h1u8+dyhu8)));								
    	u2huwt8=sqrt(((h1u8+dyhu8)*(h1u8+dyhu8))+((l+louthu8-dzhu8)*(l+louthu8-dzhu8)));	
    	ahuwt8=(u1huwt8+u2huwt8)/2.0;
    	a2huwt8=ahuwt8*ahuwt8;
    	bhuwt8=sqrt(a2huwt8-(lbhu8*lbhu8/4.0));
    	b2huwt8=bhuwt8*bhuwt8;
    	h2uwt8=bhuwt8*sqrt(1.0-((lbhu8/2.0-louthu8)*(lbhu8/2.0-louthu8)/a2huwt8));
        h1uwt8=bhuwt8*sqrt(1.0-((lbhu8/2.0-louthu8-l)*(lbhu8/2.0-louthu8-l)/a2huwt8));
    }else{
	bhuwt8=bhu8+uwallthick8;
        b2huwt8=bhuwt8*bhuwt8;
        ahuwt8=sqrt(b2huwt8+(lbhu8*lbhu8/4.0));
        a2huwt8=b2huwt8+(lbhu8*lbhu8/4.0);
        h2uwt8=bhuwt8*sqrt(1.0-((lbhu8/2.0-louthu8)*(lbhu8/2.0-louthu8)/a2huwt8));
        h1uwt8=bhuwt8*sqrt(1.0-((lbhu8/2.0-linhu8)*(lbhu8/2.0-linhu8)/a2huwt8));
    }
  }

if(linhu8==0 && louthu8!=0)
   { 	
    DIV1hu8=(l+louthu8)*(l+louthu8);
    p2parahu8=2.0*(sqrt(DIV1hu8+(h1u8*h1u8))-sqrt(DIV1hu8));
    h2u8=sqrt(p2parahu8*(louthu8+p2parahu8/4.0));
    pbhu8=l+louthu8+p2parahu8/4.0;
    pahu8=1.0/p2parahu8;
    dyhu8=uwallthick8*sin(atan(h1u8*2*pahu8));
    dzhu8=uwallthick8*cos(atan(h1u8*2*pahu8));
    DIV1huwt8=(l+louthu8-dzhu8)*(l+louthu8-dzhu8);
    p2parahuwt8=2.0*(sqrt(DIV1huwt8+((h1u8+dyhu8)*(h1u8+dyhu8)))-sqrt(DIV1huwt8));
    pbhuwt8=l+louthu8+p2parahuwt8/4.0;
    pahuwt8=1.0/p2parahuwt8;
    h2uwt8=sqrt(p2parahuwt8*(louthu8+p2parahuwt8/4.0));
    h1uwt8=sqrt(p2parahuwt8*(louthu8+l+p2parahuwt8/4.0));
   } 

if (linhu8!=0 && louthu8==0)
    {
      DIV1hu8=linhu8*linhu8;
      p2parahu8=2.0*(sqrt(DIV1hu8+(h1u8*h1u8))-sqrt(DIV1hu8));
      h2u8=sqrt(p2parahu8*(l+linhu8+p2parahu8/4.0));
      pbhu8=-(linhu8+p2parahu8/4.0);
      pahu8=-1.0/p2parahu8;
      dyhu8=uwallthick8*sin(atan(-h2u8*2*pahu8));
      dzhu8=uwallthick8*cos(atan(-h2u8*2*pahu8));
      DIV1huwt8=(linhu8+l-dzhu8)*(linhu8+l-dzhu8);
      p2parahuwt8=2.0*(sqrt(DIV1huwt8+((h2u8+dyhu8)*(h2u8+dyhu8)))-sqrt(DIV1huwt8));
      h1uwt8=sqrt(p2parahuwt8*(linhu8+p2parahuwt8/4.0));
      h2uwt8=sqrt(p2parahuwt8*(linhu8+l+p2parahuwt8/4.0));
      pbhuwt8=-(linhu8+p2parahuwt8/4.0);
      pahuwt8=-1.0/p2parahuwt8;
    }

if(linhu8==0 && louthu8==0){
    h1uwt8=h1u8+uwallthick8/(cos(atan((h2u8-h1u8)/l)));
    h2uwt8=h2u8+uwallthick8/(cos(atan((h2u8-h1u8)/l)));
    }


lbhd8=linhd8+l+louthd8;
z0hd8=lbhd8/2.0-l-louthd8;

if (linhd8 != 0 && louthd8 !=0)
   {
    u1hd8=sqrt((linhd8*linhd8)+(h1d8*h1d8));
    u2hd8=sqrt((h1d8*h1d8)+((l+louthd8)*(l+louthd8)));
    ahd8=(u1hd8+u2hd8)/2.0;
    bhd8=sqrt(ahd8*ahd8-(lbhd8*lbhd8/4.0));
    a2hd8=ahd8*ahd8;
    b2hd8=bhd8*bhd8;
    DIV1hd8=sqrt(1.0-((lbhd8/2.0-louthd8)*(lbhd8/2.0-louthd8)/a2hd8));
    h2d8=bhd8*DIV1hd8;
    if(l<lbhd8/21-louthd8){
        dyhd8=dwallthick8*sin(atan(a2hd8*h1d8/(b2hd8*z0hd8)));
        dzhd8=dwallthick8*cos(atan(a2hd8*h1d8/(b2hd8*z0hd8)));
    	u1hdwt8=sqrt(((linhd8+dzhd8)*(linhd8+dzhd8))+((h1d8+dyhd8)*(h1d8+dyhd8)));	
    	u2hdwt8=sqrt(((h1d8+dyhd8)*(h1d8+dyhd8))+((l+louthd8-dzhd8)*(l+louthd8-dzhd8)));
    	ahdwt8=(u1hdwt8+u2hdwt8)/2.0;
    	a2hdwt8=ahdwt8*ahdwt8;
    	bhdwt8=sqrt(a2hdwt8-(lbhd8*lbhd8/4.0));
    	b2hdwt8=bhdwt8*bhdwt8;
    	h2dwt8=bhdwt8*sqrt(1.0-((lbhd8/2.0-louthd8)*(lbhd8/2.0-louthd8)/a2hdwt8));
        h1dwt8=bhdwt8*sqrt(1.0-((lbhd8/2.0-louthd8-l)*(lbhd8/2.0-louthd8-l)/a2hdwt8));
    }else{
	bhdwt8=bhd8+dwallthick8;
        b2hdwt8=bhdwt8*bhdwt8;
        ahdwt8=sqrt(b2hdwt8+(lbhd8*lbhd8/4.0));
        a2hdwt8=b2hdwt8+(lbhd8*lbhd8/4.0);
        h2dwt8=bhdwt8*sqrt(1.0-((lbhd8/2.0-louthd8)*(lbhd8/2.0-louthd8)/a2hdwt8));
        h1dwt8=bhdwt8*sqrt(1.0-((lbhd8/2.0-linhd8)*(lbhd8/2.0-linhd8)/a2hdwt8));
    }
  }

if(linhd8==0 && louthd8!=0)
   {	
    DIV1hd8=(l+louthd8)*(l+louthd8);
    p2parahd8=2.0*(sqrt(DIV1hd8+(h1d8*h1d8))-sqrt(DIV1hd8));
    h2d8=sqrt(p2parahd8*(louthd8+p2parahd8/4.0));
    pbhd8=l+louthd8+p2parahd8/4.0;
    pahd8=1.0/p2parahd8;
    dyhd8=dwallthick8*sin(atan(h1d8*2*pahd8));
    dzhd8=dwallthick8*cos(atan(h1d8*2*pahd8));
    DIV1hdwt8=(l+louthd8-dzhd8)*(l+louthd8-dzhd8);
    p2parahdwt8=2.0*(sqrt(DIV1hdwt8+((h1d8+dyhd8)*(h1d8+dyhd8)))-sqrt(DIV1hdwt8));
    pbhdwt8=l+louthd8+p2parahdwt8/4.0;
    pahdwt8=1.0/p2parahdwt8;
    h2dwt8=sqrt(p2parahdwt8*(louthd8+p2parahdwt8/4.0));
    h1dwt8=sqrt(p2parahdwt8*(louthd8+l+p2parahdwt8/4.0));
   }

if (linhd8!=0 && louthd8==0)
    {
      DIV1hd8=linhd8*linhd8;
      p2parahd8=2.0*(sqrt(DIV1hd8+(h1d8*h1d8))-sqrt(DIV1hd8));
      h2d8=sqrt(p2parahd8*(l+linhd8+p2parahd8/4.0));
      pbhd8=-(linhd8+p2parahd8/4.0);
      pahd8=-1.0/p2parahd8;
      dyhd8=dwallthick8*sin(atan(-h2d8*2*pahd8));
      dzhd8=dwallthick8*cos(atan(-h2d8*2*pahd8));
      DIV1hdwt8=(linhd8+l-dzhd8)*(linhd8+l-dzhd8);
      p2parahdwt8=2.0*(sqrt(DIV1hdwt8+((h2d8+dyhd8)*(h2d8+dyhd8)))-sqrt(DIV1hdwt8));
      h1dwt8=sqrt(p2parahdwt8*(linhd8+p2parahdwt8/4.0));
      h2dwt8=sqrt(p2parahdwt8*(linhd8+l+p2parahdwt8/4.0));
      pbhdwt8=-(linhd8+p2parahdwt8/4.0);
      pahdwt8=-1.0/p2parahdwt8;
    }

if(linhd8==0 && louthd8==0){
    h1dwt8=h1d8+dwallthick8/(cos(atan((h2d8-h1d8)/l)));
    h2dwt8=h2d8+dwallthick8/(cos(atan((h2d8-h1d8)/l)));
    }



mru18=(h1uwt8-h1u8)/(w1r8-w1rwt8);
nru18=h1u8-mru18*(-w1r8);
mru28=(h2uwt8-h2u8)/(w2r8-w2rwt8);
nru28=h2u8-mru28*(-w2r8);

mrd18=(-h1dwt8+h1d8)/(w1r8-w1rwt8);
nrd18=-h1d8-mrd18*(-w1r8);
mrd28=(-h2dwt8+h2d8)/(w2r8-w2rwt8);
nrd28=-h2d8-mrd28*(-w2r8);

mlu18=(h1uwt8-h1u8)/(-w1l8+w1lwt8);
nlu18=h1u8-mlu18*w1l8;
mlu28=(h2uwt8-h2u8)/(-w2l8+w2lwt8);
nlu28=h2u8-mlu28*w2l8;

mld18=(-h1dwt8+h1d8)/(-w1l8+w1lwt8);
nld18=-h1d8-mld18*w1l8;
mld28=(-h2dwt8+h2d8)/(-w2l8+w2lwt8);
nld28=-h2d8-mld28*w2l8;



if (w1r8 < w1rwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r8 have to be bigger or equal w1rwt7 \n");
    printf(" w1r8= %f \n",w1r8 );
    printf(" w1rwt7= %f \n",w1rwt7 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l8 < w1lwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l8 have to be bigger or equal w1lwt7 \n");
    printf(" w1l8= %f \n",w1l8 );
    printf(" w1lwt7= %f \n",w1lwt7 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u8 < h1uwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u8 have to be bigger or equal h1uwt7 \n");
    printf(" h1u8= %f \n",h1u8 );
    printf(" h1uwt7= %f \n",h1uwt7 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d8 < h1dwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d8 have to be bigger or equal h1dwt7 \n");
    printf(" h1d8= %f \n",h1d8 );
    printf(" h1dwt7= %f \n",h1dwt7 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r8 < w2rwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r8 have to be bigger or equal w2rwt7 \n");
    printf(" w2r8= %f \n",w2r8 );
    printf(" w2rwt7= %f \n",w2rwt7 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l8 < w2lwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l8 have to be bigger or equal w2lwt7 \n");
    printf(" w2l8= %f \n",w2l8 );
    printf(" w2lwt7= %f \n",w2lwt7 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u8 < h2uwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u8 have to be bigger or equal h2uwt7 \n");
    printf(" h2u8= %f \n",h2u8 );
    printf(" h2uwt7= %f \n",h2uwt7 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d8 < h2dwt7)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d8 have to be bigger or equal h2dwt7 \n");
    printf(" h2d8= %f \n",h2d8 );
    printf(" h2dwt7= %f \n",h2dwt7 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }


lbwr9=linwr9+l+loutwr9;
z0wr9=(linwr9-l-loutwr9)/2.0;

if(loutwr9!=0 && linwr9!=0)
  { 
    u1wr9=sqrt((linwr9*linwr9)+(w1r9*w1r9));
    u2wr9=sqrt((w1r9*w1r9)+((l+loutwr9)*(l+loutwr9)));
    awr9=(u1wr9+u2wr9)/2.0;
    a2wr9=awr9*awr9;
    bwr9=sqrt(a2wr9-(lbwr9*lbwr9/4.0));
    b2wr9=bwr9*bwr9;
    DIV1wr9=sqrt(1.0-((lbwr9/2.0-loutwr9)*(lbwr9/2.0-loutwr9)/a2wr9));
    w2r9=bwr9*DIV1wr9;
    if(l<lbwr9/2-loutwr9){
        dxwr9=rwallthick9*sin(atan(a2wr9*w1r9/(b2wr9*z0wr9)));
        dzwr9=rwallthick9*cos(atan(a2wr9*w1r9/(b2wr9*z0wr9)));
    	u1wrwt9=sqrt(((linwr9+dzwr9)*(linwr9+dzwr9))+((w1r9+dxwr9)*(w1r9+dxwr9)));
    	u2wrwt9=sqrt(((w1r9+dxwr9)*(w1r9+dxwr9))+((l+loutwr9-dzwr9)*(l+loutwr9-dzwr9)));
    	awrwt9=(u1wrwt9+u2wrwt9)/2.0;
    	a2wrwt9=awrwt9*awrwt9;
    	bwrwt9=sqrt(a2wrwt9-(lbwr9*lbwr9/4.0));
    	b2wrwt9=bwrwt9*bwrwt9;
    	w2rwt9=bwrwt9*sqrt(1.0-((lbwr9/2.0-loutwr9)*(lbwr9/2.0-loutwr9)/a2wrwt9));
        w1rwt9=bwrwt9*sqrt(1.0-((lbwr9/2.0-loutwr9-l)*(lbwr9/2.0-loutwr9-l)/a2wrwt9));
    }else{
	bwrwt9=bwr9+rwallthick9;
        b2wrwt9=bwrwt9*bwrwt9;
        awrwt9=sqrt(b2wrwt9+(lbwr9*lbwr9/4.0));
        a2wrwt9=b2wrwt9+(lbwr9*lbwr9/4.0);
        w2rwt9=bwrwt9*sqrt(1.0-((lbwr9/2.0-loutwr9)*(lbwr9/2.0-loutwr9)/a2wrwt9));
        w1rwt9=bwrwt9*sqrt(1.0-((lbwr9/2.0-linwr9)*(lbwr9/2.0-linwr9)/a2wrwt9));
    }
   }



if(linwr9==0 && loutwr9!=0){
    DIV1wr9=(l+loutwr9)*(l+loutwr9);
    p2parawr9=2.0*(sqrt(DIV1wr9+(w1r9*w1r9))-sqrt(DIV1wr9));
    w2r9=sqrt(p2parawr9*(loutwr9+p2parawr9/4.0));
    pbwr9=l+loutwr9+p2parawr9/4.0;
    pawr9=1.0/p2parawr9;
    dxwr9=rwallthick9*sin(atan(w1r9*2*pawr9));
    dzwr9=rwallthick9*cos(atan(w1r9*2*pawr9));
    DIV1wrwt9=(l+loutwr9-dzwr9)*(l+loutwl9-dzwr9);
    p2parawrwt9=2.0*(sqrt(DIV1wrwt9+((w1r9+dxwr9)*(w1r9+dxwr9)))-sqrt(DIV1wrwt9));
    pbwrwt9=l+loutwr9+p2parawrwt9/4.0;
    pawrwt9=1.0/p2parawrwt9;
    w2rwt9=sqrt(p2parawrwt9*(loutwr9+p2parawrwt9/4.0));
    w1rwt9=sqrt(p2parawrwt9*(loutwr9+l+p2parawrwt9/4.0));
   }



if (linwr9!=0 && loutwr9==0)
    {
      DIV1wr9=linwr9*linwr9;
      p2parawr9=2.0*(sqrt(DIV1wr9+(w1r9*w1r9))-sqrt(DIV1wr9));
      w2r9=sqrt(p2parawr9*(l+linwr9+p2parawr9/4.0));
      pbwr9=-(linwr9+p2parawr9/4.0);
      pawr9=-1.0/p2parawr9;
      dxwr9=rwallthick9*sin(atan(-w2r9*2*pawr9));
      dzwr9=rwallthick9*cos(atan(-w2r9*2*pawr9));
      DIV1wrwt9=(linwr9+l-dzwr9)*(linwr9+l-dzwr9);
      p2parawrwt9=2.0*(sqrt(DIV1wrwt9+((w2r9+dxwr9)*(w2r9+dxwr9)))-sqrt(DIV1wrwt9));
      w1rwt9=sqrt(p2parawrwt9*(linwr9+p2parawrwt9/4.0));
      w2rwt9=sqrt(p2parawrwt9*(linwr9+l+p2parawrwt9/4.0));
      pbwrwt9=-(linwr9+p2parawrwt9/4.0);
      pawrwt9=-1.0/p2parawrwt9;
    }


if(linwr9==0 && loutwr9==0){
    w1rwt9=w1r9+rwallthick9/(cos(atan((w1r9-w2r9)/l)));
    w2rwt9=w2r9+rwallthick9/(cos(atan((w1r9-w2r9)/l)));
    }

lbwl9=linwl9+l+loutwl9;
z0wl9=(linwl9-l-loutwl9)/2.0;

if((linwl9!=0) && (loutwl9!=0) ) 
  { 
    u1wl9=sqrt((linwl9*linwl9)+(w1l9*w1l9));
    u2wl9=sqrt((w1l9*w1l9)+((l+loutwl9)*(l+loutwl9)));
    awl9=(u1wl9+u2wl9)/2.0;
    a2wl9=awl9*awl9;
    bwl9=sqrt(a2wl9-(lbwl9*lbwl9/4.0));
    b2wl9=bwl9*bwl9;
    DIV1wl9=sqrt(1.0-((lbwl9/2.0-loutwl9)*(lbwl9/2.0-loutwl9)/a2wl9));
    w2l9=bwl9*DIV1wl9;
    if(l<lbwl9/2-loutwl9){
        dxwl9=lwallthick9*sin(atan(a2wl9*w1l9/(b2wl9*z0wl9)));
        dzwl9=lwallthick9*cos(atan(a2wl9*w1l9/(b2wl9*z0wl9)));
    	u1wlwt9=sqrt(((linwl9+dzwl9)*(linwl9+dzwl9))+((w1l9+dxwl9)*(w1l9+dxwl9)));								
    	u2wlwt9=sqrt(((w1l9+dxwl9)*(w1l9+dxwl9))+((l+loutwl9-dzwl9)*(l+loutwl9-dzwl9)));	
    	awlwt9=(u1wlwt9+u2wlwt9)/2.0;
    	a2wlwt9=awlwt9*awlwt9;
    	bwlwt9=sqrt(a2wlwt9-(lbwl9*lbwl9/4.0));
    	b2wlwt9=bwlwt9*bwlwt9;
    	w2lwt9=bwlwt9*sqrt(1.0-((lbwl9/2.0-loutwl9)*(lbwl9/2.0-loutwl9)/a2wlwt9));
        w1lwt9=bwlwt9*sqrt(1.0-((lbwl9/2.0-loutwl9-l)*(lbwl9/2.0-loutwl9-l)/a2wlwt9));
    }else{
	bwlwt9=bwl9+lwallthick9;
        b2wlwt9=bwlwt9*bwlwt9;
        awlwt9=sqrt(b2wlwt9+(lbwl9*lbwl9/4.0));
        a2wlwt9=b2wlwt9+(lbwl9*lbwl9/4.0);
        w2lwt9=bwlwt9*sqrt(1.0-((lbwl9/2.0-loutwl9)*(lbwl9/2.0-loutwl9)/a2wlwt9));
        w1lwt9=bwlwt9*sqrt(1.0-((lbwl9/2.0-linwl9)*(lbwl9/2.0-linwl9)/a2wlwt9));
    }
   }


if(linwl9==0 && loutwl9!=0)
   {
    DIV1wl9=(l+loutwl9)*(l+loutwl9);
    p2parawl9=2.0*(sqrt(DIV1wl9+(w1l9*w1l9))-sqrt(DIV1wl9));
    w2l9=sqrt(p2parawl9*(loutwl9+p2parawl9/4.0));
    pbwl9=l+loutwl9+p2parawl9/4.0;
    pawl9=1.0/p2parawl9;
    dxwl9=lwallthick9*sin(atan(w1l9*2*pawl9));
    dzwl9=lwallthick9*cos(atan(w1l9*2*pawl9));
    DIV1wlwt9=(l+loutwl9-dzwl9)*(l+loutwl9-dzwl9);
    p2parawlwt9=2.0*(sqrt(DIV1wlwt9+((w1l9+dxwl9)*(w1l9+dxwl9)))-sqrt(DIV1wlwt9));
    pbwlwt9=l+loutwl9+p2parawlwt9/4.0;
    pawlwt9=1.0/p2parawlwt9;
    w2lwt9=sqrt(p2parawlwt9*(loutwl9+p2parawlwt9/4.0));
    w1lwt9=sqrt(p2parawlwt9*(loutwl9+l+p2parawlwt9/4.0));
   }

if (linwl9!=0 && loutwl9==0)
    {
      DIV1wl9=linwl9*linwl9;
      p2parawl9=2.0*(sqrt(DIV1wl9+(w1l9*w1l9))-sqrt(DIV1wl9));
      w2l9=sqrt(p2parawl9*(l+linwl9+p2parawl9/4.0));
      pbwl9=-(linwl9+p2parawl9/4.0);
      pawl9=-1.0/p2parawl9;
      dxwl9=lwallthick9*sin(atan(-w2l9*2*pawl9));
      dzwl9=lwallthick9*cos(atan(-w2l9*2*pawl9));
      DIV1wlwt9=(linwl9+l-dzwl9)*(linwl9+l-dzwl9);
      p2parawlwt9=2.0*(sqrt(DIV1wlwt9+((w2l9+dxwl9)*(w2l9+dxwl9)))-sqrt(DIV1wlwt9));
      w1lwt9=sqrt(p2parawlwt9*(linwl9+p2parawlwt9/4.0));
      w2lwt9=sqrt(p2parawlwt9*(linwl9+l+p2parawlwt9/4.0));
      pbwlwt9=-(linwl9+p2parawlwt9/4.0);
      pawlwt9=-1.0/p2parawlwt9;
    }

if(linwl9==0 && loutwl9==0){
    w1lwt9=w1l9+lwallthick9/(cos(atan((w2l9-w1l9)/l)));
    w2lwt9=w2l9+lwallthick9/(cos(atan((w2l9-w1l9)/l)));
    }


lbhu9=linhu9+l+louthu9;
z0hu9=lbhu9/2.0-l-louthu9;	

if (linhu9 != 0 && louthu9 !=0)
   {
    u1hu9=sqrt((linhu9*linhu9)+(h1u9*h1u9));
    u2hu9=sqrt((h1u9*h1u9)+((l+louthu9)*(l+louthu9)));
    ahu9=(u1hu9+u2hu9)/2.0;
    bhu9=sqrt(ahu9*ahu9-(lbhu9*lbhu9/4.0));
    a2hu9=ahu9*ahu9;
    b2hu9=bhu9*bhu9;
    DIV1hu9=sqrt(1.0-((lbhu9/2.0-louthu9)*(lbhu9/2.0-louthu9)/a2hu9));
    h2u9=bhu9*DIV1hu9;
    if(l<lbhu9/2-louthu9){
        dyhu9=uwallthick9*sin(atan(a2hu9*h1u9/(b2hu9*z0hu9)));
        dzhu9=uwallthick9*cos(atan(a2hu9*h1u9/(b2hu9*z0hu9)));
    	u1huwt9=sqrt(((linhu9+dzhu9)*(linhu9+dzhu9))+((h1u9+dyhu9)*(h1u9+dyhu9)));								
    	u2huwt9=sqrt(((h1u9+dyhu9)*(h1u9+dyhu9))+((l+louthu9-dzhu9)*(l+louthu9-dzhu9)));	
    	ahuwt9=(u1huwt9+u2huwt9)/2.0;
    	a2huwt9=ahuwt9*ahuwt9;
    	bhuwt9=sqrt(a2huwt9-(lbhu9*lbhu9/4.0));
    	b2huwt9=bhuwt9*bhuwt9;
    	h2uwt9=bhuwt9*sqrt(1.0-((lbhu9/2.0-louthu9)*(lbhu9/2.0-louthu9)/a2huwt9));
        h1uwt9=bhuwt9*sqrt(1.0-((lbhu9/2.0-louthu9-l)*(lbhu9/2.0-louthu9-l)/a2huwt9));
    }else{
	bhuwt9=bhu9+uwallthick9;
        b2huwt9=bhuwt9*bhuwt9;
        ahuwt9=sqrt(b2huwt9+(lbhu9*lbhu9/4.0));
        a2huwt9=b2huwt9+(lbhu9*lbhu9/4.0);
        h2uwt9=bhuwt9*sqrt(1.0-((lbhu9/2.0-louthu9)*(lbhu9/2.0-louthu9)/a2huwt9));
        h1uwt9=bhuwt9*sqrt(1.0-((lbhu9/2.0-linhu9)*(lbhu9/2.0-linhu9)/a2huwt9));
    }
  }

if(linhu9==0 && louthu9!=0)
   { 	
    DIV1hu9=(l+louthu9)*(l+louthu9);
    p2parahu9=2.0*(sqrt(DIV1hu9+(h1u9*h1u9))-sqrt(DIV1hu9));
    h2u9=sqrt(p2parahu9*(louthu9+p2parahu9/4.0));
    pbhu9=l+louthu9+p2parahu9/4.0;
    pahu9=1.0/p2parahu9;
    dyhu9=uwallthick9*sin(atan(h1u9*2*pahu9));
    dzhu9=uwallthick9*cos(atan(h1u9*2*pahu9));
    DIV1huwt9=(l+louthu9-dzhu9)*(l+louthu9-dzhu9);
    p2parahuwt9=2.0*(sqrt(DIV1huwt9+((h1u9+dyhu9)*(h1u9+dyhu9)))-sqrt(DIV1huwt9));
    pbhuwt9=l+louthu9+p2parahuwt9/4.0;
    pahuwt9=1.0/p2parahuwt9;
    h2uwt9=sqrt(p2parahuwt9*(louthu9+p2parahuwt9/4.0));
    h1uwt9=sqrt(p2parahuwt9*(louthu9+l+p2parahuwt9/4.0));
   } 

if (linhu9!=0 && louthu9==0)
    {
      DIV1hu9=linhu9*linhu9;
      p2parahu9=2.0*(sqrt(DIV1hu9+(h1u9*h1u9))-sqrt(DIV1hu9));
      h2u9=sqrt(p2parahu9*(l+linhu9+p2parahu9/4.0));
      pbhu9=-(linhu9+p2parahu9/4.0);
      pahu9=-1.0/p2parahu9;
      dyhu9=uwallthick9*sin(atan(-h2u9*2*pahu9));
      dzhu9=uwallthick9*cos(atan(-h2u9*2*pahu9));
      DIV1huwt9=(linhu9+l-dzhu9)*(linhu9+l-dzhu9);
      p2parahuwt9=2.0*(sqrt(DIV1huwt9+((h2u9+dyhu9)*(h2u9+dyhu9)))-sqrt(DIV1huwt9));
      h1uwt9=sqrt(p2parahuwt9*(linhu9+p2parahuwt9/4.0));
      h2uwt9=sqrt(p2parahuwt9*(linhu9+l+p2parahuwt9/4.0));
      pbhuwt9=-(linhu9+p2parahuwt9/4.0);
      pahuwt9=-1.0/p2parahuwt9;
    }

if(linhu9==0 && louthu9==0){
    h1uwt9=h1u9+uwallthick9/(cos(atan((h2u9-h1u9)/l)));
    h2uwt9=h2u9+uwallthick9/(cos(atan((h2u9-h1u9)/l)));
    }


lbhd9=linhd9+l+louthd9;
z0hd9=lbhd9/2.0-l-louthd9;

if (linhd9 != 0 && louthd9 !=0)
   {
    u1hd9=sqrt((linhd9*linhd9)+(h1d9*h1d9));
    u2hd9=sqrt((h1d9*h1d9)+((l+louthd9)*(l+louthd9)));
    ahd9=(u1hd9+u2hd9)/2.0;
    bhd9=sqrt(ahd9*ahd9-(lbhd9*lbhd9/4.0));
    a2hd9=ahd9*ahd9;
    b2hd9=bhd9*bhd9;
    DIV1hd9=sqrt(1.0-((lbhd9/2.0-louthd9)*(lbhd9/2.0-louthd9)/a2hd9));
    h2d9=bhd9*DIV1hd9;
    if(l<lbhd9/21-louthd9){
        dyhd9=dwallthick9*sin(atan(a2hd9*h1d9/(b2hd9*z0hd9)));
        dzhd9=dwallthick9*cos(atan(a2hd9*h1d9/(b2hd9*z0hd9)));
    	u1hdwt9=sqrt(((linhd9+dzhd9)*(linhd9+dzhd9))+((h1d9+dyhd9)*(h1d9+dyhd9)));	
    	u2hdwt9=sqrt(((h1d9+dyhd9)*(h1d9+dyhd9))+((l+louthd9-dzhd9)*(l+louthd9-dzhd9)));
    	ahdwt9=(u1hdwt9+u2hdwt9)/2.0;
    	a2hdwt9=ahdwt9*ahdwt9;
    	bhdwt9=sqrt(a2hdwt9-(lbhd9*lbhd9/4.0));
    	b2hdwt9=bhdwt9*bhdwt9;
    	h2dwt9=bhdwt9*sqrt(1.0-((lbhd9/2.0-louthd9)*(lbhd9/2.0-louthd9)/a2hdwt9));
        h1dwt9=bhdwt9*sqrt(1.0-((lbhd9/2.0-louthd9-l)*(lbhd9/2.0-louthd9-l)/a2hdwt9));
    }else{
	bhdwt9=bhd9+dwallthick9;
        b2hdwt9=bhdwt9*bhdwt9;
        ahdwt9=sqrt(b2hdwt9+(lbhd9*lbhd9/4.0));
        a2hdwt9=b2hdwt9+(lbhd9*lbhd9/4.0);
        h2dwt9=bhdwt9*sqrt(1.0-((lbhd9/2.0-louthd9)*(lbhd9/2.0-louthd9)/a2hdwt9));
        h1dwt9=bhdwt9*sqrt(1.0-((lbhd9/2.0-linhd9)*(lbhd9/2.0-linhd9)/a2hdwt9));
    }
  }

if(linhd9==0 && louthd9!=0)
   {	
    DIV1hd9=(l+louthd9)*(l+louthd9);
    p2parahd9=2.0*(sqrt(DIV1hd9+(h1d9*h1d9))-sqrt(DIV1hd9));
    h2d9=sqrt(p2parahd9*(louthd9+p2parahd9/4.0));
    pbhd9=l+louthd9+p2parahd9/4.0;
    pahd9=1.0/p2parahd9;
    dyhd9=dwallthick9*sin(atan(h1d9*2*pahd9));
    dzhd9=dwallthick9*cos(atan(h1d9*2*pahd9));
    DIV1hdwt9=(l+louthd9-dzhd9)*(l+louthd9-dzhd9);
    p2parahdwt9=2.0*(sqrt(DIV1hdwt9+((h1d9+dyhd9)*(h1d9+dyhd9)))-sqrt(DIV1hdwt9));
    pbhdwt9=l+louthd9+p2parahdwt9/4.0;
    pahdwt9=1.0/p2parahdwt9;
    h2dwt9=sqrt(p2parahdwt9*(louthd9+p2parahdwt9/4.0));
    h1dwt9=sqrt(p2parahdwt9*(louthd9+l+p2parahdwt9/4.0));
   }

if (linhd9!=0 && louthd9==0)
    {
      DIV1hd9=linhd9*linhd9;
      p2parahd9=2.0*(sqrt(DIV1hd9+(h1d9*h1d9))-sqrt(DIV1hd9));
      h2d9=sqrt(p2parahd9*(l+linhd9+p2parahd9/4.0));
      pbhd9=-(linhd9+p2parahd9/4.0);
      pahd9=-1.0/p2parahd9;
      dyhd9=dwallthick9*sin(atan(-h2d9*2*pahd9));
      dzhd9=dwallthick9*cos(atan(-h2d9*2*pahd9));
      DIV1hdwt9=(linhd9+l-dzhd9)*(linhd9+l-dzhd9);
      p2parahdwt9=2.0*(sqrt(DIV1hdwt9+((h2d9+dyhd9)*(h2d9+dyhd9)))-sqrt(DIV1hdwt9));
      h1dwt9=sqrt(p2parahdwt9*(linhd9+p2parahdwt9/4.0));
      h2dwt9=sqrt(p2parahdwt9*(linhd9+l+p2parahdwt9/4.0));
      pbhdwt9=-(linhd9+p2parahdwt9/4.0);
      pahdwt9=-1.0/p2parahdwt9;
    }

if(linhd9==0 && louthd9==0){
    h1dwt9=h1d9+dwallthick9/(cos(atan((h2d9-h1d9)/l)));
    h2dwt9=h2d9+dwallthick9/(cos(atan((h2d9-h1d9)/l)));
    }



mru19=(h1uwt9-h1u9)/(w1r9-w1rwt9);
nru19=h1u9-mru19*(-w1r9);
mru29=(h2uwt9-h2u9)/(w2r9-w2rwt9);
nru29=h2u9-mru29*(-w2r9);

mrd19=(-h1dwt9+h1d9)/(w1r9-w1rwt9);
nrd19=-h1d9-mrd19*(-w1r9);
mrd29=(-h2dwt9+h2d9)/(w2r9-w2rwt9);
nrd29=-h2d9-mrd29*(-w2r9);

mlu19=(h1uwt9-h1u9)/(-w1l9+w1lwt9);
nlu19=h1u9-mlu19*w1l9;
mlu29=(h2uwt9-h2u9)/(-w2l9+w2lwt9);
nlu29=h2u9-mlu29*w2l9;

mld19=(-h1dwt9+h1d9)/(-w1l9+w1lwt9);
nld19=-h1d9-mld19*w1l9;
mld29=(-h2dwt9+h2d9)/(-w2l9+w2lwt9);
nld29=-h2d9-mld29*w2l9;



if (w1r9 < w1rwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r9 have to be bigger or equal w1rwt8 \n");
    printf(" w1r9= %f \n",w1r9 );
    printf(" w1rwt8= %f \n",w1rwt8 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l9 < w1lwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l9 have to be bigger or equal w1lwt8 \n");
    printf(" w1l9= %f \n",w1l9 );
    printf(" w1lwt8= %f \n",w1lwt8 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u9 < h1uwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u9 have to be bigger or equal h1uwt8 \n");
    printf(" h1u9= %f \n",h1u9 );
    printf(" h1uwt8= %f \n",h1uwt8 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d9 < h1dwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d9 have to be bigger or equal h1dwt8 \n");
    printf(" h1d9= %f \n",h1d9 );
    printf(" h1dwt8= %f \n",h1dwt8 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r9 < w2rwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r9 have to be bigger or equal w2rwt8 \n");
    printf(" w2r9= %f \n",w2r9 );
    printf(" w2rwt8= %f \n",w2rwt8 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l9 < w2lwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l9 have to be bigger or equal w2lwt8 \n");
    printf(" w2l9= %f \n",w2l9 );
    printf(" w2lwt8= %f \n",w2lwt8 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u9 < h2uwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u9 have to be bigger or equal h2uwt8 \n");
    printf(" h2u9= %f \n",h2u9 );
    printf(" h2uwt8= %f \n",h2uwt8 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d9 < h2dwt8)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d9 have to be bigger or equal h2dwt8 \n");
    printf(" h2d9= %f \n",h2d9 );
    printf(" h2dwt8= %f \n",h2dwt8 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }


lbwr10=linwr10+l+loutwr10;
z0wr10=(linwr10-l-loutwr10)/2.0;

if(loutwr10!=0 && linwr10!=0)
  { 
    u1wr10=sqrt((linwr10*linwr10)+(w1r10*w1r10));
    u2wr10=sqrt((w1r10*w1r10)+((l+loutwr10)*(l+loutwr10)));
    awr10=(u1wr10+u2wr10)/2.0;
    a2wr10=awr10*awr10;
    bwr10=sqrt(a2wr10-(lbwr10*lbwr10/4.0));
    b2wr10=bwr10*bwr10;
    DIV1wr10=sqrt(1.0-((lbwr10/2.0-loutwr10)*(lbwr10/2.0-loutwr10)/a2wr10));
    w2r10=bwr10*DIV1wr10;
    if(l<lbwr10/2-loutwr10){
        dxwr10=rwallthick10*sin(atan(a2wr10*w1r10/(b2wr10*z0wr10)));
        dzwr10=rwallthick10*cos(atan(a2wr10*w1r10/(b2wr10*z0wr10)));
    	u1wrwt10=sqrt(((linwr10+dzwr10)*(linwr10+dzwr10))+((w1r10+dxwr10)*(w1r10+dxwr10)));
    	u2wrwt10=sqrt(((w1r10+dxwr10)*(w1r10+dxwr10))+((l+loutwr10-dzwr10)*(l+loutwr10-dzwr10)));
    	awrwt10=(u1wrwt10+u2wrwt10)/2.0;
    	a2wrwt10=awrwt10*awrwt10;
    	bwrwt10=sqrt(a2wrwt10-(lbwr10*lbwr10/4.0));
    	b2wrwt10=bwrwt10*bwrwt10;
    	w2rwt10=bwrwt10*sqrt(1.0-((lbwr10/2.0-loutwr10)*(lbwr10/2.0-loutwr10)/a2wrwt10));
        w1rwt10=bwrwt10*sqrt(1.0-((lbwr10/2.0-loutwr10-l)*(lbwr10/2.0-loutwr10-l)/a2wrwt10));
    }else{
	bwrwt10=bwr10+rwallthick10;
        b2wrwt10=bwrwt10*bwrwt10;
        awrwt10=sqrt(b2wrwt10+(lbwr10*lbwr10/4.0));
        a2wrwt10=b2wrwt10+(lbwr10*lbwr10/4.0);
        w2rwt10=bwrwt10*sqrt(1.0-((lbwr10/2.0-loutwr10)*(lbwr10/2.0-loutwr10)/a2wrwt10));
        w1rwt10=bwrwt10*sqrt(1.0-((lbwr10/2.0-linwr10)*(lbwr10/2.0-linwr10)/a2wrwt10));
    }
   }



if(linwr10==0 && loutwr10!=0){
    DIV1wr10=(l+loutwr10)*(l+loutwr10);
    p2parawr10=2.0*(sqrt(DIV1wr10+(w1r10*w1r10))-sqrt(DIV1wr10));
    w2r10=sqrt(p2parawr10*(loutwr10+p2parawr10/4.0));
    pbwr10=l+loutwr10+p2parawr10/4.0;
    pawr10=1.0/p2parawr10;
    dxwr10=rwallthick10*sin(atan(w1r10*2*pawr10));
    dzwr10=rwallthick10*cos(atan(w1r10*2*pawr10));
    DIV1wrwt10=(l+loutwr10-dzwr10)*(l+loutwl10-dzwr10);
    p2parawrwt10=2.0*(sqrt(DIV1wrwt10+((w1r10+dxwr10)*(w1r10+dxwr10)))-sqrt(DIV1wrwt10));
    pbwrwt10=l+loutwr10+p2parawrwt10/4.0;
    pawrwt10=1.0/p2parawrwt10;
    w2rwt10=sqrt(p2parawrwt10*(loutwr10+p2parawrwt10/4.0));
    w1rwt10=sqrt(p2parawrwt10*(loutwr10+l+p2parawrwt10/4.0));
   }



if (linwr10!=0 && loutwr10==0)
    {
      DIV1wr10=linwr10*linwr10;
      p2parawr10=2.0*(sqrt(DIV1wr10+(w1r10*w1r10))-sqrt(DIV1wr10));
      w2r10=sqrt(p2parawr10*(l+linwr10+p2parawr10/4.0));
      pbwr10=-(linwr10+p2parawr10/4.0);
      pawr10=-1.0/p2parawr10;
      dxwr10=rwallthick10*sin(atan(-w2r10*2*pawr10));
      dzwr10=rwallthick10*cos(atan(-w2r10*2*pawr10));
      DIV1wrwt10=(linwr10+l-dzwr10)*(linwr10+l-dzwr10);
      p2parawrwt10=2.0*(sqrt(DIV1wrwt10+((w2r10+dxwr10)*(w2r10+dxwr10)))-sqrt(DIV1wrwt10));
      w1rwt10=sqrt(p2parawrwt10*(linwr10+p2parawrwt10/4.0));
      w2rwt10=sqrt(p2parawrwt10*(linwr10+l+p2parawrwt10/4.0));
      pbwrwt10=-(linwr10+p2parawrwt10/4.0);
      pawrwt10=-1.0/p2parawrwt10;
    }


if(linwr10==0 && loutwr10==0){
    w1rwt10=w1r10+rwallthick10/(cos(atan((w1r10-w2r10)/l)));
    w2rwt10=w2r10+rwallthick10/(cos(atan((w1r10-w2r10)/l)));
    }

lbwl10=linwl10+l+loutwl10;
z0wl10=(linwl10-l-loutwl10)/2.0;

if((linwl10!=0) && (loutwl10!=0) ) 
  { 
    u1wl10=sqrt((linwl10*linwl10)+(w1l10*w1l10));
    u2wl10=sqrt((w1l10*w1l10)+((l+loutwl10)*(l+loutwl10)));
    awl10=(u1wl10+u2wl10)/2.0;
    a2wl10=awl10*awl10;
    bwl10=sqrt(a2wl10-(lbwl10*lbwl10/4.0));
    b2wl10=bwl10*bwl10;
    DIV1wl10=sqrt(1.0-((lbwl10/2.0-loutwl10)*(lbwl10/2.0-loutwl10)/a2wl10));
    w2l10=bwl10*DIV1wl10;
    if(l<lbwl10/2-loutwl10){
        dxwl10=lwallthick10*sin(atan(a2wl10*w1l10/(b2wl10*z0wl10)));
        dzwl10=lwallthick10*cos(atan(a2wl10*w1l10/(b2wl10*z0wl10)));
    	u1wlwt10=sqrt(((linwl10+dzwl10)*(linwl10+dzwl10))+((w1l10+dxwl10)*(w1l10+dxwl10)));								
    	u2wlwt10=sqrt(((w1l10+dxwl10)*(w1l10+dxwl10))+((l+loutwl10-dzwl10)*(l+loutwl10-dzwl10)));	
    	awlwt10=(u1wlwt10+u2wlwt10)/2.0;
    	a2wlwt10=awlwt10*awlwt10;
    	bwlwt10=sqrt(a2wlwt10-(lbwl10*lbwl10/4.0));
    	b2wlwt10=bwlwt10*bwlwt10;
    	w2lwt10=bwlwt10*sqrt(1.0-((lbwl10/2.0-loutwl10)*(lbwl10/2.0-loutwl10)/a2wlwt10));
        w1lwt10=bwlwt10*sqrt(1.0-((lbwl10/2.0-loutwl10-l)*(lbwl10/2.0-loutwl10-l)/a2wlwt10));
    }else{
	bwlwt10=bwl10+lwallthick10;
        b2wlwt10=bwlwt10*bwlwt10;
        awlwt10=sqrt(b2wlwt10+(lbwl10*lbwl10/4.0));
        a2wlwt10=b2wlwt10+(lbwl10*lbwl10/4.0);
        w2lwt10=bwlwt10*sqrt(1.0-((lbwl10/2.0-loutwl10)*(lbwl10/2.0-loutwl10)/a2wlwt10));
        w1lwt10=bwlwt10*sqrt(1.0-((lbwl10/2.0-linwl10)*(lbwl10/2.0-linwl10)/a2wlwt10));
    }
   }


if(linwl10==0 && loutwl10!=0)
   {
    DIV1wl10=(l+loutwl10)*(l+loutwl10);
    p2parawl10=2.0*(sqrt(DIV1wl10+(w1l10*w1l10))-sqrt(DIV1wl10));
    w2l10=sqrt(p2parawl10*(loutwl10+p2parawl10/4.0));
    pbwl10=l+loutwl10+p2parawl10/4.0;
    pawl10=1.0/p2parawl10;
    dxwl10=lwallthick10*sin(atan(w1l10*2*pawl10));
    dzwl10=lwallthick10*cos(atan(w1l10*2*pawl10));
    DIV1wlwt10=(l+loutwl10-dzwl10)*(l+loutwl10-dzwl10);
    p2parawlwt10=2.0*(sqrt(DIV1wlwt10+((w1l10+dxwl10)*(w1l10+dxwl10)))-sqrt(DIV1wlwt10));
    pbwlwt10=l+loutwl10+p2parawlwt10/4.0;
    pawlwt10=1.0/p2parawlwt10;
    w2lwt10=sqrt(p2parawlwt10*(loutwl10+p2parawlwt10/4.0));
    w1lwt10=sqrt(p2parawlwt10*(loutwl10+l+p2parawlwt10/4.0));
   }

if (linwl10!=0 && loutwl10==0)
    {
      DIV1wl10=linwl10*linwl10;
      p2parawl10=2.0*(sqrt(DIV1wl10+(w1l10*w1l10))-sqrt(DIV1wl10));
      w2l10=sqrt(p2parawl10*(l+linwl10+p2parawl10/4.0));
      pbwl10=-(linwl10+p2parawl10/4.0);
      pawl10=-1.0/p2parawl10;
      dxwl10=lwallthick10*sin(atan(-w2l10*2*pawl10));
      dzwl10=lwallthick10*cos(atan(-w2l10*2*pawl10));
      DIV1wlwt10=(linwl10+l-dzwl10)*(linwl10+l-dzwl10);
      p2parawlwt10=2.0*(sqrt(DIV1wlwt10+((w2l10+dxwl10)*(w2l10+dxwl10)))-sqrt(DIV1wlwt10));
      w1lwt10=sqrt(p2parawlwt10*(linwl10+p2parawlwt10/4.0));
      w2lwt10=sqrt(p2parawlwt10*(linwl10+l+p2parawlwt10/4.0));
      pbwlwt10=-(linwl10+p2parawlwt10/4.0);
      pawlwt10=-1.0/p2parawlwt10;
    }

if(linwl10==0 && loutwl10==0){
    w1lwt10=w1l10+lwallthick10/(cos(atan((w2l10-w1l10)/l)));
    w2lwt10=w2l10+lwallthick10/(cos(atan((w2l10-w1l10)/l)));
    }


lbhu10=linhu10+l+louthu10;
z0hu10=lbhu10/2.0-l-louthu10;	

if (linhu10 != 0 && louthu10 !=0)
   {
    u1hu10=sqrt((linhu10*linhu10)+(h1u10*h1u10));
    u2hu10=sqrt((h1u10*h1u10)+((l+louthu10)*(l+louthu10)));
    ahu10=(u1hu10+u2hu10)/2.0;
    bhu10=sqrt(ahu10*ahu10-(lbhu10*lbhu10/4.0));
    a2hu10=ahu10*ahu10;
    b2hu10=bhu10*bhu10;
    DIV1hu10=sqrt(1.0-((lbhu10/2.0-louthu10)*(lbhu10/2.0-louthu10)/a2hu10));
    h2u10=bhu10*DIV1hu10;
    if(l<lbhu10/2-louthu10){
        dyhu10=uwallthick10*sin(atan(a2hu10*h1u10/(b2hu10*z0hu10)));
        dzhu10=uwallthick10*cos(atan(a2hu10*h1u10/(b2hu10*z0hu10)));
    	u1huwt10=sqrt(((linhu10+dzhu10)*(linhu10+dzhu10))+((h1u10+dyhu10)*(h1u10+dyhu10)));								
    	u2huwt10=sqrt(((h1u10+dyhu10)*(h1u10+dyhu10))+((l+louthu10-dzhu10)*(l+louthu10-dzhu10)));	
    	ahuwt10=(u1huwt10+u2huwt10)/2.0;
    	a2huwt10=ahuwt10*ahuwt10;
    	bhuwt10=sqrt(a2huwt10-(lbhu10*lbhu10/4.0));
    	b2huwt10=bhuwt10*bhuwt10;
    	h2uwt10=bhuwt10*sqrt(1.0-((lbhu10/2.0-louthu10)*(lbhu10/2.0-louthu10)/a2huwt10));
        h1uwt10=bhuwt10*sqrt(1.0-((lbhu10/2.0-louthu10-l)*(lbhu10/2.0-louthu10-l)/a2huwt10));
    }else{
	bhuwt10=bhu10+uwallthick10;
        b2huwt10=bhuwt10*bhuwt10;
        ahuwt10=sqrt(b2huwt10+(lbhu10*lbhu10/4.0));
        a2huwt10=b2huwt10+(lbhu10*lbhu10/4.0);
        h2uwt10=bhuwt10*sqrt(1.0-((lbhu10/2.0-louthu10)*(lbhu10/2.0-louthu10)/a2huwt10));
        h1uwt10=bhuwt10*sqrt(1.0-((lbhu10/2.0-linhu10)*(lbhu10/2.0-linhu10)/a2huwt10));
    }
  }

if(linhu10==0 && louthu10!=0)
   { 	
    DIV1hu10=(l+louthu10)*(l+louthu10);
    p2parahu10=2.0*(sqrt(DIV1hu10+(h1u10*h1u10))-sqrt(DIV1hu10));
    h2u10=sqrt(p2parahu10*(louthu10+p2parahu10/4.0));
    pbhu10=l+louthu10+p2parahu10/4.0;
    pahu10=1.0/p2parahu10;
    dyhu10=uwallthick10*sin(atan(h1u10*2*pahu10));
    dzhu10=uwallthick10*cos(atan(h1u10*2*pahu10));
    DIV1huwt10=(l+louthu10-dzhu10)*(l+louthu10-dzhu10);
    p2parahuwt10=2.0*(sqrt(DIV1huwt10+((h1u10+dyhu10)*(h1u10+dyhu10)))-sqrt(DIV1huwt10));
    pbhuwt10=l+louthu10+p2parahuwt10/4.0;
    pahuwt10=1.0/p2parahuwt10;
    h2uwt10=sqrt(p2parahuwt10*(louthu10+p2parahuwt10/4.0));
    h1uwt10=sqrt(p2parahuwt10*(louthu10+l+p2parahuwt10/4.0));
   } 

if (linhu10!=0 && louthu10==0)
    {
      DIV1hu10=linhu10*linhu10;
      p2parahu10=2.0*(sqrt(DIV1hu10+(h1u10*h1u10))-sqrt(DIV1hu10));
      h2u10=sqrt(p2parahu10*(l+linhu10+p2parahu10/4.0));
      pbhu10=-(linhu10+p2parahu10/4.0);
      pahu10=-1.0/p2parahu10;
      dyhu10=uwallthick10*sin(atan(-h2u10*2*pahu10));
      dzhu10=uwallthick10*cos(atan(-h2u10*2*pahu10));
      DIV1huwt10=(linhu10+l-dzhu10)*(linhu10+l-dzhu10);
      p2parahuwt10=2.0*(sqrt(DIV1huwt10+((h2u10+dyhu10)*(h2u10+dyhu10)))-sqrt(DIV1huwt10));
      h1uwt10=sqrt(p2parahuwt10*(linhu10+p2parahuwt10/4.0));
      h2uwt10=sqrt(p2parahuwt10*(linhu10+l+p2parahuwt10/4.0));
      pbhuwt10=-(linhu10+p2parahuwt10/4.0);
      pahuwt10=-1.0/p2parahuwt10;
    }

if(linhu10==0 && louthu10==0){
    h1uwt10=h1u10+uwallthick10/(cos(atan((h2u10-h1u10)/l)));
    h2uwt10=h2u10+uwallthick10/(cos(atan((h2u10-h1u10)/l)));
    }


lbhd10=linhd10+l+louthd10;
z0hd10=lbhd10/2.0-l-louthd10;

if (linhd10 != 0 && louthd10 !=0)
   {
    u1hd10=sqrt((linhd10*linhd10)+(h1d10*h1d10));
    u2hd10=sqrt((h1d10*h1d10)+((l+louthd10)*(l+louthd10)));
    ahd10=(u1hd10+u2hd10)/2.0;
    bhd10=sqrt(ahd10*ahd10-(lbhd10*lbhd10/4.0));
    a2hd10=ahd10*ahd10;
    b2hd10=bhd10*bhd10;
    DIV1hd10=sqrt(1.0-((lbhd10/2.0-louthd10)*(lbhd10/2.0-louthd10)/a2hd10));
    h2d10=bhd10*DIV1hd10;
    if(l<lbhd10/21-louthd10){
        dyhd10=dwallthick10*sin(atan(a2hd10*h1d10/(b2hd10*z0hd10)));
        dzhd10=dwallthick10*cos(atan(a2hd10*h1d10/(b2hd10*z0hd10)));
    	u1hdwt10=sqrt(((linhd10+dzhd10)*(linhd10+dzhd10))+((h1d10+dyhd10)*(h1d10+dyhd10)));	
    	u2hdwt10=sqrt(((h1d10+dyhd10)*(h1d10+dyhd10))+((l+louthd10-dzhd10)*(l+louthd10-dzhd10)));
    	ahdwt10=(u1hdwt10+u2hdwt10)/2.0;
    	a2hdwt10=ahdwt10*ahdwt10;
    	bhdwt10=sqrt(a2hdwt10-(lbhd10*lbhd10/4.0));
    	b2hdwt10=bhdwt10*bhdwt10;
    	h2dwt10=bhdwt10*sqrt(1.0-((lbhd10/2.0-louthd10)*(lbhd10/2.0-louthd10)/a2hdwt10));
        h1dwt10=bhdwt10*sqrt(1.0-((lbhd10/2.0-louthd10-l)*(lbhd10/2.0-louthd10-l)/a2hdwt10));
    }else{
	bhdwt10=bhd10+dwallthick10;
        b2hdwt10=bhdwt10*bhdwt10;
        ahdwt10=sqrt(b2hdwt10+(lbhd10*lbhd10/4.0));
        a2hdwt10=b2hdwt10+(lbhd10*lbhd10/4.0);
        h2dwt10=bhdwt10*sqrt(1.0-((lbhd10/2.0-louthd10)*(lbhd10/2.0-louthd10)/a2hdwt10));
        h1dwt10=bhdwt10*sqrt(1.0-((lbhd10/2.0-linhd10)*(lbhd10/2.0-linhd10)/a2hdwt10));
    }
  }

if(linhd10==0 && louthd10!=0)
   {	
    DIV1hd10=(l+louthd10)*(l+louthd10);
    p2parahd10=2.0*(sqrt(DIV1hd10+(h1d10*h1d10))-sqrt(DIV1hd10));
    h2d10=sqrt(p2parahd10*(louthd10+p2parahd10/4.0));
    pbhd10=l+louthd10+p2parahd10/4.0;
    pahd10=1.0/p2parahd10;
    dyhd10=dwallthick10*sin(atan(h1d10*2*pahd10));
    dzhd10=dwallthick10*cos(atan(h1d10*2*pahd10));
    DIV1hdwt10=(l+louthd10-dzhd10)*(l+louthd10-dzhd10);
    p2parahdwt10=2.0*(sqrt(DIV1hdwt10+((h1d10+dyhd10)*(h1d10+dyhd10)))-sqrt(DIV1hdwt10));
    pbhdwt10=l+louthd10+p2parahdwt10/4.0;
    pahdwt10=1.0/p2parahdwt10;
    h2dwt10=sqrt(p2parahdwt10*(louthd10+p2parahdwt10/4.0));
    h1dwt10=sqrt(p2parahdwt10*(louthd10+l+p2parahdwt10/4.0));
   }

if (linhd10!=0 && louthd10==0)
    {
      DIV1hd10=linhd10*linhd10;
      p2parahd10=2.0*(sqrt(DIV1hd10+(h1d10*h1d10))-sqrt(DIV1hd10));
      h2d10=sqrt(p2parahd10*(l+linhd10+p2parahd10/4.0));
      pbhd10=-(linhd10+p2parahd10/4.0);
      pahd10=-1.0/p2parahd10;
      dyhd10=dwallthick10*sin(atan(-h2d10*2*pahd10));
      dzhd10=dwallthick10*cos(atan(-h2d10*2*pahd10));
      DIV1hdwt10=(linhd10+l-dzhd10)*(linhd10+l-dzhd10);
      p2parahdwt10=2.0*(sqrt(DIV1hdwt10+((h2d10+dyhd10)*(h2d10+dyhd10)))-sqrt(DIV1hdwt10));
      h1dwt10=sqrt(p2parahdwt10*(linhd10+p2parahdwt10/4.0));
      h2dwt10=sqrt(p2parahdwt10*(linhd10+l+p2parahdwt10/4.0));
      pbhdwt10=-(linhd10+p2parahdwt10/4.0);
      pahdwt10=-1.0/p2parahdwt10;
    }

if(linhd10==0 && louthd10==0){
    h1dwt10=h1d10+dwallthick10/(cos(atan((h2d10-h1d10)/l)));
    h2dwt10=h2d10+dwallthick10/(cos(atan((h2d10-h1d10)/l)));
    }



mru110=(h1uwt10-h1u10)/(w1r10-w1rwt10);
nru110=h1u10-mru110*(-w1r10);
mru210=(h2uwt10-h2u10)/(w2r10-w2rwt10);
nru210=h2u10-mru210*(-w2r10);

mrd110=(-h1dwt10+h1d10)/(w1r10-w1rwt10);
nrd110=-h1d10-mrd110*(-w1r10);
mrd210=(-h2dwt10+h2d10)/(w2r10-w2rwt10);
nrd210=-h2d10-mrd210*(-w2r10);

mlu110=(h1uwt10-h1u10)/(-w1l10+w1lwt10);
nlu110=h1u10-mlu110*w1l10;
mlu210=(h2uwt10-h2u10)/(-w2l10+w2lwt10);
nlu210=h2u10-mlu210*w2l10;

mld110=(-h1dwt10+h1d10)/(-w1l10+w1lwt10);
nld110=-h1d10-mld110*w1l10;
mld210=(-h2dwt10+h2d10)/(-w2l10+w2lwt10);
nld210=-h2d10-mld210*w2l10;



if (w1r10 < w1rwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1r10 have to be bigger or equal w1rwt9 \n");
    printf(" w1r10= %f \n",w1r10 );
    printf(" w1rwt9= %f \n",w1rwt9 );
    fprintf(stderr,"           check input and wallthicknesses! \n");
    exit(-1);
  }

if (w1l10 < w1lwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w1l10 have to be bigger or equal w1lwt9 \n");
    printf(" w1l10= %f \n",w1l10 );
    printf(" w1lwt9= %f \n",w1lwt9 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1u10 < h1uwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1u10 have to be bigger or equal h1uwt9 \n");
    printf(" h1u10= %f \n",h1u10 );
    printf(" h1uwt9= %f \n",h1uwt9 );
    fprintf(stderr,"           check input parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h1d10 < h1dwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h1d10 have to be bigger or equal h1dwt9 \n");
    printf(" h1d10= %f \n",h1d10 );
    printf(" h1dwt9= %f \n",h1dwt9 );
    fprintf(stderr,"           check curve parameter and walltchicknesses! \n");
    exit(-1);
  }


if (w2r10 < w2rwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2r10 have to be bigger or equal w2rwt9 \n");
    printf(" w2r10= %f \n",w2r10 );
    printf(" w2rwt9= %f \n",w2rwt9 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (w2l10 < w2lwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           w2l10 have to be bigger or equal w2lwt9 \n");
    printf(" w2l10= %f \n",w2l10 );
    printf(" w2lwt9= %f \n",w2lwt9 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2u10 < h2uwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2u10 have to be bigger or equal h2uwt9 \n");
    printf(" h2u10= %f \n",h2u10 );
    printf(" h2uwt9= %f \n",h2uwt9 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }

if (h2d10 < h2dwt9)
  {
    fprintf(stderr,"Component: %s (Guide_four_side) \n", NAME_CURRENT_COMP);
    fprintf(stderr,"           h2d10 have to be bigger or equal h2dwt9 \n");
    printf(" h2d10= %f \n",h2d10 );
    printf(" h2dwt9= %f \n",h2dwt9 );
    fprintf(stderr,"           check curve parameter and wallthicknesses! \n");
    exit(-1);
  }



%}



TRACE
%{

  int i;

  PROP_Z0;												/* Propagate neutron to guide entrance. */ 


  if(x <= -w1r && x >= -w1rwt && y <= mru1*x+nru1 && y>= mrd1*x+nrd1 && mxr!=-1 && mxrOW!=-1)		/* absorbing the neutron if it hit the RIGHT entrance wall and the wall is not transparent*/
      ABSORB;
  if(x >= w1l && x <=  w1lwt && y <= mlu1*x+nlu1 && y>= mld1*x+nld1 && mxl!=-1 && mxlOW!=-1 ) 		/* absorbing the neutron if it hit the LEFT entrance wall and the wall is not transparent*/
      ABSORB;
  if(y<=-h1d && y >=-h1dwt && x <= (y-nld1)/mld1 && x>= (y-nrd1)/mrd1 && myd!=-1 && mydOW!=-1)		/* absorbing the neutron if it hit the BOTTOM entrance wall and the wall is not transparent*/
      ABSORB;
  if(y>=h1u && y <= h1uwt && x <= (y-nlu1)/mlu1 && x>= (y-nru1)/mru1 && myu!=-1 && myuOW!=-1)		/* absorbing the neutron if it hit the TOP entrance wall and the wall is not transparent*/
    ABSORB; 

  if(x <= -w1r1 && x >= -w1rwt1 && y <= mru11*x+nru11 && y>= mrd11*x+nrd11 && mxr1!=-1 && mxrOW1!=-1)
      ABSORB;
  if(x >= w1l1 && x <=  w1lwt1 && y <= mlu11*x+nlu11 && y>= mld11*x+nld11 && mxl1!=-1 && mxlOW1!=-1 )
      ABSORB;
  if(y<=-h1d1 && y >=-h1dwt1 && x <= (y-nld11)/mld11 && x>= (y-nrd11)/mrd11 && myd1!=-1 && mydOW1!=-1)
      ABSORB;
  if(y>=h1u1 && y <= h1uwt1 && x <= (y-nlu11)/mlu11 && x>= (y-nru11)/mru11 && myu1!=-1 && myuOW1!=-1)
    ABSORB; 

  if(x <= -w1r2 && x >= -w1rwt2 && y <= mru12*x+nru12 && y>= mrd12*x+nrd12 && mxr2!=-1 && mxrOW2!=-1)
      ABSORB;
  if(x >= w1l2 && x <=  w1lwt2 && y <= mlu12*x+nlu12 && y>= mld12*x+nld12 && mxl2!=-1 && mxlOW2!=-1 )
      ABSORB;
  if(y<=-h1d2 && y >=-h1dwt2 && x <= (y-nld12)/mld12 && x>= (y-nrd12)/mrd12 && myd2!=-1 && mydOW2!=-1)
      ABSORB;
  if(y>=h1u2 && y <= h1uwt2 && x <= (y-nlu12)/mlu12 && x>= (y-nru12)/mru12 && myu2!=-1 && myuOW2!=-1)
    ABSORB; 

    if(x <= -w1r3 && x >= -w1rwt3 && y <= mru13*x+nru13 && y>= mrd13*x+nrd13 && mxr3!=-1 && mxrOW3!=-1)
      ABSORB;
  if(x >= w1l3 && x <=  w1lwt3 && y <= mlu13*x+nlu13 && y>= mld13*x+nld13 && mxl3!=-1 && mxlOW3!=-1 )
      ABSORB;
  if(y<=-h1d3 && y >=-h1dwt3 && x <= (y-nld13)/mld13 && x>= (y-nrd13)/mrd13 && myd3!=-1 && mydOW3!=-1)
      ABSORB;
  if(y>=h1u3 && y <= h1uwt3 && x <= (y-nlu13)/mlu13 && x>= (y-nru13)/mru13 && myu3!=-1 && myuOW3!=-1)
    ABSORB;

  if(x <= -w1r4 && x >= -w1rwt4 && y <= mru14*x+nru14 && y>= mrd14*x+nrd14 && mxr4!=-1 && mxrOW4!=-1)
      ABSORB;
  if(x >= w1l4 && x <=  w1lwt4 && y <= mlu14*x+nlu14 && y>= mld14*x+nld14 && mxl4!=-1 && mxlOW4!=-1 )
      ABSORB;
  if(y<=-h1d4 && y >=-h1dwt4 && x <= (y-nld14)/mld14 && x>= (y-nrd14)/mrd14 && myd4!=-1 && mydOW4!=-1)
      ABSORB;
  if(y>=h1u4 && y <= h1uwt4 && x <= (y-nlu14)/mlu14 && x>= (y-nru14)/mru14 && myu4!=-1 && myuOW4!=-1)
    ABSORB; 

  if(x <= -w1r5 && x >= -w1rwt5 && y <= mru15*x+nru15 && y>= mrd15*x+nrd15 && mxr5!=-1 && mxrOW5!=-1)
      ABSORB;
  if(x >= w1l5 && x <=  w1lwt5 && y <= mlu15*x+nlu15 && y>= mld15*x+nld15 && mxl5!=-1 && mxlOW5!=-1 )
      ABSORB;
  if(y<=-h1d5 && y >=-h1dwt5 && x <= (y-nld15)/mld15 && x>= (y-nrd15)/mrd15 && myd5!=-1 && mydOW5!=-1)
      ABSORB;
  if(y>=h1u5 && y <= h1uwt5 && x <= (y-nlu15)/mlu15 && x>= (y-nru15)/mru15 && myu5!=-1 && myuOW5!=-1)
    ABSORB; 

  if(x <= -w1r6 && x >= -w1rwt6 && y <= mru16*x+nru16 && y>= mrd16*x+nrd16 && mxr6!=-1 && mxrOW6!=-1)
      ABSORB;
  if(x >= w1l6 && x <=  w1lwt6 && y <= mlu16*x+nlu16 && y>= mld16*x+nld16 && mxl6!=-1 && mxlOW6!=-1 )
      ABSORB;
  if(y<=-h1d6 && y >=-h1dwt6 && x <= (y-nld16)/mld16 && x>= (y-nrd16)/mrd16 && myd6!=-1 && mydOW6!=-1)
      ABSORB;
  if(y>=h1u6 && y <= h1uwt6 && x <= (y-nlu16)/mlu16 && x>= (y-nru16)/mru16 && myu6!=-1 && myuOW6!=-1)
    ABSORB; 

  if(x <= -w1r7 && x >= -w1rwt7 && y <= mru17*x+nru17 && y>= mrd17*x+nrd17 && mxr7!=-1 && mxrOW7!=-1)
      ABSORB;
  if(x >= w1l7 && x <=  w1lwt7 && y <= mlu17*x+nlu17 && y>= mld17*x+nld17 && mxl7!=-1 && mxlOW7!=-1 )
      ABSORB;
  if(y<=-h1d7 && y >=-h1dwt7 && x <= (y-nld17)/mld17 && x>= (y-nrd17)/mrd17 && myd7!=-1 && mydOW7!=-1)
      ABSORB;
  if(y>=h1u7 && y <= h1uwt7 && x <= (y-nlu17)/mlu17 && x>= (y-nru17)/mru17 && myu7!=-1 && myuOW7!=-1)
    ABSORB; 

  if(x <= -w1r8 && x >= -w1rwt8 && y <= mru18*x+nru18 && y>= mrd18*x+nrd18 && mxr8!=-1 && mxrOW8!=-1)
      ABSORB;
  if(x >= w1l8 && x <=  w1lwt8 && y <= mlu18*x+nlu18 && y>= mld18*x+nld18 && mxl8!=-1 && mxlOW8!=-1 )
      ABSORB;
  if(y<=-h1d8 && y >=-h1dwt8 && x <= (y-nld18)/mld18 && x>= (y-nrd18)/mrd18 && myd8!=-1 && mydOW8!=-1)
      ABSORB;
  if(y>=h1u8 && y <= h1uwt8 && x <= (y-nlu18)/mlu18 && x>= (y-nru18)/mru18 && myu8!=-1 && myuOW8!=-1)
    ABSORB; 

  if(x <= -w1r9 && x >= -w1rwt9 && y <= mru19*x+nru19 && y>= mrd19*x+nrd19 && mxr9!=-1 && mxrOW9!=-1)
      ABSORB;
  if(x >= w1l9 && x <=  w1lwt9 && y <= mlu19*x+nlu19 && y>= mld19*x+nld19 && mxl9!=-1 && mxlOW9!=-1 )
      ABSORB;
  if(y<=-h1d9 && y >=-h1dwt9 && x <= (y-nld19)/mld19 && x>= (y-nrd19)/mrd19 && myd9!=-1 && mydOW9!=-1)
      ABSORB;
  if(y>=h1u9 && y <= h1uwt9 && x <= (y-nlu19)/mlu19 && x>= (y-nru19)/mru19 && myu9!=-1 && myuOW9!=-1)
    ABSORB; 

  if(x <= -w1r10 && x >= -w1rwt10 && y <= mru110*x+nru110 && y>= mrd110*x+nrd110 && mxr10!=-1 && mxrOW10!=-1)
      ABSORB;
  if(x >= w1l10 && x <=  w1lwt10 && y <= mlu110*x+nlu110 && y>= mld110*x+nld110 && mxl10!=-1 && mxlOW10!=-1 )
      ABSORB;
  if(y<=-h1d10 && y >=-h1dwt10 && x <= (y-nld110)/mld110 && x>= (y-nrd110)/mrd110 && myd10!=-1 && mydOW10!=-1)
      ABSORB;
  if(y>=h1u10 && y <= h1uwt10 && x <= (y-nlu110)/mlu110 && x>= (y-nru110)/mru110 && myu10!=-1 && myuOW10!=-1)
    ABSORB; 



do{										/* start the propagation loop inside the guide */
  t1=(l-z)/vz;									/* needed time to pass the guide (or rest of the guide without any interaction)*/

  if(loutwr==0 && linwr==0)							/* for a straight right wall */
  {
  m=(-w2r+w1r)/l;
  t2w1r=(m*z+(-w1r)-x)/(vx-m*vz);						/* time untill next interaction with this wall (INNER wall)*/
  t2w1rwt=(m*z+(-w1rwt)-x)/(vx-m*vz);						/* time untill next interaction with this wall (OUTER wall)*/
  if(t2w1r<1e-15)								/* solving the precision problem for the intersection times given by double variable type, to small times (<1e-15) gives scattering events */
    t2w1r=t1+2.0;								/* at the same postion again (time is set to zero). this results in a sign change in the velocity components, which results in a wall tunneling.*/
  if(t2w1rwt<1e-15)								/* see comments above*/
    t2w1rwt=t1+2.0; 
  }


  if(loutwr!=0 && linwr!=0)							/* for a elliptic right wall */
  { 										/* solving the elliptic equation in respect to z and the straight neutron trajectoty, only two z values possible! */
    m=vx/vz;									/* m parameter of the neutron trajectory*/
    n=-m*z+x;									/* n parameter of the neutron trajectory */
    pwr=2.0*(a2wr*m*n+b2wr*z0wr)/(a2wr*m*m+b2wr);				/* p parameter of quadratic equation for calulation the z component of the intersection point with respect to the neutron trajectory (INNER wall)*/
    qwr=(a2wr*n*n+b2wr*z0wr*z0wr-a2wr*b2wr)/(a2wr*m*m+b2wr);			/* q parameter of quadratic equation for calulation the z component of the intersection point with respect to the neutron trajectory (INNER wall)*/ 
    if ((pwr*pwr/4.0)-qwr<0){							
    t2w1r=t1+2.0;								/* if the neutron never touch the ellipse the time is set to be bigger than the time (t1) needed to pass the component */
    }else{
        zw1r=-pwr/2.0+sqrt((pwr*pwr/4.0)-qwr);					/* first solution for z (INNER wall)*/
        zw2r=-pwr/2.0-sqrt((pwr*pwr/4.0)-qwr);					/* second solution for z (INNER wall)*/
        t2w1r=(zw1r-z)/vz;							/* interaction time for first z value (INNER wall)*/
        t2w2r=(zw2r-z)/vz;							/* interactime time for second z value (INNER wall)*/
        if(t2w1r<1e-15)								/* solving the precision problem for the intersection times given by double variable type, to small times (<1e-15) gives scattering events */
        t2w1r=t1+2.0;								/* at the same postion again (time is set to zero). this results in a sign change in the velocity components, which results in a wall tunneling.*/
        if(t2w2r<1e-15)								/* see comments above*/
        t2w2r=t1+2.0;
        if(t2w2r<t2w1r)								/* choosing the smaller positive time solution (INNER wall)*/
        t2w1r=t2w2r;
        xintersecwr=m*(vz*t2w1r+z)+n;						/* crosscheck of the x-coordinate of the intersection point */
        if (xintersecwr>0){							/* for the right wall x-coordinate of the intersection point have to be negative */
        t2w1r=t1+2.0;}								/* if this is not the case the time is set to t1+2.0 (time point behind the component) */
        }
    pwrwt=2.0*(a2wrwt*m*n+b2wrwt*z0wr)/(a2wrwt*m*m+b2wrwt);			/* p parameter of quadratic equation for calulation the z component of the intersection point with respect to the neutron trajectory (OUTER wall)*/
    qwrwt=(a2wrwt*n*n+b2wrwt*z0wr*z0wr-a2wrwt*b2wrwt)/(a2wrwt*m*m+b2wrwt);	/* q parameter of quadratic equation for calulation the z component of the intersection point with respect to the neutron trajectory (OUTER wall)*/
    if ((pwrwt*pwrwt/4.0)-qwrwt<0){							
    t2w1rwt=t1+2.0;								/* if the neutron never touch the ellipse the time is set bigger than need to pass the component */
    }else{
        zw1rwt=-pwrwt/2.0+sqrt((pwrwt*pwrwt/4.0)-qwrwt);			/* first solution for z (OUTER wall) */
        zw2rwt=-pwrwt/2.0-sqrt((pwrwt*pwrwt/4.0)-qwrwt);			/* second solution for z (OUTER wall)*/
        t2w1rwt=(zw1rwt-z)/vz;							/* interaction time for first z value (OUTER wall)*/
        t2w2rwt=(zw2rwt-z)/vz;							/* interactime time for second z value (OUTER wall)*/
        if(t2w1rwt<1e-15)							/* solving the precision problem for the intersection times given by double variable type, to small times (<1e-15) gives scattering events */
        t2w1rwt=t1+2.0;								/* at the same postion again (time is set to zero). this results in a sign change in the velocity components, which results in a wall tunneling.*/
        if(t2w2rwt<1e-15)							/* see comments above*/
        t2w2rwt=t1+2.0;
        if(t2w2rwt<t2w1rwt)							/* choosing the smaller positive time solution (OUTER wall)*/
        t2w1rwt=t2w2rwt;
        xintersecwrwt=m*(vz*t2w1rwt+z)+n;					/* crosscheck of the x-coordinate of the intersection point */
        if (xintersecwrwt>0){							/* for the right wall x-coordinate of the intersection point have to be negative */
        t2w1rwt=t1+2.0;}							/* if this is not the case the time is set to t1+2.0 (time point behind the component) */
        }
    }

  if((loutwr!=0 && linwr==0)|| (loutwr==0 && linwr!=0))				/* for a parabolic focusing or defocusing right wall*/
  {										/* solving the elliptic equation in respect to the straight neutron trajectoty to get the interaction time*/
    m=vx/vz;									/* m parameter of the neutron trajectory*/
    n=-m*z+x;									/* n parameter of the neutron trajectory */
    pwr=(2.0*m*n*pawr+1.0)/(pawr*m*m);						/* p parameter of quadratic equation (INNER wall)*/
    qwr=n*n/(m*m)-pbwr/(pawr*m*m);						/* q parameter of quadratic equation (INNER wall)*/
    if(qwr>0 && qwr>(pwr*pwr/4)){						/* in the very special case of no intersection the quadratic equation has no solution (negative square root) the time is set to t1+2.0 */
    t2w1r=t1+2.0;
    }else{
    if(vx==0)									/* in the special case of vx = 0 is x a constant */
    {
      if(x<0){									/* only neutron with a negativ x-component can hit the RIGHT wall (INNER wall)*/
      t2w1r=(pbwr-pawr*x*x-z)/vz;
      }else{
      t2w1r=t1+2.0; 								/* the time solution for neutron with a positive x component is set to a time long behind the exit of the guide */
										/* (means will not  scatter with the right wall)*/
      }
    }else{									/* if vx is not zero and x is a real variable*/
      zw1r=-pwr/2.0+sqrt(pwr*pwr/4.0-qwr);					/* first z-solution for intersection (INNER wall)*/
      zw2r=-pwr/2.0-sqrt(pwr*pwr/4.0-qwr);					/* second z-solution for intersection (INNER wall)*/
      t2w1r=(zw1r-z)/vz;							/* first time solution (INNER wall)*/
      t2w2r=(zw2r-z)/vz;							/* second time solution (INNER wall)*/
      if(t2w1r<1e-15)								/* solving the precision problem for the intersection times given by double variable type, to small times (<1e-15) gives scattering events */
      t2w1r=t1+2.0;								/* at the same postion again (time is set to zero). this results in a sign change in the velocity components, which results in a wall tunneling.*/
      if(t2w2r<1e-15)								/* see comments above*/
      t2w2r=t1+2.0;
      if(t2w2r<t2w1r)								/* choosing the smaller positive time solution (INNER wall)*/	
      t2w1r=t2w2r;
    }
    xintersecwr=m*(vz*t2w1r+z)+n;						/* crosscheck of the x-coordinate of the intersection point */
    if (xintersecwr>0){								/* for the right wall the x-coordinate of the intersection point have to be negative */
    t2w1r=t1+2.0;}								/* if this is not the case the time is set to t1+2.0 (time point behind the component) */
    }
    pwrwt=(2.0*m*n*pawrwt+1.0)/(pawrwt*m*m);					/* p parameter of quadratic equation (OUTER wall)*/
    qwrwt=n*n/(m*m)-pbwrwt/(pawrwt*m*m);					/* q parameter of quadratic equation (OUTER wall)*/
    if(qwrwt>0 && qwrwt>(pwrwt*pwrwt/4)){					/* in the very special case of no intersection the quadratic equation has no solution (negative square root) and the time is set to t1+2.0 */
    t2w1rwt=t1+2.0;
    }else{
    if(vx==0)									/* in the special case of vx = 0 is x a constant */
    {
      if(x<0){
      t2w1rwt=(pbwrwt-pawrwt*x*x-z)/vz;						/* only neutron with a negativ x-component can hit the RIGHT wall (OUTER wall)*/
      }else{
      t2w1rwt=t1+2.0; 
      }
    }else{									/* if vx is not zero */
      zw1rwt=-pwrwt/2.0+sqrt(pwrwt*pwrwt/4.0-qwrwt);				/* first z-solution for intersection (OUTER wall)*/
      zw2rwt=-pwrwt/2.0-sqrt(pwrwt*pwrwt/4.0-qwrwt);				/* second z-solution for intersection (OUTER wall)*/
      t2w1rwt=(zw1rwt-z)/vz;							/* first time solution (OUTER wall)*/
      t2w2rwt=(zw2rwt-z)/vz;							/* second time solution (OUTER wall)*/
      if(t2w1rwt<1e-15)								/* solving the precision problem for the intersection times given by double variable type, to small times (<1e-15) gives scattering events */
      t2w1rwt=t1+2.0;								/* at the same postion again (time is set to zero). this results in a sign change in the velocity components, which results in a wall tunneling.*/
      if(t2w2rwt<1e-15)								/* see comments above*/
      t2w2rwt=t1+2.0;
      if(t2w2rwt<t2w1rwt)							/* choosing the smaller positive time solution (OUTER wall)*/
      t2w1rwt=t2w2rwt;
    }
    xintersecwrwt=m*(vz*t2w1rwt+z)+n;						/* crosscheck of the x-coordinate of the intersection point */
    if (xintersecwrwt>0){							/* for the right wall the x-coordinate of the intersection point have to be negative */
    t2w1rwt=t1+2.0;}								/* if this is not the case the time is set to t1+2.0 (time point behind the component) */
  }
  }

  if(loutwl==0 && linwl==0)							/* comments for the left wall are same like for the right wall*/
  {
  m=(w2l-w1l)/l;
  t2w1l=(m*z+(w1l)-x)/(vx-m*vz);
  t2w1lwt=(m*z+(w1lwt)-x)/(vx-m*vz);
  if(t2w1l<1e-15)
  t2w1l=t1+2.0;
  if(t2w1lwt<1e-15)
  t2w1lwt=t1+2.0;
  };

  if(loutwl!=0 && linwl!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl=2.0*(a2wl*m*n+b2wl*z0wl)/(a2wl*m*m+b2wl);
    qwl=(a2wl*n*n+b2wl*z0wl*z0wl-a2wl*b2wl)/(a2wl*m*m+b2wl);
    if((pwl*pwl/4.0)-qwl<0){
    t2w1l=t1+2.0;
    }else{
        zw1l=-pwl/2.0+sqrt((pwl*pwl/4.0)-qwl);
        zw2l=-pwl/2.0-sqrt((pwl*pwl/4.0)-qwl);
        t2w1l=(zw1l-z)/vz;
        t2w2l=(zw2l-z)/vz;
        if(t2w1l<1e-15)
        t2w1l=t1+2.0;
        if(t2w2l<1e-15)
        t2w2l=t1+2.0;
        if(t2w2l<t2w1l)
        t2w1l=t2w2l;
        xintersecwl=m*(vz*t2w1l+z)+n;
        if (xintersecwl<0){
        t2w1l=t1+2.0;}
        }
    pwlwt=2.0*(a2wlwt*m*n+b2wlwt*z0wl)/(a2wlwt*m*m+b2wlwt);
    qwlwt=(a2wlwt*n*n+b2wlwt*z0wl*z0wl-a2wlwt*b2wlwt)/(a2wlwt*m*m+b2wlwt);
    if((pwlwt*pwlwt/4.0)-qwlwt<0){
    t2w1lwt=t1+2.0;
    }else{
        zw1lwt=-pwlwt/2.0+sqrt((pwlwt*pwlwt/4.0)-qwlwt);
        zw2lwt=-pwlwt/2.0-sqrt((pwlwt*pwlwt/4.0)-qwlwt);
        t2w1lwt=(zw1lwt-z)/vz;
        t2w2lwt=(zw2lwt-z)/vz;
        if(t2w1lwt<1e-15)
        t2w1lwt=t1+2.0;
        if(t2w2lwt<1e-15)
        t2w2lwt=t1+2.0;
        if(t2w2lwt<t2w1lwt)
        t2w1lwt=t2w2lwt;
        xintersecwlwt=m*(vz*t2w1lwt+z)+n;
        if (xintersecwlwt<0){
        t2w1lwt=t1+2.0;}
        }
  }

  if((loutwl!=0 && linwl==0) || (loutwl==0 && linwl!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl=(2.0*m*n*pawl+1.0)/(pawl*m*m);
    qwl=n*n/(m*m)-pbwl/(pawl*m*m);
    if(qwl>0 && qwl>(pwl*pwl/4)){
    t2w1l=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l=(pbwl-pawl*x*x-z)/vz;
      }else{
      t2w1l=t1+2.0;
      }
    }else{
      zw1l=-pwl/2.0+sqrt(pwl*pwl/4.0-qwl);
      zw2l=-pwl/2.0-sqrt(pwl*pwl/4.0-qwl);
      t2w1l=(zw1l-z)/vz;
      t2w2l=(zw2l-z)/vz;
      if(t2w1l<1e-15)
      t2w1l=t1+2.0;
      if(t2w2l<1e-15)
      t2w2l=t1+2.0;
      if(t2w2l<t2w1l)
      t2w1l=t2w2l;
    }
    }
    xintersecwl=m*(vz*t2w1l+z)+n;
    if (xintersecwl<0){
    t2w1l=t1+2.0;}
    pwlwt=(2.0*m*n*pawlwt+1.0)/(pawlwt*m*m);
    qwlwt=n*n/(m*m)-pbwlwt/(pawlwt*m*m);
    if(qwlwt>0 && qwlwt>(pwlwt*pwlwt/4)){
    t2w1lwt=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt=(pbwlwt-pawlwt*x*x-z)/vz;
      }else{
      t2w1lwt=t1+2.0;
      }
    }else{
      zw1lwt=-pwlwt/2.0+sqrt(pwlwt*pwlwt/4.0-qwlwt);
      zw2lwt=-pwlwt/2.0-sqrt(pwlwt*pwlwt/4.0-qwlwt);
      t2w1lwt=(zw1lwt-z)/vz;
      t2w2lwt=(zw2lwt-z)/vz;
      if(t2w1lwt<1e-15)
      t2w1lwt=t1+2.0;
      if(t2w2lwt<1e-15)
      t2w2lwt=t1+2.0;
      if(t2w2lwt<t2w1lwt)
      t2w1lwt=t2w2lwt;
    }
    xintersecwlwt=m*(vz*t2w1lwt+z)+n;
    if (xintersecwlwt<0){
    t2w1lwt=t1+2.0;}
  }
  }

  if(louthu==0 && linhu==0)							/* comments for the top wall are same like for the right wall (only the ralation between left and right become relation between up and down)*/
  {
  m=(h2u-h1u)/l;
  t2h1u=(m*z+(h1u)-y)/(vy-m*vz);
  t2h1uwt=(m*z+(h1uwt)-y)/(vy-m*vz);
  if(t2h1u<1e-15)
  t2h1u=t1+2.0;
  if(t2h1uwt<1e-15)
  t2h1uwt=t1+2.0;
  }


  if(louthu!=0 && linhu!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu=2.0*(a2hu*m*n+b2hu*z0hu)/(a2hu*m*m+b2hu);
    qhu=(a2hu*n*n+b2hu*z0hu*z0hu-a2hu*b2hu)/(a2hu*m*m+b2hu);
    if((phu*phu/4.0)-qhu<0){
    t2h1u=t1+2.0;
    }else{
        zh1u=-phu/2.0+sqrt((phu*phu/4.0)-qhu);
        zh2u=-phu/2.0-sqrt((phu*phu/4.0)-qhu);
        t2h1u=(zh1u-z)/vz;
        t2h2u=(zh2u-z)/vz;
        if(t2h1u<1e-15)
        t2h1u=t1+2.0;
        if(t2h2u<1e-15)
        t2h2u=t1+2.0;
        if(t2h2u<t2h1u)
        t2h1u=t2h2u;
        yintersechu=m*(vz*t2h1u+z)+n;
        if (yintersechu<0){
        t2h1u=t1+2.0;}
        }
    phuwt=2.0*(a2huwt*m*n+b2huwt*z0hu)/(a2huwt*m*m+b2huwt);
    qhuwt=(a2huwt*n*n+b2huwt*z0hu*z0hu-a2huwt*b2huwt)/(a2huwt*m*m+b2huwt);
    if((phuwt*phuwt/4.0)-qhuwt<0){
    t2h1uwt=t1+2.0;
    }else{
        zh1uwt=-phuwt/2.0+sqrt((phuwt*phuwt/4.0)-qhuwt);
        zh2uwt=-phuwt/2.0-sqrt((phuwt*phuwt/4.0)-qhuwt);
        t2h1uwt=(zh1uwt-z)/vz;
        t2h2uwt=(zh2uwt-z)/vz;
        if(t2h1uwt<1e-15)
        t2h1uwt=t1+2.0;
        if(t2h2uwt<1e-15)
        t2h2uwt=t1+2.0;
        if(t2h2uwt<t2h1uwt)
        t2h1uwt=t2h2uwt;
        yintersechuwt=m*(vz*t2h1uwt+z)+n;
        if (yintersechuwt<0){
        t2h1uwt=t1+2.0;}
        }
  }


  if((louthu!=0 && linhu==0)|| (louthu==0 && linhu!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu=(2.0*m*n*pahu+1.0)/(pahu*m*m);	
    qhu=n*n/(m*m)-pbhu/(pahu*m*m);
    if(qhu>0 && qhu>(phu*phu/4)){
    t2h1u=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u=(pbhu-pahu*y*y-z)/vz;
      }else{
      t2h1u=t1+2.0;
      }
    }else{
      zh1u=-phu/2.0+sqrt(phu*phu/4.0-qhu);
      zh2u=-phu/2.0-sqrt(phu*phu/4.0-qhu);
      t2h1u=(zh1u-z)/vz;
      t2h2u=(zh2u-z)/vz;
      if(t2h1u<1e-15)
      t2h1u=t1+2.0;
      if(t2h2u<1e-15)
      t2h2u=t1+2.0;
      if(t2h2u<t2h1u)
      t2h1u=t2h2u;
    }
    yintersechu=m*(vz*t2h1u+z)+n;
    if (yintersechu<0){
    t2h1u=t1+2.0;}
  }
    phuwt=(2.0*m*n*pahuwt+1.0)/(pahuwt*m*m);						
    qhuwt=n*n/(m*m)-pbhuwt/(pahuwt*m*m);
    if(qhuwt>0 && qhuwt>(phuwt*phuwt/4)){
    t2h1uwt=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt=(pbhuwt-pahuwt*y*y-z)/vz;
      }else{
      t2h1uwt=t1+2.0;
      }
    }else{
      zh1uwt=-phuwt/2.0+sqrt(phuwt*phuwt/4.0-qhuwt);
      zh2uwt=-phuwt/2.0-sqrt(phuwt*phuwt/4.0-qhuwt);
      t2h1uwt=(zh1uwt-z)/vz;
      t2h2uwt=(zh2uwt-z)/vz;
      if(t2h1uwt<1e-15)
      t2h1uwt=t1+2.0;
      if(t2h2uwt<1e-15)
      t2h2uwt=t1+2.0;
      if(t2h2uwt<t2h1uwt)
      t2h1uwt=t2h2uwt;
    }
    yintersechuwt=m*(vz*t2h1uwt+z)+n;
    if (yintersechuwt<0){
    t2h1uwt=t1+2.0;}
  }
  }

  if(louthd==0 && linhd==0)							/* comments for the down wall are same like for the right wall (only the relation between left and right become relation between up and down)*/	
  {
  m=(-h2d+h1d)/l;
  t2h1d=(m*z+(-h1d)-y)/(vy-m*vz);
  t2h1dwt=(m*z+(-h1dwt)-y)/(vy-m*vz);
  if(t2h1d<1e-15)
  t2h1d=t1+2.0;
  if(t2h1dwt<1e-15)
  t2h1dwt=t1+2.0;
  }

  if(louthd!=0 && linhd!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd=2.0*(a2hd*m*n+b2hd*z0hd)/(a2hd*m*m+b2hd);
    qhd=(a2hd*n*n+b2hd*z0hd*z0hd-a2hd*b2hd)/(a2hd*m*m+b2hd);
    if((phd*phd/4.0)-qhd<0){
    t2h1d=t1+2.0;
    }else{
        zh1d=-phd/2.0+sqrt((phd*phd/4.0)-qhd);
        zh2d=-phd/2.0-sqrt((phd*phd/4.0)-qhd);
        t2h1d=(zh1d-z)/vz;
        t2h2d=(zh2d-z)/vz;
        if(t2h1d<1e-15)
        t2h1d=t1+2.0;
        if(t2h2d<1e-15)
        t2h2d=t1+2.0;
        if(t2h2d<t2h1d)
        t2h1d=t2h2d;
        yintersechd=m*(vz*t2h1d+z)+n;
        if (yintersechd>0){
        t2h1d=t1+2.0;}
        }
    phdwt=2.0*(a2hdwt*m*n+b2hdwt*z0hd)/(a2hdwt*m*m+b2hdwt);
    qhdwt=(a2hdwt*n*n+b2hdwt*z0hd*z0hd-a2hdwt*b2hdwt)/(a2hdwt*m*m+b2hdwt);
    if((phdwt*phdwt/4.0)-qhdwt<0){
    t2h1dwt=t1+2.0;
    }else{
        zh1dwt=-phdwt/2.0+sqrt((phdwt*phdwt/4.0)-qhdwt);
        zh2dwt=-phdwt/2.0-sqrt((phdwt*phdwt/4.0)-qhdwt);
        t2h1dwt=(zh1dwt-z)/vz;
        t2h2dwt=(zh2dwt-z)/vz;
        if(t2h1dwt<1e-15)
        t2h1dwt=t1+2.0;
        if(t2h2dwt<1e-15)
        t2h2dwt=t1+2.0;
        if(t2h2dwt<t2h1dwt)
        t2h1dwt=t2h2dwt;
        yintersechdwt=m*(vz*t2h1dwt+z)+n;
        if (yintersechdwt>0){
        t2h1dwt=t1+2.0;}
        }
  }

  if((louthd!=0 && linhd==0)|| (louthd==0 && linhd!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd=(2.0*m*n*pahd+1.0)/(pahd*m*m);
    qhd=n*n/(m*m)-pbhd/(pahd*m*m);
    if(qhd>0 && qhd>(phd*phd/4)){
    t2h1d=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d=(pbhd-pahd*y*y-z)/vz;
      }else{
      t2h1d=t1+2.0;
      }
    }else{
      zh1d=-phd/2.0+sqrt(phd*phd/4.0-qhd);
      zh2d=-phd/2.0-sqrt(phd*phd/4.0-qhd);
      t2h1d=(zh1d-z)/vz;
      t2h2d=(zh2d-z)/vz;
      if(t2h1d<1e-15)
      t2h1d=t1+2.0;
      if(t2h2d<1e-15)
      t2h2d=t1+2.0;
      if(t2h2d<t2h1d)
      t2h1d=t2h2d;
    }
    yintersechd=m*(vz*t2h1d+z)+n;
    if (yintersechd>0){
    t2h1d=t1+2.0;}
  }
    phdwt=(2.0*m*n*pahdwt+1.0)/(pahdwt*m*m);
    qhdwt=n*n/(m*m)-pbhdwt/(pahdwt*m*m);
    if(qhdwt>0 && qhdwt>(phdwt*phdwt/4)){
    t2h1dwt=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt=(pbhdwt-pahdwt*y*y-z)/vz;
      }else{
      t2h1dwt=t1+2.0;
      }
    }else{
      zh1dwt=-phdwt/2.0+sqrt(phdwt*phdwt/4.0-qhdwt);
      zh2dwt=-phdwt/2.0-sqrt(phdwt*phdwt/4.0-qhdwt);
      t2h1dwt=(zh1dwt-z)/vz;
      t2h2dwt=(zh2dwt-z)/vz;
      if(t2h1dwt<1e-15)
      t2h1dwt=t1+2.0;
      if(t2h2dwt<1e-15)
      t2h2dwt=t1+2.0;
      if(t2h2dwt<t2h1dwt)
      t2h1dwt=t2h2dwt;
    }
    yintersechdwt=m*(vz*t2h1dwt+z)+n;
    if (yintersechdwt>0){
    t2h1dwt=t1+2.0;}
  }
  }



  if(loutwr1==0 && linwr1==0)
  {
  m=(-w2r1+w1r1)/l;
  t2w1r1=(m*z+(-w1r1)-x)/(vx-m*vz);
  t2w1rwt1=(m*z+(-w1rwt1)-x)/(vx-m*vz);
  if(t2w1r1<1e-15)
    t2w1r1=t1+2.0;
  if(t2w1rwt1<1e-15)
    t2w1rwt1=t1+2.0; 
  }


  if(loutwr1!=0 && linwr1!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr1=2.0*(a2wr1*m*n+b2wr1*z0wr1)/(a2wr1*m*m+b2wr1);
    qwr1=(a2wr1*n*n+b2wr1*z0wr1*z0wr1-a2wr1*b2wr1)/(a2wr1*m*m+b2wr1);
    if ((pwr1*pwr1/4.0)-qwr1<0){
    t2w1r1=t1+2.0;
    }else{
        zw1r1=-pwr1/2.0+sqrt((pwr1*pwr1/4.0)-qwr1);
        zw2r1=-pwr1/2.0-sqrt((pwr1*pwr1/4.0)-qwr1);
        t2w1r1=(zw1r1-z)/vz;	
        t2w2r1=(zw2r1-z)/vz;
        if(t2w1r1<1e-15)
        t2w1r1=t1+2.0;
        if(t2w2r1<1e-15)
        t2w2r1=t1+2.0;
        if(t2w2r1<t2w1r1)
        t2w1r1=t2w2r1;
        xintersecwr1=m*(vz*t2w1r1+z)+n;	
        if (xintersecwr1>0){
        t2w1r1=t1+2.0;}	
        }
    pwrwt1=2.0*(a2wrwt1*m*n+b2wrwt1*z0wr1)/(a2wrwt1*m*m+b2wrwt1);
    qwrwt1=(a2wrwt1*n*n+b2wrwt1*z0wr1*z0wr1-a2wrwt1*b2wrwt1)/(a2wrwt1*m*m+b2wrwt1);
    if ((pwrwt1*pwrwt1/4.0)-qwrwt1<0){
    t2w1rwt1=t1+2.0;
    }else{
        zw1rwt1=-pwrwt1/2.0+sqrt((pwrwt1*pwrwt1/4.0)-qwrwt1);
        zw2rwt1=-pwrwt1/2.0-sqrt((pwrwt1*pwrwt1/4.0)-qwrwt1);
        t2w1rwt1=(zw1rwt1-z)/vz;
        t2w2rwt1=(zw2rwt1-z)/vz;
        if(t2w1rwt1<1e-15)
        t2w1rwt1=t1+2.0;
        if(t2w2rwt1<1e-15)
        t2w2rwt1=t1+2.0;
        if(t2w2rwt1<t2w1rwt1)
        t2w1rwt1=t2w2rwt1;
        xintersecwrwt1=m*(vz*t2w1rwt1+z)+n;
        if (xintersecwrwt1>0){
        t2w1rwt1=t1+2.0;}
        }
    }

  if((loutwr1!=0 && linwr1==0)|| (loutwr1==0 && linwr1!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr1=(2.0*m*n*pawr1+1.0)/(pawr1*m*m);
    qwr1=n*n/(m*m)-pbwr1/(pawr1*m*m);
    if(qwr1>0 && qwr1>(pwr1*pwr1/4)){
    t2w1r1=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r1=(pbwr1-pawr1*x*x-z)/vz;
      }else{
      t2w1r1=t1+2.0; 
      }
    }else{
      zw1r1=-pwr1/2.0+sqrt(pwr1*pwr1/4.0-qwr1);	
      zw2r1=-pwr1/2.0-sqrt(pwr1*pwr1/4.0-qwr1);	
      t2w1r1=(zw1r1-z)/vz;
      t2w2r1=(zw2r1-z)/vz;
      if(t2w1r1<1e-15)
      t2w1r1=t1+2.0;
      if(t2w2r1<1e-15)	
      t2w2r1=t1+2.0;
      if(t2w2r1<t2w1r1)
      t2w1r1=t2w2r1;
    }
    xintersecwr1=m*(vz*t2w1r1+z)+n;
    if (xintersecwr1>0){
    t2w1r1=t1+2.0;}
    }
    pwrwt1=(2.0*m*n*pawrwt1+1.0)/(pawrwt1*m*m);
    qwrwt1=n*n/(m*m)-pbwrwt1/(pawrwt1*m*m);
    if(qwrwt1>0 && qwrwt1>(pwrwt1*pwrwt1/4)){
    t2w1rwt1=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt1=(pbwrwt1-pawrwt1*x*x-z)/vz;
      }else{
      t2w1rwt1=t1+2.0; 
      }
    }else{						
      zw1rwt1=-pwrwt1/2.0+sqrt(pwrwt1*pwrwt1/4.0-qwrwt1);
      zw2rwt1=-pwrwt1/2.0-sqrt(pwrwt1*pwrwt1/4.0-qwrwt1);
      t2w1rwt1=(zw1rwt1-z)/vz;	
      t2w2rwt1=(zw2rwt1-z)/vz;	
      if(t2w1rwt1<1e-15)
      t2w1rwt1=t1+2.0;
      if(t2w2rwt1<1e-15)
      t2w2rwt1=t1+2.0;
      if(t2w2rwt1<t2w1rwt1)
      t2w1rwt1=t2w2rwt1;
    }
    xintersecwrwt1=m*(vz*t2w1rwt1+z)+n;	
    if (xintersecwrwt1>0){
    t2w1rwt1=t1+2.0;}
  }
  }

  if(loutwl1==0 && linwl1==0)
  {
  m=(w2l1-w1l1)/l;
  t2w1l1=(m*z+(w1l1)-x)/(vx-m*vz);
  t2w1lwt1=(m*z+(w1lwt1)-x)/(vx-m*vz);
  if(t2w1l1<1e-15)
  t2w1l1=t1+2.0;
  if(t2w1lwt1<1e-15)
  t2w1lwt1=t1+2.0;
  };

  if(loutwl1!=0 && linwl1!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl1=2.0*(a2wl1*m*n+b2wl1*z0wl1)/(a2wl1*m*m+b2wl1);
    qwl1=(a2wl1*n*n+b2wl1*z0wl1*z0wl1-a2wl1*b2wl1)/(a2wl1*m*m+b2wl1);
    if((pwl1*pwl1/4.0)-qwl1<0){
    t2w1l1=t1+2.0;
    }else{
        zw1l1=-pwl1/2.0+sqrt((pwl1*pwl1/4.0)-qwl1);
        zw2l1=-pwl1/2.0-sqrt((pwl1*pwl1/4.0)-qwl1);
        t2w1l1=(zw1l1-z)/vz;
        t2w2l1=(zw2l1-z)/vz;
        if(t2w1l1<1e-15)
        t2w1l1=t1+2.0;
        if(t2w2l1<1e-15)
        t2w2l1=t1+2.0;
        if(t2w2l1<t2w1l1)
        t2w1l1=t2w2l1;
        xintersecwl1=m*(vz*t2w1l1+z)+n;
        if (xintersecwl1<0){
        t2w1l1=t1+2.0;}
        }
    pwlwt1=2.0*(a2wlwt1*m*n+b2wlwt1*z0wl1)/(a2wlwt1*m*m+b2wlwt1);
    qwlwt1=(a2wlwt1*n*n+b2wlwt1*z0wl1*z0wl1-a2wlwt1*b2wlwt1)/(a2wlwt1*m*m+b2wlwt1);
    if((pwlwt1*pwlwt1/4.0)-qwlwt1<0){
    t2w1lwt1=t1+2.0;
    }else{
        zw1lwt1=-pwlwt1/2.0+sqrt((pwlwt1*pwlwt1/4.0)-qwlwt1);
        zw2lwt1=-pwlwt1/2.0-sqrt((pwlwt1*pwlwt1/4.0)-qwlwt1);
        t2w1lwt1=(zw1lwt1-z)/vz;
        t2w2lwt1=(zw2lwt1-z)/vz;
        if(t2w1lwt1<1e-15)
        t2w1lwt1=t1+2.0;
        if(t2w2lwt1<1e-15)
        t2w2lwt1=t1+2.0;
        if(t2w2lwt1<t2w1lwt1)
        t2w1lwt1=t2w2lwt1;
        xintersecwlwt1=m*(vz*t2w1lwt1+z)+n;
        if (xintersecwlwt1<0){
        t2w1lwt1=t1+2.0;}
        }
  }

  if((loutwl1!=0 && linwl1==0) || (loutwl1==0 && linwl1!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl1=(2.0*m*n*pawl1+1.0)/(pawl1*m*m);
    qwl1=n*n/(m*m)-pbwl1/(pawl1*m*m);
    if(qwl1>0 && qwl1>(pwl1*pwl1/4)){
    t2w1l1=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l1=(pbwl1-pawl1*x*x-z)/vz;
      }else{
      t2w1l1=t1+2.0;
      }
    }else{
      zw1l1=-pwl1/2.0+sqrt(pwl1*pwl1/4.0-qwl1);
      zw2l1=-pwl1/2.0-sqrt(pwl1*pwl1/4.0-qwl1);
      t2w1l1=(zw1l1-z)/vz;
      t2w2l1=(zw2l1-z)/vz;
      if(t2w1l1<1e-15)
      t2w1l1=t1+2.0;
      if(t2w2l1<1e-15)
      t2w2l1=t1+2.0;
      if(t2w2l1<t2w1l1)
      t2w1l1=t2w2l1;
    }
    }
    xintersecwl1=m*(vz*t2w1l1+z)+n;
    if (xintersecwl1<0){
    t2w1l1=t1+2.0;}
    pwlwt1=(2.0*m*n*pawlwt1+1.0)/(pawlwt1*m*m);
    qwlwt1=n*n/(m*m)-pbwlwt1/(pawlwt1*m*m);
    if(qwlwt1>0 && qwlwt1>(pwlwt1*pwlwt1/4)){
    t2w1lwt1=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt1=(pbwlwt1-pawlwt1*x*x-z)/vz;
      }else{
      t2w1lwt1=t1+2.0;
      }
    }else{
      zw1lwt1=-pwlwt1/2.0+sqrt(pwlwt1*pwlwt1/4.0-qwlwt1);
      zw2lwt1=-pwlwt1/2.0-sqrt(pwlwt1*pwlwt1/4.0-qwlwt1);
      t2w1lwt1=(zw1lwt1-z)/vz;
      t2w2lwt1=(zw2lwt1-z)/vz;
      if(t2w1lwt1<1e-15)
      t2w1lwt1=t1+2.0;
      if(t2w2lwt1<1e-15)
      t2w2lwt1=t1+2.0;
      if(t2w2lwt1<t2w1lwt1)
      t2w1lwt1=t2w2lwt1;
    }
    xintersecwlwt1=m*(vz*t2w1lwt1+z)+n;
    if (xintersecwlwt1<0){
    t2w1lwt1=t1+2.0;}
  }
  }

  if(louthu1==0 && linhu1==0)
  {
  m=(h2u1-h1u1)/l;
  t2h1u1=(m*z+(h1u1)-y)/(vy-m*vz);
  t2h1uwt1=(m*z+(h1uwt1)-y)/(vy-m*vz);
  if(t2h1u1<1e-15)
  t2h1u1=t1+2.0;
  if(t2h1uwt1<1e-15)
  t2h1uwt1=t1+2.0;
  }


  if(louthu1!=0 && linhu1!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu1=2.0*(a2hu1*m*n+b2hu1*z0hu1)/(a2hu1*m*m+b2hu1);
    qhu1=(a2hu1*n*n+b2hu1*z0hu1*z0hu1-a2hu1*b2hu1)/(a2hu1*m*m+b2hu1);
    if((phu1*phu1/4.0)-qhu1<0){
    t2h1u1=t1+2.0;
    }else{
        zh1u1=-phu1/2.0+sqrt((phu1*phu1/4.0)-qhu1);
        zh2u1=-phu1/2.0-sqrt((phu1*phu1/4.0)-qhu1);
        t2h1u1=(zh1u1-z)/vz;
        t2h2u1=(zh2u1-z)/vz;
        if(t2h1u1<1e-15)
        t2h1u1=t1+2.0;
        if(t2h2u1<1e-15)
        t2h2u1=t1+2.0;
        if(t2h2u1<t2h1u1)
        t2h1u1=t2h2u1;
        yintersechu1=m*(vz*t2h1u1+z)+n;
        if (yintersechu1<0){
        t2h1u1=t1+2.0;}
        }
    phuwt1=2.0*(a2huwt1*m*n+b2huwt1*z0hu1)/(a2huwt1*m*m+b2huwt1);
    qhuwt1=(a2huwt1*n*n+b2huwt1*z0hu1*z0hu1-a2huwt1*b2huwt1)/(a2huwt1*m*m+b2huwt1);
    if((phuwt1*phuwt1/4.0)-qhuwt1<0){
    t2h1uwt1=t1+2.0;
    }else{
        zh1uwt1=-phuwt1/2.0+sqrt((phuwt1*phuwt1/4.0)-qhuwt1);
        zh2uwt1=-phuwt1/2.0-sqrt((phuwt1*phuwt1/4.0)-qhuwt1);
        t2h1uwt1=(zh1uwt1-z)/vz;
        t2h2uwt1=(zh2uwt1-z)/vz;
        if(t2h1uwt1<1e-15)
        t2h1uwt1=t1+2.0;
        if(t2h2uwt1<1e-15)
        t2h2uwt1=t1+2.0;
        if(t2h2uwt1<t2h1uwt1)
        t2h1uwt1=t2h2uwt1;
        yintersechuwt1=m*(vz*t2h1uwt1+z)+n;
        if (yintersechuwt1<0){
        t2h1uwt1=t1+2.0;}
        }
  }


  if((louthu1!=0 && linhu1==0)|| (louthu1==0 && linhu1!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu1=(2.0*m*n*pahu1+1.0)/(pahu1*m*m);	
    qhu1=n*n/(m*m)-pbhu1/(pahu1*m*m);
    if(qhu1>0 && qhu1>(phu1*phu1/4)){
    t2h1u1=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u1=(pbhu1-pahu1*y*y-z)/vz;
      }else{
      t2h1u1=t1+2.0;
      }
    }else{
      zh1u1=-phu1/2.0+sqrt(phu1*phu1/4.0-qhu1);
      zh2u1=-phu1/2.0-sqrt(phu1*phu1/4.0-qhu1);
      t2h1u1=(zh1u1-z)/vz;
      t2h2u1=(zh2u1-z)/vz;
      if(t2h1u1<1e-15)
      t2h1u1=t1+2.0;
      if(t2h2u1<1e-15)
      t2h2u1=t1+2.0;
      if(t2h2u1<t2h1u1)
      t2h1u1=t2h2u1;
    }
    yintersechu1=m*(vz*t2h1u1+z)+n;
    if (yintersechu1<0){
    t2h1u1=t1+2.0;}
  }
    phuwt1=(2.0*m*n*pahuwt1+1.0)/(pahuwt1*m*m);						
    qhuwt1=n*n/(m*m)-pbhuwt1/(pahuwt1*m*m);
    if(qhuwt1>0 && qhuwt1>(phuwt1*phuwt1/4)){
    t2h1uwt1=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt1=(pbhuwt1-pahuwt1*y*y-z)/vz;
      }else{
      t2h1uwt1=t1+2.0;
      }
    }else{
      zh1uwt1=-phuwt1/2.0+sqrt(phuwt1*phuwt1/4.0-qhuwt1);
      zh2uwt1=-phuwt1/2.0-sqrt(phuwt1*phuwt1/4.0-qhuwt1);
      t2h1uwt1=(zh1uwt1-z)/vz;
      t2h2uwt1=(zh2uwt1-z)/vz;
      if(t2h1uwt1<1e-15)
      t2h1uwt1=t1+2.0;
      if(t2h2uwt1<1e-15)
      t2h2uwt1=t1+2.0;
      if(t2h2uwt1<t2h1uwt1)
      t2h1uwt1=t2h2uwt1;
    }
    yintersechuwt1=m*(vz*t2h1uwt1+z)+n;
    if (yintersechuwt1<0){
    t2h1uwt1=t1+2.0;}
  }
  }

  if(louthd1==0 && linhd1==0)
  {
  m=(-h2d1+h1d1)/l;
  t2h1d1=(m*z+(-h1d1)-y)/(vy-m*vz);
  t2h1dwt1=(m*z+(-h1dwt1)-y)/(vy-m*vz);
  if(t2h1d1<1e-15)
  t2h1d1=t1+2.0;
  if(t2h1dwt1<1e-15)
  t2h1dwt1=t1+2.0;
  }

  if(louthd1!=0 && linhd1!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd1=2.0*(a2hd1*m*n+b2hd1*z0hd1)/(a2hd1*m*m+b2hd1);
    qhd1=(a2hd1*n*n+b2hd1*z0hd1*z0hd1-a2hd1*b2hd1)/(a2hd1*m*m+b2hd1);
    if((phd1*phd1/4.0)-qhd1<0){
    t2h1d1=t1+2.0;
    }else{
        zh1d1=-phd1/2.0+sqrt((phd1*phd1/4.0)-qhd1);
        zh2d1=-phd1/2.0-sqrt((phd1*phd1/4.0)-qhd1);
        t2h1d1=(zh1d1-z)/vz;
        t2h2d1=(zh2d1-z)/vz;
        if(t2h1d1<1e-15)
        t2h1d1=t1+2.0;
        if(t2h2d1<1e-15)
        t2h2d1=t1+2.0;
        if(t2h2d1<t2h1d1)
        t2h1d1=t2h2d1;
        yintersechd1=m*(vz*t2h1d1+z)+n;
        if (yintersechd1>0){
        t2h1d1=t1+2.0;}
        }
    phdwt1=2.0*(a2hdwt1*m*n+b2hdwt1*z0hd1)/(a2hdwt1*m*m+b2hdwt1);
    qhdwt1=(a2hdwt1*n*n+b2hdwt1*z0hd1*z0hd1-a2hdwt1*b2hdwt1)/(a2hdwt1*m*m+b2hdwt1);
    if((phdwt1*phdwt1/4.0)-qhdwt1<0){
    t2h1dwt1=t1+2.0;
    }else{
        zh1dwt1=-phdwt1/2.0+sqrt((phdwt1*phdwt1/4.0)-qhdwt1);
        zh2dwt1=-phdwt1/2.0-sqrt((phdwt1*phdwt1/4.0)-qhdwt1);
        t2h1dwt1=(zh1dwt1-z)/vz;
        t2h2dwt1=(zh2dwt1-z)/vz;
        if(t2h1dwt1<1e-15)
        t2h1dwt1=t1+2.0;
        if(t2h2dwt1<1e-15)
        t2h2dwt1=t1+2.0;
        if(t2h2dwt1<t2h1dwt1)
        t2h1dwt1=t2h2dwt1;
        yintersechdwt1=m*(vz*t2h1dwt1+z)+n;
        if (yintersechdwt1>0){
        t2h1dwt1=t1+2.0;}
        }
  }

  if((louthd1!=0 && linhd1==0)|| (louthd1==0 && linhd1!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd1=(2.0*m*n*pahd1+1.0)/(pahd1*m*m);
    qhd1=n*n/(m*m)-pbhd1/(pahd1*m*m);
    if(qhd1>0 && qhd1>(phd1*phd1/4)){
    t2h1d1=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d1=(pbhd1-pahd1*y*y-z)/vz;
      }else{
      t2h1d1=t1+2.0;
      }
    }else{
      zh1d1=-phd1/2.0+sqrt(phd1*phd1/4.0-qhd1);
      zh2d1=-phd1/2.0-sqrt(phd1*phd1/4.0-qhd1);
      t2h1d1=(zh1d1-z)/vz;
      t2h2d1=(zh2d1-z)/vz;
      if(t2h1d1<1e-15)
      t2h1d1=t1+2.0;
      if(t2h2d1<1e-15)
      t2h2d1=t1+2.0;
      if(t2h2d1<t2h1d1)
      t2h1d1=t2h2d1;
    }
    yintersechd1=m*(vz*t2h1d1+z)+n;
    if (yintersechd1>0){
    t2h1d1=t1+2.0;}
  }
    phdwt1=(2.0*m*n*pahdwt1+1.0)/(pahdwt1*m*m);
    qhdwt1=n*n/(m*m)-pbhdwt1/(pahdwt1*m*m);
    if(qhdwt1>0 && qhdwt1>(phdwt1*phdwt1/4)){
    t2h1dwt1=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt1=(pbhdwt1-pahdwt1*y*y-z)/vz;
      }else{
      t2h1dwt1=t1+2.0;
      }
    }else{
      zh1dwt1=-phdwt1/2.0+sqrt(phdwt1*phdwt1/4.0-qhdwt1);
      zh2dwt1=-phdwt1/2.0-sqrt(phdwt1*phdwt1/4.0-qhdwt1);
      t2h1dwt1=(zh1dwt1-z)/vz;
      t2h2dwt1=(zh2dwt1-z)/vz;
      if(t2h1dwt1<1e-15)
      t2h1dwt1=t1+2.0;
      if(t2h2dwt1<1e-15)
      t2h2dwt1=t1+2.0;
      if(t2h2dwt1<t2h1dwt1)
      t2h1dwt1=t2h2dwt1;
    }
    yintersechdwt1=m*(vz*t2h1dwt1+z)+n;
    if (yintersechdwt1>0){
    t2h1dwt1=t1+2.0;}
  }
  }


if(loutwr2==0 && linwr2==0)
  {
  m=(-w2r2+w1r2)/l;
  t2w1r2=(m*z+(-w1r2)-x)/(vx-m*vz);
  t2w1rwt2=(m*z+(-w1rwt2)-x)/(vx-m*vz);
  if(t2w1r2<1e-15)
    t2w1r2=t1+2.0;
  if(t2w1rwt2<1e-15)
    t2w1rwt2=t1+2.0; 
  }


  if(loutwr2!=0 && linwr2!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr2=2.0*(a2wr2*m*n+b2wr2*z0wr2)/(a2wr2*m*m+b2wr2);
    qwr2=(a2wr2*n*n+b2wr2*z0wr2*z0wr2-a2wr2*b2wr2)/(a2wr2*m*m+b2wr2);
    if ((pwr2*pwr2/4.0)-qwr2<0){
    t2w1r2=t1+2.0;
    }else{
        zw1r2=-pwr2/2.0+sqrt((pwr2*pwr2/4.0)-qwr2);
        zw2r2=-pwr2/2.0-sqrt((pwr2*pwr2/4.0)-qwr2);
        t2w1r2=(zw1r2-z)/vz;
        t2w2r2=(zw2r2-z)/vz;
        if(t2w1r2<1e-15)
        t2w1r2=t1+2.0;
        if(t2w2r2<1e-15)
        t2w2r2=t1+2.0;
        if(t2w2r2<t2w1r2)
        t2w1r2=t2w2r2;
        xintersecwr2=m*(vz*t2w1r2+z)+n;
        if (xintersecwr2>0){
        t2w1r2=t1+2.0;}
        }
    pwrwt2=2.0*(a2wrwt2*m*n+b2wrwt2*z0wr2)/(a2wrwt2*m*m+b2wrwt2);
    qwrwt2=(a2wrwt2*n*n+b2wrwt2*z0wr2*z0wr2-a2wrwt2*b2wrwt2)/(a2wrwt2*m*m+b2wrwt2);
    if ((pwrwt2*pwrwt2/4.0)-qwrwt2<0){
    t2w1rwt2=t1+2.0;
    }else{
        zw1rwt2=-pwrwt2/2.0+sqrt((pwrwt2*pwrwt2/4.0)-qwrwt2);
        zw2rwt2=-pwrwt2/2.0-sqrt((pwrwt2*pwrwt2/4.0)-qwrwt2);
        t2w1rwt2=(zw1rwt2-z)/vz;
        t2w2rwt2=(zw2rwt2-z)/vz;
        if(t2w1rwt2<1e-15)
        t2w1rwt2=t1+2.0;
        if(t2w2rwt2<1e-15)
        t2w2rwt2=t1+2.0;
        if(t2w2rwt2<t2w1rwt2)
        t2w1rwt2=t2w2rwt2;
        xintersecwrwt2=m*(vz*t2w1rwt2+z)+n;
        if (xintersecwrwt2>0){
        t2w1rwt2=t1+2.0;}
        }
    }

  if((loutwr2!=0 && linwr2==0)|| (loutwr2==0 && linwr2!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr2=(2.0*m*n*pawr2+1.0)/(pawr2*m*m);
    qwr2=n*n/(m*m)-pbwr2/(pawr2*m*m);
    if(qwr2>0 && qwr2>(pwr2*pwr2/4)){
    t2w1r2=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r2=(pbwr2-pawr2*x*x-z)/vz;
      }else{
      t2w1r2=t1+2.0;
      }
    }else{
      zw1r2=-pwr2/2.0+sqrt(pwr2*pwr2/4.0-qwr2);
      zw2r2=-pwr2/2.0-sqrt(pwr2*pwr2/4.0-qwr2);
      t2w1r2=(zw1r2-z)/vz;
      t2w2r2=(zw2r2-z)/vz;
      if(t2w1r2<1e-15)
      t2w1r2=t1+2.0;
      if(t2w2r2<1e-15)
      t2w2r2=t1+2.0;
      if(t2w2r2<t2w1r2)
      t2w1r2=t2w2r2;
    }
    xintersecwr2=m*(vz*t2w1r2+z)+n;
    if (xintersecwr2>0){
    t2w1r2=t1+2.0;}
    }
    pwrwt2=(2.0*m*n*pawrwt2+1.0)/(pawrwt2*m*m);
    qwrwt2=n*n/(m*m)-pbwrwt2/(pawrwt2*m*m);
    if(qwrwt2>0 && qwrwt2>(pwrwt2*pwrwt2/4)){
    t2w1rwt2=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt2=(pbwrwt2-pawrwt2*x*x-z)/vz;
      }else{
      t2w1rwt2=t1+2.0; 
      }
    }else{
      zw1rwt2=-pwrwt2/2.0+sqrt(pwrwt2*pwrwt2/4.0-qwrwt2);
      zw2rwt2=-pwrwt2/2.0-sqrt(pwrwt2*pwrwt2/4.0-qwrwt2);
      t2w1rwt2=(zw1rwt2-z)/vz;
      t2w2rwt2=(zw2rwt2-z)/vz;
      if(t2w1rwt2<1e-15)
      t2w1rwt2=t1+2.0;	
      if(t2w2rwt2<1e-15)
      t2w2rwt2=t1+2.0;
      if(t2w2rwt2<t2w1rwt2)
      t2w1rwt2=t2w2rwt2;
    }
    xintersecwrwt2=m*(vz*t2w1rwt2+z)+n;	
    if (xintersecwrwt2>0){
    t2w1rwt2=t1+2.0;}
  }
  }

  if(loutwl2==0 && linwl2==0)
  {
  m=(w2l2-w1l2)/l;
  t2w1l2=(m*z+(w1l2)-x)/(vx-m*vz);
  t2w1lwt2=(m*z+(w1lwt2)-x)/(vx-m*vz);
  if(t2w1l2<1e-15)
  t2w1l2=t1+2.0;
  if(t2w1lwt2<1e-15)
  t2w1lwt2=t1+2.0;
  };

  if(loutwl2!=0 && linwl2!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl2=2.0*(a2wl2*m*n+b2wl2*z0wl2)/(a2wl2*m*m+b2wl2);
    qwl2=(a2wl2*n*n+b2wl2*z0wl2*z0wl2-a2wl2*b2wl2)/(a2wl2*m*m+b2wl2);
    if((pwl2*pwl2/4.0)-qwl2<0){
    t2w1l2=t1+2.0;
    }else{
        zw1l2=-pwl2/2.0+sqrt((pwl2*pwl2/4.0)-qwl2);
        zw2l2=-pwl2/2.0-sqrt((pwl2*pwl2/4.0)-qwl2);
        t2w1l2=(zw1l2-z)/vz;
        t2w2l2=(zw2l2-z)/vz;
        if(t2w1l2<1e-15)
        t2w1l2=t1+2.0;
        if(t2w2l2<1e-15)
        t2w2l2=t1+2.0;
        if(t2w2l2<t2w1l2)
        t2w1l2=t2w2l2;
        xintersecwl2=m*(vz*t2w1l2+z)+n;
        if (xintersecwl2<0){
        t2w1l2=t1+2.0;}
        }
    pwlwt2=2.0*(a2wlwt2*m*n+b2wlwt2*z0wl2)/(a2wlwt2*m*m+b2wlwt2);
    qwlwt2=(a2wlwt2*n*n+b2wlwt2*z0wl2*z0wl2-a2wlwt2*b2wlwt2)/(a2wlwt2*m*m+b2wlwt2);
    if((pwlwt2*pwlwt2/4.0)-qwlwt2<0){
    t2w1lwt2=t1+2.0;
    }else{
        zw1lwt2=-pwlwt2/2.0+sqrt((pwlwt2*pwlwt2/4.0)-qwlwt2);
        zw2lwt2=-pwlwt2/2.0-sqrt((pwlwt2*pwlwt2/4.0)-qwlwt2);
        t2w1lwt2=(zw1lwt2-z)/vz;
        t2w2lwt2=(zw2lwt2-z)/vz;
        if(t2w1lwt2<1e-15)
        t2w1lwt2=t1+2.0;
        if(t2w2lwt2<1e-15)
        t2w2lwt2=t1+2.0;
        if(t2w2lwt2<t2w1lwt2)
        t2w1lwt2=t2w2lwt2;
        xintersecwlwt2=m*(vz*t2w1lwt2+z)+n;
        if (xintersecwlwt2<0){
        t2w1lwt2=t1+2.0;}
        }
  }

  if((loutwl2!=0 && linwl2==0) || (loutwl2==0 && linwl2!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl2=(2.0*m*n*pawl2+1.0)/(pawl2*m*m);
    qwl2=n*n/(m*m)-pbwl2/(pawl2*m*m);
    if(qwl2>0 && qwl2>(pwl2*pwl2/4)){
    t2w1l2=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l2=(pbwl2-pawl2*x*x-z)/vz;
      }else{
      t2w1l2=t1+2.0;
      }
    }else{
      zw1l2=-pwl2/2.0+sqrt(pwl2*pwl2/4.0-qwl2);
      zw2l2=-pwl2/2.0-sqrt(pwl2*pwl2/4.0-qwl2);
      t2w1l2=(zw1l2-z)/vz;
      t2w2l2=(zw2l2-z)/vz;
      if(t2w1l2<1e-15)
      t2w1l2=t1+2.0;
      if(t2w2l2<1e-15)
      t2w2l2=t1+2.0;
      if(t2w2l2<t2w1l2)
      t2w1l2=t2w2l2;
    }
    }
    xintersecwl2=m*(vz*t2w1l2+z)+n;
    if (xintersecwl2<0){
    t2w1l2=t1+2.0;}
    pwlwt2=(2.0*m*n*pawlwt2+1.0)/(pawlwt2*m*m);
    qwlwt2=n*n/(m*m)-pbwlwt2/(pawlwt2*m*m);
    if(qwlwt2>0 && qwlwt2>(pwlwt2*pwlwt2/4)){
    t2w1lwt2=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt2=(pbwlwt2-pawlwt2*x*x-z)/vz;
      }else{
      t2w1lwt2=t1+2.0;
      }
    }else{
      zw1lwt2=-pwlwt2/2.0+sqrt(pwlwt2*pwlwt2/4.0-qwlwt2);
      zw2lwt2=-pwlwt2/2.0-sqrt(pwlwt2*pwlwt2/4.0-qwlwt2);
      t2w1lwt2=(zw1lwt2-z)/vz;
      t2w2lwt2=(zw2lwt2-z)/vz;
      if(t2w1lwt2<1e-15)
      t2w1lwt2=t1+2.0;
      if(t2w2lwt2<1e-15)
      t2w2lwt2=t1+2.0;
      if(t2w2lwt2<t2w1lwt2)
      t2w1lwt2=t2w2lwt2;
    }
    xintersecwlwt2=m*(vz*t2w1lwt2+z)+n;
    if (xintersecwlwt2<0){
    t2w1lwt2=t1+2.0;}
  }
  }

  if(louthu2==0 && linhu2==0)							/* comments for the top wall are same like for the right wall (only the ralation between left and right become relation between up and down)*/
  {
  m=(h2u2-h1u2)/l;
  t2h1u2=(m*z+(h1u2)-y)/(vy-m*vz);
  t2h1uwt2=(m*z+(h1uwt2)-y)/(vy-m*vz);
  if(t2h1u2<1e-15)
  t2h1u2=t1+2.0;
  if(t2h1uwt2<1e-15)
  t2h1uwt2=t1+2.0;
  }


  if(louthu2!=0 && linhu2!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu2=2.0*(a2hu2*m*n+b2hu2*z0hu2)/(a2hu2*m*m+b2hu2);
    qhu2=(a2hu2*n*n+b2hu2*z0hu2*z0hu2-a2hu2*b2hu2)/(a2hu2*m*m+b2hu2);
    if((phu2*phu2/4.0)-qhu2<0){
    t2h1u2=t1+2.0;
    }else{
        zh1u2=-phu2/2.0+sqrt((phu2*phu2/4.0)-qhu2);
        zh2u2=-phu2/2.0-sqrt((phu2*phu2/4.0)-qhu2);
        t2h1u2=(zh1u2-z)/vz;
        t2h2u2=(zh2u2-z)/vz;
        if(t2h1u2<1e-15)
        t2h1u2=t1+2.0;
        if(t2h2u2<1e-15)
        t2h2u2=t1+2.0;
        if(t2h2u2<t2h1u2)
        t2h1u2=t2h2u2;
        yintersechu2=m*(vz*t2h1u2+z)+n;
        if (yintersechu2<0){
        t2h1u2=t1+2.0;}
        }
    phuwt2=2.0*(a2huwt2*m*n+b2huwt2*z0hu2)/(a2huwt2*m*m+b2huwt2);
    qhuwt2=(a2huwt2*n*n+b2huwt2*z0hu2*z0hu2-a2huwt2*b2huwt2)/(a2huwt2*m*m+b2huwt2);
    if((phuwt2*phuwt2/4.0)-qhuwt2<0){
    t2h1uwt2=t1+2.0;
    }else{
        zh1uwt2=-phuwt2/2.0+sqrt((phuwt2*phuwt2/4.0)-qhuwt2);
        zh2uwt2=-phuwt2/2.0-sqrt((phuwt2*phuwt2/4.0)-qhuwt2);
        t2h1uwt2=(zh1uwt2-z)/vz;
        t2h2uwt2=(zh2uwt2-z)/vz;
        if(t2h1uwt2<1e-15)
        t2h1uwt2=t1+2.0;
        if(t2h2uwt2<1e-15)
        t2h2uwt2=t1+2.0;
        if(t2h2uwt2<t2h1uwt2)
        t2h1uwt2=t2h2uwt2;
        yintersechuwt2=m*(vz*t2h1uwt2+z)+n;
        if (yintersechuwt2<0){
        t2h1uwt2=t1+2.0;}
        }
  }


  if((louthu2!=0 && linhu2==0)|| (louthu2==0 && linhu2!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu2=(2.0*m*n*pahu2+1.0)/(pahu2*m*m);	
    qhu2=n*n/(m*m)-pbhu2/(pahu2*m*m);
    if(qhu2>0 && qhu2>(phu2*phu2/4)){
    t2h1u2=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u2=(pbhu2-pahu2*y*y-z)/vz;
      }else{
      t2h1u2=t1+2.0;
      }
    }else{
      zh1u2=-phu2/2.0+sqrt(phu2*phu2/4.0-qhu2);
      zh2u2=-phu2/2.0-sqrt(phu2*phu2/4.0-qhu2);
      t2h1u2=(zh1u2-z)/vz;
      t2h2u2=(zh2u2-z)/vz;
      if(t2h1u2<1e-15)
      t2h1u2=t1+2.0;
      if(t2h2u2<1e-15)
      t2h2u2=t1+2.0;
      if(t2h2u2<t2h1u2)
      t2h1u2=t2h2u2;
    }
    yintersechu2=m*(vz*t2h1u2+z)+n;
    if (yintersechu2<0){
    t2h1u2=t1+2.0;}
  }
    phuwt2=(2.0*m*n*pahuwt2+1.0)/(pahuwt2*m*m);						
    qhuwt2=n*n/(m*m)-pbhuwt2/(pahuwt2*m*m);
    if(qhuwt2>0 && qhuwt2>(phuwt2*phuwt2/4)){
    t2h1uwt2=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt2=(pbhuwt2-pahuwt2*y*y-z)/vz;
      }else{
      t2h1uwt2=t1+2.0;
      }
    }else{
      zh1uwt2=-phuwt2/2.0+sqrt(phuwt2*phuwt2/4.0-qhuwt2);
      zh2uwt2=-phuwt2/2.0-sqrt(phuwt2*phuwt2/4.0-qhuwt2);
      t2h1uwt2=(zh1uwt2-z)/vz;
      t2h2uwt2=(zh2uwt2-z)/vz;
      if(t2h1uwt2<1e-15)
      t2h1uwt2=t1+2.0;
      if(t2h2uwt2<1e-15)
      t2h2uwt2=t1+2.0;
      if(t2h2uwt2<t2h1uwt2)
      t2h1uwt2=t2h2uwt2;
    }
    yintersechuwt2=m*(vz*t2h1uwt2+z)+n;
    if (yintersechuwt2<0){
    t2h1uwt2=t1+2.0;}
  }
  }

  if(louthd2==0 && linhd2==0)							/* comments for the down wall are same like for the right wall (only the relation between left and right become relation between up and down)*/	
  {
  m=(-h2d2+h1d2)/l;
  t2h1d2=(m*z+(-h1d2)-y)/(vy-m*vz);
  t2h1dwt2=(m*z+(-h1dwt2)-y)/(vy-m*vz);
  if(t2h1d2<1e-15)
  t2h1d2=t1+2.0;
  if(t2h1dwt2<1e-15)
  t2h1dwt2=t1+2.0;
  }

  if(louthd2!=0 && linhd2!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd2=2.0*(a2hd2*m*n+b2hd2*z0hd2)/(a2hd2*m*m+b2hd2);
    qhd2=(a2hd2*n*n+b2hd2*z0hd2*z0hd2-a2hd2*b2hd2)/(a2hd2*m*m+b2hd2);
    if((phd2*phd2/4.0)-qhd2<0){
    t2h1d2=t1+2.0;
    }else{
        zh1d2=-phd2/2.0+sqrt((phd2*phd2/4.0)-qhd2);
        zh2d2=-phd2/2.0-sqrt((phd2*phd2/4.0)-qhd2);
        t2h1d2=(zh1d2-z)/vz;
        t2h2d2=(zh2d2-z)/vz;
        if(t2h1d2<1e-15)
        t2h1d2=t1+2.0;
        if(t2h2d2<1e-15)
        t2h2d2=t1+2.0;
        if(t2h2d2<t2h1d2)
        t2h1d2=t2h2d2;
        yintersechd2=m*(vz*t2h1d2+z)+n;
        if (yintersechd2>0){
        t2h1d2=t1+2.0;}
        }
    phdwt2=2.0*(a2hdwt2*m*n+b2hdwt2*z0hd2)/(a2hdwt2*m*m+b2hdwt2);
    qhdwt2=(a2hdwt2*n*n+b2hdwt2*z0hd2*z0hd2-a2hdwt2*b2hdwt2)/(a2hdwt2*m*m+b2hdwt2);
    if((phdwt2*phdwt2/4.0)-qhdwt2<0){
    t2h1dwt2=t1+2.0;
    }else{
        zh1dwt2=-phdwt2/2.0+sqrt((phdwt2*phdwt2/4.0)-qhdwt2);
        zh2dwt2=-phdwt2/2.0-sqrt((phdwt2*phdwt2/4.0)-qhdwt2);
        t2h1dwt2=(zh1dwt2-z)/vz;
        t2h2dwt2=(zh2dwt2-z)/vz;
        if(t2h1dwt2<1e-15)
        t2h1dwt2=t1+2.0;
        if(t2h2dwt2<1e-15)
        t2h2dwt2=t1+2.0;
        if(t2h2dwt2<t2h1dwt2)
        t2h1dwt2=t2h2dwt2;
        yintersechdwt2=m*(vz*t2h1dwt2+z)+n;
        if (yintersechdwt2>0){
        t2h1dwt2=t1+2.0;}
        }
  }

  if((louthd2!=0 && linhd2==0)|| (louthd2==0 && linhd2!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd2=(2.0*m*n*pahd2+1.0)/(pahd2*m*m);
    qhd2=n*n/(m*m)-pbhd2/(pahd2*m*m);
    if(qhd2>0 && qhd2>(phd2*phd2/4)){
    t2h1d2=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d2=(pbhd2-pahd2*y*y-z)/vz;
      }else{
      t2h1d2=t1+2.0;
      }
    }else{
      zh1d2=-phd2/2.0+sqrt(phd2*phd2/4.0-qhd2);
      zh2d2=-phd2/2.0-sqrt(phd2*phd2/4.0-qhd2);
      t2h1d2=(zh1d2-z)/vz;
      t2h2d2=(zh2d2-z)/vz;
      if(t2h1d2<1e-15)
      t2h1d2=t1+2.0;
      if(t2h2d2<1e-15)
      t2h2d2=t1+2.0;
      if(t2h2d2<t2h1d2)
      t2h1d2=t2h2d2;
    }
    yintersechd2=m*(vz*t2h1d2+z)+n;
    if (yintersechd2>0){
    t2h1d2=t1+2.0;}
  }
    phdwt2=(2.0*m*n*pahdwt2+1.0)/(pahdwt2*m*m);
    qhdwt2=n*n/(m*m)-pbhdwt2/(pahdwt2*m*m);
    if(qhdwt2>0 && qhdwt2>(phdwt2*phdwt2/4)){
    t2h1dwt2=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt2=(pbhdwt2-pahdwt2*y*y-z)/vz;
      }else{
      t2h1dwt2=t1+2.0;
      }
    }else{
      zh1dwt2=-phdwt2/2.0+sqrt(phdwt2*phdwt2/4.0-qhdwt2);
      zh2dwt2=-phdwt2/2.0-sqrt(phdwt2*phdwt2/4.0-qhdwt2);
      t2h1dwt2=(zh1dwt2-z)/vz;
      t2h2dwt2=(zh2dwt2-z)/vz;
      if(t2h1dwt2<1e-15)
      t2h1dwt2=t1+2.0;
      if(t2h2dwt2<1e-15)
      t2h2dwt2=t1+2.0;
      if(t2h2dwt2<t2h1dwt2)
      t2h1dwt2=t2h2dwt2;
    }
    yintersechdwt2=m*(vz*t2h1dwt2+z)+n;
    if (yintersechdwt2>0){
    t2h1dwt2=t1+2.0;}
  }
  }

if(loutwr3==0 && linwr3==0)
  {
  m=(-w2r3+w1r3)/l;
  t2w1r3=(m*z+(-w1r3)-x)/(vx-m*vz);
  t2w1rwt3=(m*z+(-w1rwt3)-x)/(vx-m*vz);
  if(t2w1r3<1e-15)
    t2w1r3=t1+2.0;
  if(t2w1rwt3<1e-15)
    t2w1rwt3=t1+2.0; 
  }


  if(loutwr3!=0 && linwr3!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr3=2.0*(a2wr3*m*n+b2wr3*z0wr3)/(a2wr3*m*m+b2wr3);
    qwr3=(a2wr3*n*n+b2wr3*z0wr3*z0wr3-a2wr3*b2wr3)/(a2wr3*m*m+b2wr3);
    if ((pwr3*pwr3/4.0)-qwr3<0){
    t2w1r3=t1+2.0;
    }else{
        zw1r3=-pwr3/2.0+sqrt((pwr3*pwr3/4.0)-qwr3);
        zw2r3=-pwr3/2.0-sqrt((pwr3*pwr3/4.0)-qwr3);
        t2w1r3=(zw1r3-z)/vz;
        t2w2r3=(zw2r3-z)/vz;
        if(t2w1r3<1e-15)
        t2w1r3=t1+2.0;
        if(t2w2r3<1e-15)
        t2w2r3=t1+2.0;
        if(t2w2r3<t2w1r3)
        t2w1r3=t2w2r3;
        xintersecwr3=m*(vz*t2w1r3+z)+n;
        if (xintersecwr3>0){
        t2w1r3=t1+2.0;}
        }
    pwrwt3=2.0*(a2wrwt3*m*n+b2wrwt3*z0wr3)/(a2wrwt3*m*m+b2wrwt3);
    qwrwt3=(a2wrwt3*n*n+b2wrwt3*z0wr3*z0wr3-a2wrwt3*b2wrwt3)/(a2wrwt3*m*m+b2wrwt3);
    if ((pwrwt3*pwrwt3/4.0)-qwrwt3<0){
    t2w1rwt3=t1+2.0;
    }else{
        zw1rwt3=-pwrwt3/2.0+sqrt((pwrwt3*pwrwt3/4.0)-qwrwt3);
        zw2rwt3=-pwrwt3/2.0-sqrt((pwrwt3*pwrwt3/4.0)-qwrwt3);
        t2w1rwt3=(zw1rwt3-z)/vz;
        t2w2rwt3=(zw2rwt3-z)/vz;
        if(t2w1rwt3<1e-15)
        t2w1rwt3=t1+2.0;
        if(t2w2rwt3<1e-15)
        t2w2rwt3=t1+2.0;
        if(t2w2rwt3<t2w1rwt3)
        t2w1rwt3=t2w2rwt3;
        xintersecwrwt3=m*(vz*t2w1rwt3+z)+n;
        if (xintersecwrwt3>0){
        t2w1rwt3=t1+2.0;}
        }
    }

  if((loutwr3!=0 && linwr3==0)|| (loutwr3==0 && linwr3!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr3=(2.0*m*n*pawr3+1.0)/(pawr3*m*m);
    qwr3=n*n/(m*m)-pbwr3/(pawr3*m*m);
    if(qwr3>0 && qwr3>(pwr3*pwr3/4)){
    t2w1r3=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r3=(pbwr3-pawr3*x*x-z)/vz;
      }else{
      t2w1r3=t1+2.0;
      }
    }else{
      zw1r3=-pwr3/2.0+sqrt(pwr3*pwr3/4.0-qwr3);
      zw2r3=-pwr3/2.0-sqrt(pwr3*pwr3/4.0-qwr3);
      t2w1r3=(zw1r3-z)/vz;
      t2w2r3=(zw2r3-z)/vz;
      if(t2w1r3<1e-15)
      t2w1r3=t1+2.0;
      if(t2w2r3<1e-15)
      t2w2r3=t1+2.0;
      if(t2w2r3<t2w1r3)
      t2w1r3=t2w2r3;
    }
    xintersecwr3=m*(vz*t2w1r3+z)+n;
    if (xintersecwr3>0){
    t2w1r3=t1+2.0;}
    }
    pwrwt3=(2.0*m*n*pawrwt3+1.0)/(pawrwt3*m*m);
    qwrwt3=n*n/(m*m)-pbwrwt3/(pawrwt3*m*m);
    if(qwrwt3>0 && qwrwt3>(pwrwt3*pwrwt3/4)){
    t2w1rwt3=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt3=(pbwrwt3-pawrwt3*x*x-z)/vz;
      }else{
      t2w1rwt3=t1+2.0; 
      }
    }else{
      zw1rwt3=-pwrwt3/2.0+sqrt(pwrwt3*pwrwt3/4.0-qwrwt3);
      zw2rwt3=-pwrwt3/2.0-sqrt(pwrwt3*pwrwt3/4.0-qwrwt3);
      t2w1rwt3=(zw1rwt3-z)/vz;
      t2w2rwt3=(zw2rwt3-z)/vz;
      if(t2w1rwt3<1e-15)
      t2w1rwt3=t1+2.0;
      if(t2w2rwt3<1e-15)
      t2w2rwt3=t1+2.0;
      if(t2w2rwt3<t2w1rwt3)
      t2w1rwt3=t2w2rwt3;
    }
    xintersecwrwt3=m*(vz*t2w1rwt3+z)+n;
    if (xintersecwrwt3>0){
    t2w1rwt3=t1+2.0;}
  }
  }

  if(loutwl3==0 && linwl3==0)
  {
  m=(w2l3-w1l3)/l;
  t2w1l3=(m*z+(w1l3)-x)/(vx-m*vz);
  t2w1lwt3=(m*z+(w1lwt3)-x)/(vx-m*vz);
  if(t2w1l3<1e-15)
  t2w1l3=t1+2.0;
  if(t2w1lwt3<1e-15)
  t2w1lwt3=t1+2.0;
  };

  if(loutwl3!=0 && linwl3!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl3=2.0*(a2wl3*m*n+b2wl3*z0wl3)/(a2wl3*m*m+b2wl3);
    qwl3=(a2wl3*n*n+b2wl3*z0wl3*z0wl3-a2wl3*b2wl3)/(a2wl3*m*m+b2wl3);
    if((pwl3*pwl3/4.0)-qwl3<0){
    t2w1l3=t1+2.0;
    }else{
        zw1l3=-pwl3/2.0+sqrt((pwl3*pwl3/4.0)-qwl3);
        zw2l3=-pwl3/2.0-sqrt((pwl3*pwl3/4.0)-qwl3);
        t2w1l3=(zw1l3-z)/vz;
        t2w2l3=(zw2l3-z)/vz;
        if(t2w1l3<1e-15)
        t2w1l3=t1+2.0;
        if(t2w2l3<1e-15)
        t2w2l3=t1+2.0;
        if(t2w2l3<t2w1l3)
        t2w1l3=t2w2l3;
        xintersecwl3=m*(vz*t2w1l3+z)+n;
        if (xintersecwl3<0){
        t2w1l3=t1+2.0;}
        }
    pwlwt3=2.0*(a2wlwt3*m*n+b2wlwt3*z0wl3)/(a2wlwt3*m*m+b2wlwt3);
    qwlwt3=(a2wlwt3*n*n+b2wlwt3*z0wl3*z0wl3-a2wlwt3*b2wlwt3)/(a2wlwt3*m*m+b2wlwt3);
    if((pwlwt3*pwlwt3/4.0)-qwlwt3<0){
    t2w1lwt3=t1+2.0;
    }else{
        zw1lwt3=-pwlwt3/2.0+sqrt((pwlwt3*pwlwt3/4.0)-qwlwt3);
        zw2lwt3=-pwlwt3/2.0-sqrt((pwlwt3*pwlwt3/4.0)-qwlwt3);
        t2w1lwt3=(zw1lwt3-z)/vz;
        t2w2lwt3=(zw2lwt3-z)/vz;
        if(t2w1lwt3<1e-15)
        t2w1lwt3=t1+2.0;
        if(t2w2lwt3<1e-15)
        t2w2lwt3=t1+2.0;
        if(t2w2lwt3<t2w1lwt3)
        t2w1lwt3=t2w2lwt3;
        xintersecwlwt3=m*(vz*t2w1lwt3+z)+n;
        if (xintersecwlwt3<0){
        t2w1lwt3=t1+2.0;}
        }
  }

  if((loutwl3!=0 && linwl3==0) || (loutwl3==0 && linwl3!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl3=(2.0*m*n*pawl3+1.0)/(pawl3*m*m);
    qwl3=n*n/(m*m)-pbwl3/(pawl3*m*m);
    if(qwl3>0 && qwl3>(pwl3*pwl3/4)){
    t2w1l3=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l3=(pbwl3-pawl3*x*x-z)/vz;
      }else{
      t2w1l3=t1+2.0;
      }
    }else{
      zw1l3=-pwl3/2.0+sqrt(pwl3*pwl3/4.0-qwl3);
      zw2l3=-pwl3/2.0-sqrt(pwl3*pwl3/4.0-qwl3);
      t2w1l3=(zw1l3-z)/vz;
      t2w2l3=(zw2l3-z)/vz;
      if(t2w1l3<1e-15)
      t2w1l3=t1+2.0;
      if(t2w2l3<1e-15)
      t2w2l3=t1+2.0;
      if(t2w2l3<t2w1l3)
      t2w1l3=t2w2l3;
    }
    }
    xintersecwl3=m*(vz*t2w1l3+z)+n;
    if (xintersecwl3<0){
    t2w1l3=t1+2.0;}
    pwlwt3=(2.0*m*n*pawlwt3+1.0)/(pawlwt3*m*m);
    qwlwt3=n*n/(m*m)-pbwlwt3/(pawlwt3*m*m);
    if(qwlwt3>0 && qwlwt3>(pwlwt3*pwlwt3/4)){
    t2w1lwt3=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt3=(pbwlwt3-pawlwt3*x*x-z)/vz;
      }else{
      t2w1lwt3=t1+2.0;
      }
    }else{
      zw1lwt3=-pwlwt3/2.0+sqrt(pwlwt3*pwlwt3/4.0-qwlwt3);
      zw2lwt3=-pwlwt3/2.0-sqrt(pwlwt3*pwlwt3/4.0-qwlwt3);
      t2w1lwt3=(zw1lwt3-z)/vz;
      t2w2lwt3=(zw2lwt3-z)/vz;
      if(t2w1lwt3<1e-15)
      t2w1lwt3=t1+2.0;
      if(t2w2lwt3<1e-15)
      t2w2lwt3=t1+2.0;
      if(t2w2lwt3<t2w1lwt3)
      t2w1lwt3=t2w2lwt3;
    }
    xintersecwlwt3=m*(vz*t2w1lwt3+z)+n;
    if (xintersecwlwt3<0){
    t2w1lwt3=t1+2.0;}
  }
  }

  if(louthu3==0 && linhu3==0)
  {
  m=(h2u3-h1u3)/l;
  t2h1u3=(m*z+(h1u3)-y)/(vy-m*vz);
  t2h1uwt3=(m*z+(h1uwt3)-y)/(vy-m*vz);
  if(t2h1u3<1e-15)
  t2h1u3=t1+2.0;
  if(t2h1uwt3<1e-15)
  t2h1uwt3=t1+2.0;
  }


  if(louthu3!=0 && linhu3!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu3=2.0*(a2hu3*m*n+b2hu3*z0hu3)/(a2hu3*m*m+b2hu3);
    qhu3=(a2hu3*n*n+b2hu3*z0hu3*z0hu3-a2hu3*b2hu3)/(a2hu3*m*m+b2hu3);
    if((phu3*phu3/4.0)-qhu3<0){
    t2h1u3=t1+2.0;
    }else{
        zh1u3=-phu3/2.0+sqrt((phu3*phu3/4.0)-qhu3);
        zh2u3=-phu3/2.0-sqrt((phu3*phu3/4.0)-qhu3);
        t2h1u3=(zh1u3-z)/vz;
        t2h2u3=(zh2u3-z)/vz;
        if(t2h1u3<1e-15)
        t2h1u3=t1+2.0;
        if(t2h2u3<1e-15)
        t2h2u3=t1+2.0;
        if(t2h2u3<t2h1u3)
        t2h1u3=t2h2u3;
        yintersechu3=m*(vz*t2h1u3+z)+n;
        if (yintersechu3<0){
        t2h1u3=t1+2.0;}
        }
    phuwt3=2.0*(a2huwt3*m*n+b2huwt3*z0hu3)/(a2huwt3*m*m+b2huwt3);
    qhuwt3=(a2huwt3*n*n+b2huwt3*z0hu3*z0hu3-a2huwt3*b2huwt3)/(a2huwt3*m*m+b2huwt3);
    if((phuwt3*phuwt3/4.0)-qhuwt3<0){
    t2h1uwt3=t1+2.0;
    }else{
        zh1uwt3=-phuwt3/2.0+sqrt((phuwt3*phuwt3/4.0)-qhuwt3);
        zh2uwt3=-phuwt3/2.0-sqrt((phuwt3*phuwt3/4.0)-qhuwt3);
        t2h1uwt3=(zh1uwt3-z)/vz;
        t2h2uwt3=(zh2uwt3-z)/vz;
        if(t2h1uwt3<1e-15)
        t2h1uwt3=t1+2.0;
        if(t2h2uwt3<1e-15)
        t2h2uwt3=t1+2.0;
        if(t2h2uwt3<t2h1uwt3)
        t2h1uwt3=t2h2uwt3;
        yintersechuwt3=m*(vz*t2h1uwt3+z)+n;
        if (yintersechuwt3<0){
        t2h1uwt3=t1+2.0;}
        }
  }


  if((louthu3!=0 && linhu3==0)|| (louthu3==0 && linhu3!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu3=(2.0*m*n*pahu3+1.0)/(pahu3*m*m);	
    qhu3=n*n/(m*m)-pbhu3/(pahu3*m*m);
    if(qhu3>0 && qhu3>(phu3*phu3/4)){
    t2h1u3=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u3=(pbhu3-pahu3*y*y-z)/vz;
      }else{
      t2h1u3=t1+2.0;
      }
    }else{
      zh1u3=-phu3/2.0+sqrt(phu3*phu3/4.0-qhu3);
      zh2u3=-phu3/2.0-sqrt(phu3*phu3/4.0-qhu3);
      t2h1u3=(zh1u3-z)/vz;
      t2h2u3=(zh2u3-z)/vz;
      if(t2h1u3<1e-15)
      t2h1u3=t1+2.0;
      if(t2h2u3<1e-15)
      t2h2u3=t1+2.0;
      if(t2h2u3<t2h1u3)
      t2h1u3=t2h2u3;
    }
    yintersechu3=m*(vz*t2h1u3+z)+n;
    if (yintersechu3<0){
    t2h1u3=t1+2.0;}
  }
    phuwt3=(2.0*m*n*pahuwt3+1.0)/(pahuwt3*m*m);						
    qhuwt3=n*n/(m*m)-pbhuwt3/(pahuwt3*m*m);
    if(qhuwt3>0 && qhuwt3>(phuwt3*phuwt3/4)){
    t2h1uwt3=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt3=(pbhuwt3-pahuwt3*y*y-z)/vz;
      }else{
      t2h1uwt3=t1+2.0;
      }
    }else{
      zh1uwt3=-phuwt3/2.0+sqrt(phuwt3*phuwt3/4.0-qhuwt3);
      zh2uwt3=-phuwt3/2.0-sqrt(phuwt3*phuwt3/4.0-qhuwt3);
      t2h1uwt3=(zh1uwt3-z)/vz;
      t2h2uwt3=(zh2uwt3-z)/vz;
      if(t2h1uwt3<1e-15)
      t2h1uwt3=t1+2.0;
      if(t2h2uwt3<1e-15)
      t2h2uwt3=t1+2.0;
      if(t2h2uwt3<t2h1uwt3)
      t2h1uwt3=t2h2uwt3;
    }
    yintersechuwt3=m*(vz*t2h1uwt3+z)+n;
    if (yintersechuwt3<0){
    t2h1uwt3=t1+2.0;}
  }
  }

  if(louthd3==0 && linhd3==0)
  {
  m=(-h2d3+h1d3)/l;
  t2h1d3=(m*z+(-h1d3)-y)/(vy-m*vz);
  t2h1dwt3=(m*z+(-h1dwt3)-y)/(vy-m*vz);
  if(t2h1d3<1e-15)
  t2h1d3=t1+2.0;
  if(t2h1dwt3<1e-15)
  t2h1dwt3=t1+2.0;
  }

  if(louthd3!=0 && linhd3!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd3=2.0*(a2hd3*m*n+b2hd3*z0hd3)/(a2hd3*m*m+b2hd3);
    qhd3=(a2hd3*n*n+b2hd3*z0hd3*z0hd3-a2hd3*b2hd3)/(a2hd3*m*m+b2hd3);
    if((phd3*phd3/4.0)-qhd3<0){
    t2h1d3=t1+2.0;
    }else{
        zh1d3=-phd3/2.0+sqrt((phd3*phd3/4.0)-qhd3);
        zh2d3=-phd3/2.0-sqrt((phd3*phd3/4.0)-qhd3);
        t2h1d3=(zh1d3-z)/vz;
        t2h2d3=(zh2d3-z)/vz;
        if(t2h1d3<1e-15)
        t2h1d3=t1+2.0;
        if(t2h2d3<1e-15)
        t2h2d3=t1+2.0;
        if(t2h2d3<t2h1d3)
        t2h1d3=t2h2d3;
        yintersechd3=m*(vz*t2h1d3+z)+n;
        if (yintersechd3>0){
        t2h1d3=t1+2.0;}
        }
    phdwt3=2.0*(a2hdwt3*m*n+b2hdwt3*z0hd3)/(a2hdwt3*m*m+b2hdwt3);
    qhdwt3=(a2hdwt3*n*n+b2hdwt3*z0hd3*z0hd3-a2hdwt3*b2hdwt3)/(a2hdwt3*m*m+b2hdwt3);
    if((phdwt3*phdwt3/4.0)-qhdwt3<0){
    t2h1dwt3=t1+2.0;
    }else{
        zh1dwt3=-phdwt3/2.0+sqrt((phdwt3*phdwt3/4.0)-qhdwt3);
        zh2dwt3=-phdwt3/2.0-sqrt((phdwt3*phdwt3/4.0)-qhdwt3);
        t2h1dwt3=(zh1dwt3-z)/vz;
        t2h2dwt3=(zh2dwt3-z)/vz;
        if(t2h1dwt3<1e-15)
        t2h1dwt3=t1+2.0;
        if(t2h2dwt3<1e-15)
        t2h2dwt3=t1+2.0;
        if(t2h2dwt3<t2h1dwt3)
        t2h1dwt3=t2h2dwt3;
        yintersechdwt3=m*(vz*t2h1dwt3+z)+n;
        if (yintersechdwt3>0){
        t2h1dwt3=t1+2.0;}
        }
  }

  if((louthd3!=0 && linhd3==0)|| (louthd3==0 && linhd3!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd3=(2.0*m*n*pahd3+1.0)/(pahd3*m*m);
    qhd3=n*n/(m*m)-pbhd3/(pahd3*m*m);
    if(qhd3>0 && qhd3>(phd3*phd3/4)){
    t2h1d3=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d3=(pbhd3-pahd3*y*y-z)/vz;
      }else{
      t2h1d3=t1+2.0;
      }
    }else{
      zh1d3=-phd3/2.0+sqrt(phd3*phd3/4.0-qhd3);
      zh2d3=-phd3/2.0-sqrt(phd3*phd3/4.0-qhd3);
      t2h1d3=(zh1d3-z)/vz;
      t2h2d3=(zh2d3-z)/vz;
      if(t2h1d3<1e-15)
      t2h1d3=t1+2.0;
      if(t2h2d3<1e-15)
      t2h2d3=t1+2.0;
      if(t2h2d3<t2h1d3)
      t2h1d3=t2h2d3;
    }
    yintersechd3=m*(vz*t2h1d3+z)+n;
    if (yintersechd3>0){
    t2h1d3=t1+2.0;}
  }
    phdwt3=(2.0*m*n*pahdwt3+1.0)/(pahdwt3*m*m);
    qhdwt3=n*n/(m*m)-pbhdwt3/(pahdwt3*m*m);
    if(qhdwt3>0 && qhdwt3>(phdwt3*phdwt3/4)){
    t2h1dwt3=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt3=(pbhdwt3-pahdwt3*y*y-z)/vz;
      }else{
      t2h1dwt3=t1+2.0;
      }
    }else{
      zh1dwt3=-phdwt3/2.0+sqrt(phdwt3*phdwt3/4.0-qhdwt3);
      zh2dwt3=-phdwt3/2.0-sqrt(phdwt3*phdwt3/4.0-qhdwt3);
      t2h1dwt3=(zh1dwt3-z)/vz;
      t2h2dwt3=(zh2dwt3-z)/vz;
      if(t2h1dwt3<1e-15)
      t2h1dwt3=t1+2.0;
      if(t2h2dwt3<1e-15)
      t2h2dwt3=t1+2.0;
      if(t2h2dwt3<t2h1dwt3)
      t2h1dwt3=t2h2dwt3;
    }
    yintersechdwt3=m*(vz*t2h1dwt3+z)+n;
    if (yintersechdwt3>0){
    t2h1dwt3=t1+2.0;}
  }
  }

 if(loutwr4==0 && linwr4==0)
  {
  m=(-w2r4+w1r4)/l;
  t2w1r4=(m*z+(-w1r4)-x)/(vx-m*vz);
  t2w1rwt4=(m*z+(-w1rwt4)-x)/(vx-m*vz);
  if(t2w1r4<1e-15)
    t2w1r4=t1+2.0;
  if(t2w1rwt4<1e-15)
    t2w1rwt4=t1+2.0; 
  }


  if(loutwr4!=0 && linwr4!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr4=2.0*(a2wr4*m*n+b2wr4*z0wr4)/(a2wr4*m*m+b2wr4);
    qwr4=(a2wr4*n*n+b2wr4*z0wr4*z0wr4-a2wr4*b2wr4)/(a2wr4*m*m+b2wr4);
    if ((pwr4*pwr4/4.0)-qwr4<0){
    t2w1r4=t1+2.0;
    }else{
        zw1r4=-pwr4/2.0+sqrt((pwr4*pwr4/4.0)-qwr4);
        zw2r4=-pwr4/2.0-sqrt((pwr4*pwr4/4.0)-qwr4);
        t2w1r4=(zw1r4-z)/vz;
        t2w2r4=(zw2r4-z)/vz;
        if(t2w1r4<1e-15)
        t2w1r4=t1+2.0;
        if(t2w2r4<1e-15)
        t2w2r4=t1+2.0;
        if(t2w2r4<t2w1r4)
        t2w1r4=t2w2r4;
        xintersecwr4=m*(vz*t2w1r4+z)+n;
        if (xintersecwr4>0){
        t2w1r4=t1+2.0;}
        }
    pwrwt4=2.0*(a2wrwt4*m*n+b2wrwt4*z0wr4)/(a2wrwt4*m*m+b2wrwt4);
    qwrwt4=(a2wrwt4*n*n+b2wrwt4*z0wr4*z0wr4-a2wrwt4*b2wrwt4)/(a2wrwt4*m*m+b2wrwt4);
    if ((pwrwt4*pwrwt4/4.0)-qwrwt4<0){
    t2w1rwt4=t1+2.0;
    }else{
        zw1rwt4=-pwrwt4/2.0+sqrt((pwrwt4*pwrwt4/4.0)-qwrwt4);
        zw2rwt4=-pwrwt4/2.0-sqrt((pwrwt4*pwrwt4/4.0)-qwrwt4);
        t2w1rwt4=(zw1rwt4-z)/vz;
        t2w2rwt4=(zw2rwt4-z)/vz;
        if(t2w1rwt4<1e-15)
        t2w1rwt4=t1+2.0;
        if(t2w2rwt4<1e-15)
        t2w2rwt4=t1+2.0;
        if(t2w2rwt4<t2w1rwt4)
        t2w1rwt4=t2w2rwt4;
        xintersecwrwt4=m*(vz*t2w1rwt4+z)+n;
        if (xintersecwrwt4>0){
        t2w1rwt4=t1+2.0;}
        }
    }

  if((loutwr4!=0 && linwr4==0)|| (loutwr4==0 && linwr4!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr4=(2.0*m*n*pawr4+1.0)/(pawr4*m*m);
    qwr4=n*n/(m*m)-pbwr4/(pawr4*m*m);
    if(qwr4>0 && qwr4>(pwr4*pwr4/4)){
    t2w1r4=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r4=(pbwr4-pawr4*x*x-z)/vz;
      }else{
      t2w1r4=t1+2.0;
      }
    }else{
      zw1r4=-pwr4/2.0+sqrt(pwr4*pwr4/4.0-qwr4);
      zw2r4=-pwr4/2.0-sqrt(pwr4*pwr4/4.0-qwr4);
      t2w1r4=(zw1r4-z)/vz;
      t2w2r4=(zw2r4-z)/vz;
      if(t2w1r4<1e-15)
      t2w1r4=t1+2.0;
      if(t2w2r4<1e-15)
      t2w2r4=t1+2.0;
      if(t2w2r4<t2w1r4)
      t2w1r4=t2w2r4;
    }
    xintersecwr4=m*(vz*t2w1r4+z)+n;
    if (xintersecwr4>0){
    t2w1r4=t1+2.0;}
    }
    pwrwt4=(2.0*m*n*pawrwt4+1.0)/(pawrwt4*m*m);
    qwrwt4=n*n/(m*m)-pbwrwt4/(pawrwt4*m*m);
    if(qwrwt4>0 && qwrwt4>(pwrwt4*pwrwt4/4)){
    t2w1rwt4=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt4=(pbwrwt4-pawrwt4*x*x-z)/vz;
      }else{
      t2w1rwt4=t1+2.0; 
      }
    }else{
      zw1rwt4=-pwrwt4/2.0+sqrt(pwrwt4*pwrwt4/4.0-qwrwt4);
      zw2rwt4=-pwrwt4/2.0-sqrt(pwrwt4*pwrwt4/4.0-qwrwt4);
      t2w1rwt4=(zw1rwt4-z)/vz;
      t2w2rwt4=(zw2rwt4-z)/vz;
      if(t2w1rwt4<1e-15)
      t2w1rwt4=t1+2.0;
      if(t2w2rwt4<1e-15)
      t2w2rwt4=t1+2.0;
      if(t2w2rwt4<t2w1rwt4)
      t2w1rwt4=t2w2rwt4;
    }
    xintersecwrwt4=m*(vz*t2w1rwt4+z)+n;
    if (xintersecwrwt4>0){
    t2w1rwt4=t1+2.0;}
  }
  }

  if(loutwl4==0 && linwl4==0)
  {
  m=(w2l4-w1l4)/l;
  t2w1l4=(m*z+(w1l4)-x)/(vx-m*vz);
  t2w1lwt4=(m*z+(w1lwt4)-x)/(vx-m*vz);
  if(t2w1l4<1e-15)
  t2w1l4=t1+2.0;
  if(t2w1lwt4<1e-15)
  t2w1lwt4=t1+2.0;
  };

  if(loutwl4!=0 && linwl4!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl4=2.0*(a2wl4*m*n+b2wl4*z0wl4)/(a2wl4*m*m+b2wl4);
    qwl4=(a2wl4*n*n+b2wl4*z0wl4*z0wl4-a2wl4*b2wl4)/(a2wl4*m*m+b2wl4);
    if((pwl4*pwl4/4.0)-qwl4<0){
    t2w1l4=t1+2.0;
    }else{
        zw1l4=-pwl4/2.0+sqrt((pwl4*pwl4/4.0)-qwl4);
        zw2l4=-pwl4/2.0-sqrt((pwl4*pwl4/4.0)-qwl4);
        t2w1l4=(zw1l4-z)/vz;
        t2w2l4=(zw2l4-z)/vz;
        if(t2w1l4<1e-15)
        t2w1l4=t1+2.0;
        if(t2w2l4<1e-15)
        t2w2l4=t1+2.0;
        if(t2w2l4<t2w1l4)
        t2w1l4=t2w2l4;
        xintersecwl4=m*(vz*t2w1l4+z)+n;
        if (xintersecwl4<0){
        t2w1l4=t1+2.0;}
        }
    pwlwt4=2.0*(a2wlwt4*m*n+b2wlwt4*z0wl4)/(a2wlwt4*m*m+b2wlwt4);
    qwlwt4=(a2wlwt4*n*n+b2wlwt4*z0wl4*z0wl4-a2wlwt4*b2wlwt4)/(a2wlwt4*m*m+b2wlwt4);
    if((pwlwt4*pwlwt4/4.0)-qwlwt4<0){
    t2w1lwt4=t1+2.0;
    }else{
        zw1lwt4=-pwlwt4/2.0+sqrt((pwlwt4*pwlwt4/4.0)-qwlwt4);
        zw2lwt4=-pwlwt4/2.0-sqrt((pwlwt4*pwlwt4/4.0)-qwlwt4);
        t2w1lwt4=(zw1lwt4-z)/vz;
        t2w2lwt4=(zw2lwt4-z)/vz;
        if(t2w1lwt4<1e-15)
        t2w1lwt4=t1+2.0;
        if(t2w2lwt4<1e-15)
        t2w2lwt4=t1+2.0;
        if(t2w2lwt4<t2w1lwt4)
        t2w1lwt4=t2w2lwt4;
        xintersecwlwt4=m*(vz*t2w1lwt4+z)+n;
        if (xintersecwlwt4<0){
        t2w1lwt4=t1+2.0;}
        }
  }

  if((loutwl4!=0 && linwl4==0) || (loutwl4==0 && linwl4!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl4=(2.0*m*n*pawl4+1.0)/(pawl4*m*m);
    qwl4=n*n/(m*m)-pbwl4/(pawl4*m*m);
    if(qwl4>0 && qwl4>(pwl4*pwl4/4)){
    t2w1l4=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l4=(pbwl4-pawl4*x*x-z)/vz;
      }else{
      t2w1l4=t1+2.0;
      }
    }else{
      zw1l4=-pwl4/2.0+sqrt(pwl4*pwl4/4.0-qwl4);
      zw2l4=-pwl4/2.0-sqrt(pwl4*pwl4/4.0-qwl4);
      t2w1l4=(zw1l4-z)/vz;
      t2w2l4=(zw2l4-z)/vz;
      if(t2w1l4<1e-15)
      t2w1l4=t1+2.0;
      if(t2w2l4<1e-15)
      t2w2l4=t1+2.0;
      if(t2w2l4<t2w1l4)
      t2w1l4=t2w2l4;
    }
    }
    xintersecwl4=m*(vz*t2w1l4+z)+n;
    if (xintersecwl4<0){
    t2w1l4=t1+2.0;}
    pwlwt4=(2.0*m*n*pawlwt4+1.0)/(pawlwt4*m*m);
    qwlwt4=n*n/(m*m)-pbwlwt4/(pawlwt4*m*m);
    if(qwlwt4>0 && qwlwt4>(pwlwt4*pwlwt4/4)){
    t2w1lwt4=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt4=(pbwlwt4-pawlwt4*x*x-z)/vz;
      }else{
      t2w1lwt4=t1+2.0;
      }
    }else{
      zw1lwt4=-pwlwt4/2.0+sqrt(pwlwt4*pwlwt4/4.0-qwlwt4);
      zw2lwt4=-pwlwt4/2.0-sqrt(pwlwt4*pwlwt4/4.0-qwlwt4);
      t2w1lwt4=(zw1lwt4-z)/vz;
      t2w2lwt4=(zw2lwt4-z)/vz;
      if(t2w1lwt4<1e-15)
      t2w1lwt4=t1+2.0;
      if(t2w2lwt4<1e-15)
      t2w2lwt4=t1+2.0;
      if(t2w2lwt4<t2w1lwt4)
      t2w1lwt4=t2w2lwt4;
    }
    xintersecwlwt4=m*(vz*t2w1lwt4+z)+n;
    if (xintersecwlwt4<0){
    t2w1lwt4=t1+2.0;}
  }
  }

  if(louthu4==0 && linhu4==0)
  {
  m=(h2u4-h1u4)/l;
  t2h1u4=(m*z+(h1u4)-y)/(vy-m*vz);
  t2h1uwt4=(m*z+(h1uwt4)-y)/(vy-m*vz);
  if(t2h1u4<1e-15)
  t2h1u4=t1+2.0;
  if(t2h1uwt4<1e-15)
  t2h1uwt4=t1+2.0;
  }


  if(louthu4!=0 && linhu4!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu4=2.0*(a2hu4*m*n+b2hu4*z0hu4)/(a2hu4*m*m+b2hu4);
    qhu4=(a2hu4*n*n+b2hu4*z0hu4*z0hu4-a2hu4*b2hu4)/(a2hu4*m*m+b2hu4);
    if((phu4*phu4/4.0)-qhu4<0){
    t2h1u4=t1+2.0;
    }else{
        zh1u4=-phu4/2.0+sqrt((phu4*phu4/4.0)-qhu4);
        zh2u4=-phu4/2.0-sqrt((phu4*phu4/4.0)-qhu4);
        t2h1u4=(zh1u4-z)/vz;
        t2h2u4=(zh2u4-z)/vz;
        if(t2h1u4<1e-15)
        t2h1u4=t1+2.0;
        if(t2h2u4<1e-15)
        t2h2u4=t1+2.0;
        if(t2h2u4<t2h1u4)
        t2h1u4=t2h2u4;
        yintersechu4=m*(vz*t2h1u4+z)+n;
        if (yintersechu4<0){
        t2h1u4=t1+2.0;}
        }
    phuwt4=2.0*(a2huwt4*m*n+b2huwt4*z0hu4)/(a2huwt4*m*m+b2huwt4);
    qhuwt4=(a2huwt4*n*n+b2huwt4*z0hu4*z0hu4-a2huwt4*b2huwt4)/(a2huwt4*m*m+b2huwt4);
    if((phuwt4*phuwt4/4.0)-qhuwt4<0){
    t2h1uwt4=t1+2.0;
    }else{
        zh1uwt4=-phuwt4/2.0+sqrt((phuwt4*phuwt4/4.0)-qhuwt4);
        zh2uwt4=-phuwt4/2.0-sqrt((phuwt4*phuwt4/4.0)-qhuwt4);
        t2h1uwt4=(zh1uwt4-z)/vz;
        t2h2uwt4=(zh2uwt4-z)/vz;
        if(t2h1uwt4<1e-15)
        t2h1uwt4=t1+2.0;
        if(t2h2uwt4<1e-15)
        t2h2uwt4=t1+2.0;
        if(t2h2uwt4<t2h1uwt4)
        t2h1uwt4=t2h2uwt4;
        yintersechuwt4=m*(vz*t2h1uwt4+z)+n;
        if (yintersechuwt4<0){
        t2h1uwt4=t1+2.0;}
        }
  }


  if((louthu4!=0 && linhu4==0)|| (louthu4==0 && linhu4!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu4=(2.0*m*n*pahu4+1.0)/(pahu4*m*m);	
    qhu4=n*n/(m*m)-pbhu4/(pahu4*m*m);
    if(qhu4>0 && qhu4>(phu4*phu4/4)){
    t2h1u4=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u4=(pbhu4-pahu4*y*y-z)/vz;
      }else{
      t2h1u4=t1+2.0;
      }
    }else{
      zh1u4=-phu4/2.0+sqrt(phu4*phu4/4.0-qhu4);
      zh2u4=-phu4/2.0-sqrt(phu4*phu4/4.0-qhu4);
      t2h1u4=(zh1u4-z)/vz;
      t2h2u4=(zh2u4-z)/vz;
      if(t2h1u4<1e-15)
      t2h1u4=t1+2.0;
      if(t2h2u4<1e-15)
      t2h2u4=t1+2.0;
      if(t2h2u4<t2h1u4)
      t2h1u4=t2h2u4;
    }
    yintersechu4=m*(vz*t2h1u4+z)+n;
    if (yintersechu4<0){
    t2h1u4=t1+2.0;}
  }
    phuwt4=(2.0*m*n*pahuwt4+1.0)/(pahuwt4*m*m);						
    qhuwt4=n*n/(m*m)-pbhuwt4/(pahuwt4*m*m);
    if(qhuwt4>0 && qhuwt4>(phuwt4*phuwt4/4)){
    t2h1uwt4=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt4=(pbhuwt4-pahuwt4*y*y-z)/vz;
      }else{
      t2h1uwt4=t1+2.0;
      }
    }else{
      zh1uwt4=-phuwt4/2.0+sqrt(phuwt4*phuwt4/4.0-qhuwt4);
      zh2uwt4=-phuwt4/2.0-sqrt(phuwt4*phuwt4/4.0-qhuwt4);
      t2h1uwt4=(zh1uwt4-z)/vz;
      t2h2uwt4=(zh2uwt4-z)/vz;
      if(t2h1uwt4<1e-15)
      t2h1uwt4=t1+2.0;
      if(t2h2uwt4<1e-15)
      t2h2uwt4=t1+2.0;
      if(t2h2uwt4<t2h1uwt4)
      t2h1uwt4=t2h2uwt4;
    }
    yintersechuwt4=m*(vz*t2h1uwt4+z)+n;
    if (yintersechuwt4<0){
    t2h1uwt4=t1+2.0;}
  }
  }

  if(louthd4==0 && linhd4==0)
  {
  m=(-h2d4+h1d4)/l;
  t2h1d4=(m*z+(-h1d4)-y)/(vy-m*vz);
  t2h1dwt4=(m*z+(-h1dwt4)-y)/(vy-m*vz);
  if(t2h1d4<1e-15)
  t2h1d4=t1+2.0;
  if(t2h1dwt4<1e-15)
  t2h1dwt4=t1+2.0;
  }

  if(louthd4!=0 && linhd4!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd4=2.0*(a2hd4*m*n+b2hd4*z0hd4)/(a2hd4*m*m+b2hd4);
    qhd4=(a2hd4*n*n+b2hd4*z0hd4*z0hd4-a2hd4*b2hd4)/(a2hd4*m*m+b2hd4);
    if((phd4*phd4/4.0)-qhd4<0){
    t2h1d4=t1+2.0;
    }else{
        zh1d4=-phd4/2.0+sqrt((phd4*phd4/4.0)-qhd4);
        zh2d4=-phd4/2.0-sqrt((phd4*phd4/4.0)-qhd4);
        t2h1d4=(zh1d4-z)/vz;
        t2h2d4=(zh2d4-z)/vz;
        if(t2h1d4<1e-15)
        t2h1d4=t1+2.0;
        if(t2h2d4<1e-15)
        t2h2d4=t1+2.0;
        if(t2h2d4<t2h1d4)
        t2h1d4=t2h2d4;
        yintersechd4=m*(vz*t2h1d4+z)+n;
        if (yintersechd4>0){
        t2h1d4=t1+2.0;}
        }
    phdwt4=2.0*(a2hdwt4*m*n+b2hdwt4*z0hd4)/(a2hdwt4*m*m+b2hdwt4);
    qhdwt4=(a2hdwt4*n*n+b2hdwt4*z0hd4*z0hd4-a2hdwt4*b2hdwt4)/(a2hdwt4*m*m+b2hdwt4);
    if((phdwt4*phdwt4/4.0)-qhdwt4<0){
    t2h1dwt4=t1+2.0;
    }else{
        zh1dwt4=-phdwt4/2.0+sqrt((phdwt4*phdwt4/4.0)-qhdwt4);
        zh2dwt4=-phdwt4/2.0-sqrt((phdwt4*phdwt4/4.0)-qhdwt4);
        t2h1dwt4=(zh1dwt4-z)/vz;
        t2h2dwt4=(zh2dwt4-z)/vz;
        if(t2h1dwt4<1e-15)
        t2h1dwt4=t1+2.0;
        if(t2h2dwt4<1e-15)
        t2h2dwt4=t1+2.0;
        if(t2h2dwt4<t2h1dwt4)
        t2h1dwt4=t2h2dwt4;
        yintersechdwt4=m*(vz*t2h1dwt4+z)+n;
        if (yintersechdwt4>0){
        t2h1dwt4=t1+2.0;}
        }
  }

  if((louthd4!=0 && linhd4==0)|| (louthd4==0 && linhd4!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd4=(2.0*m*n*pahd4+1.0)/(pahd4*m*m);
    qhd4=n*n/(m*m)-pbhd4/(pahd4*m*m);
    if(qhd4>0 && qhd4>(phd4*phd4/4)){
    t2h1d4=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d4=(pbhd4-pahd4*y*y-z)/vz;
      }else{
      t2h1d4=t1+2.0;
      }
    }else{
      zh1d4=-phd4/2.0+sqrt(phd4*phd4/4.0-qhd4);
      zh2d4=-phd4/2.0-sqrt(phd4*phd4/4.0-qhd4);
      t2h1d4=(zh1d4-z)/vz;
      t2h2d4=(zh2d4-z)/vz;
      if(t2h1d4<1e-15)
      t2h1d4=t1+2.0;
      if(t2h2d4<1e-15)
      t2h2d4=t1+2.0;
      if(t2h2d4<t2h1d4)
      t2h1d4=t2h2d4;
    }
    yintersechd4=m*(vz*t2h1d4+z)+n;
    if (yintersechd4>0){
    t2h1d4=t1+2.0;}
  }
    phdwt4=(2.0*m*n*pahdwt4+1.0)/(pahdwt4*m*m);
    qhdwt4=n*n/(m*m)-pbhdwt4/(pahdwt4*m*m);
    if(qhdwt4>0 && qhdwt4>(phdwt4*phdwt4/4)){
    t2h1dwt4=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt4=(pbhdwt4-pahdwt4*y*y-z)/vz;
      }else{
      t2h1dwt4=t1+2.0;
      }
    }else{
      zh1dwt4=-phdwt4/2.0+sqrt(phdwt4*phdwt4/4.0-qhdwt4);
      zh2dwt4=-phdwt4/2.0-sqrt(phdwt4*phdwt4/4.0-qhdwt4);
      t2h1dwt4=(zh1dwt4-z)/vz;
      t2h2dwt4=(zh2dwt4-z)/vz;
      if(t2h1dwt4<1e-15)
      t2h1dwt4=t1+2.0;
      if(t2h2dwt4<1e-15)
      t2h2dwt4=t1+2.0;
      if(t2h2dwt4<t2h1dwt4)
      t2h1dwt4=t2h2dwt4;
    }
    yintersechdwt4=m*(vz*t2h1dwt4+z)+n;
    if (yintersechdwt4>0){
    t2h1dwt4=t1+2.0;}
  }
  }


  if(loutwr5==0 && linwr5==0)
  {
  m=(-w2r5+w1r5)/l;
  t2w1r5=(m*z+(-w1r5)-x)/(vx-m*vz);
  t2w1rwt5=(m*z+(-w1rwt5)-x)/(vx-m*vz);
  if(t2w1r5<1e-15)
    t2w1r5=t1+2.0;
  if(t2w1rwt5<1e-15)
    t2w1rwt5=t1+2.0; 
  }


  if(loutwr5!=0 && linwr5!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr5=2.0*(a2wr5*m*n+b2wr5*z0wr5)/(a2wr5*m*m+b2wr5);
    qwr5=(a2wr5*n*n+b2wr5*z0wr5*z0wr5-a2wr5*b2wr5)/(a2wr5*m*m+b2wr5);
    if ((pwr5*pwr5/4.0)-qwr5<0){
    t2w1r5=t1+2.0;
    }else{
        zw1r5=-pwr5/2.0+sqrt((pwr5*pwr5/4.0)-qwr5);
        zw2r5=-pwr5/2.0-sqrt((pwr5*pwr5/4.0)-qwr5);
        t2w1r5=(zw1r5-z)/vz;
        t2w2r5=(zw2r5-z)/vz;
        if(t2w1r5<1e-15)
        t2w1r5=t1+2.0;
        if(t2w2r5<1e-15)
        t2w2r5=t1+2.0;
        if(t2w2r5<t2w1r5)
        t2w1r5=t2w2r5;
        xintersecwr5=m*(vz*t2w1r5+z)+n;
        if (xintersecwr5>0){
        t2w1r5=t1+2.0;}
        }
    pwrwt5=2.0*(a2wrwt5*m*n+b2wrwt5*z0wr5)/(a2wrwt5*m*m+b2wrwt5);
    qwrwt5=(a2wrwt5*n*n+b2wrwt5*z0wr5*z0wr5-a2wrwt5*b2wrwt5)/(a2wrwt5*m*m+b2wrwt5);
    if ((pwrwt5*pwrwt5/4.0)-qwrwt5<0){
    t2w1rwt5=t1+2.0;
    }else{
        zw1rwt5=-pwrwt5/2.0+sqrt((pwrwt5*pwrwt5/4.0)-qwrwt5);
        zw2rwt5=-pwrwt5/2.0-sqrt((pwrwt5*pwrwt5/4.0)-qwrwt5);
        t2w1rwt5=(zw1rwt5-z)/vz;
        t2w2rwt5=(zw2rwt5-z)/vz;
        if(t2w1rwt5<1e-15)
        t2w1rwt5=t1+2.0;
        if(t2w2rwt5<1e-15)
        t2w2rwt5=t1+2.0;
        if(t2w2rwt5<t2w1rwt5)
        t2w1rwt5=t2w2rwt5;
        xintersecwrwt5=m*(vz*t2w1rwt5+z)+n;
        if (xintersecwrwt5>0){
        t2w1rwt5=t1+2.0;}
        }
    }

  if((loutwr5!=0 && linwr5==0)|| (loutwr5==0 && linwr5!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr5=(2.0*m*n*pawr5+1.0)/(pawr5*m*m);
    qwr5=n*n/(m*m)-pbwr5/(pawr5*m*m);
    if(qwr5>0 && qwr5>(pwr5*pwr5/4)){
    t2w1r5=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r5=(pbwr5-pawr5*x*x-z)/vz;
      }else{
      t2w1r5=t1+2.0;
      }
    }else{
      zw1r5=-pwr5/2.0+sqrt(pwr5*pwr5/4.0-qwr5);
      zw2r5=-pwr5/2.0-sqrt(pwr5*pwr5/4.0-qwr5);
      t2w1r5=(zw1r5-z)/vz;
      t2w2r5=(zw2r5-z)/vz;
      if(t2w1r5<1e-15)
      t2w1r5=t1+2.0;
      if(t2w2r5<1e-15)
      t2w2r5=t1+2.0;
      if(t2w2r5<t2w1r5)
      t2w1r5=t2w2r5;
    }
    xintersecwr5=m*(vz*t2w1r5+z)+n;
    if (xintersecwr5>0){
    t2w1r5=t1+2.0;}
    }
    pwrwt5=(2.0*m*n*pawrwt5+1.0)/(pawrwt5*m*m);
    qwrwt5=n*n/(m*m)-pbwrwt5/(pawrwt5*m*m);
    if(qwrwt5>0 && qwrwt5>(pwrwt5*pwrwt5/4)){
    t2w1rwt5=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt5=(pbwrwt5-pawrwt5*x*x-z)/vz;
      }else{
      t2w1rwt5=t1+2.0; 
      }
    }else{
      zw1rwt5=-pwrwt5/2.0+sqrt(pwrwt5*pwrwt5/4.0-qwrwt5);
      zw2rwt5=-pwrwt5/2.0-sqrt(pwrwt5*pwrwt5/4.0-qwrwt5);
      t2w1rwt5=(zw1rwt5-z)/vz;
      t2w2rwt5=(zw2rwt5-z)/vz;
      if(t2w1rwt5<1e-15)
      t2w1rwt5=t1+2.0;
      if(t2w2rwt5<1e-15)
      t2w2rwt5=t1+2.0;
      if(t2w2rwt5<t2w1rwt5)
      t2w1rwt5=t2w2rwt5;
    }
    xintersecwrwt5=m*(vz*t2w1rwt5+z)+n;
    if (xintersecwrwt5>0){
    t2w1rwt5=t1+2.0;}
  }
  }

  if(loutwl5==0 && linwl5==0)
  {
  m=(w2l5-w1l5)/l;
  t2w1l5=(m*z+(w1l5)-x)/(vx-m*vz);
  t2w1lwt5=(m*z+(w1lwt5)-x)/(vx-m*vz);
  if(t2w1l5<1e-15)
  t2w1l5=t1+2.0;
  if(t2w1lwt5<1e-15)
  t2w1lwt5=t1+2.0;
  };

  if(loutwl5!=0 && linwl5!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl5=2.0*(a2wl5*m*n+b2wl5*z0wl5)/(a2wl5*m*m+b2wl5);
    qwl5=(a2wl5*n*n+b2wl5*z0wl5*z0wl5-a2wl5*b2wl5)/(a2wl5*m*m+b2wl5);
    if((pwl5*pwl5/4.0)-qwl5<0){
    t2w1l5=t1+2.0;
    }else{
        zw1l5=-pwl5/2.0+sqrt((pwl5*pwl5/4.0)-qwl5);
        zw2l5=-pwl5/2.0-sqrt((pwl5*pwl5/4.0)-qwl5);
        t2w1l5=(zw1l5-z)/vz;
        t2w2l5=(zw2l5-z)/vz;
        if(t2w1l5<1e-15)
        t2w1l5=t1+2.0;
        if(t2w2l5<1e-15)
        t2w2l5=t1+2.0;
        if(t2w2l5<t2w1l5)
        t2w1l5=t2w2l5;
        xintersecwl5=m*(vz*t2w1l5+z)+n;
        if (xintersecwl5<0){
        t2w1l5=t1+2.0;}
        }
    pwlwt5=2.0*(a2wlwt5*m*n+b2wlwt5*z0wl5)/(a2wlwt5*m*m+b2wlwt5);
    qwlwt5=(a2wlwt5*n*n+b2wlwt5*z0wl5*z0wl5-a2wlwt5*b2wlwt5)/(a2wlwt5*m*m+b2wlwt5);
    if((pwlwt5*pwlwt5/4.0)-qwlwt5<0){
    t2w1lwt5=t1+2.0;
    }else{
        zw1lwt5=-pwlwt5/2.0+sqrt((pwlwt5*pwlwt5/4.0)-qwlwt5);
        zw2lwt5=-pwlwt5/2.0-sqrt((pwlwt5*pwlwt5/4.0)-qwlwt5);
        t2w1lwt5=(zw1lwt5-z)/vz;
        t2w2lwt5=(zw2lwt5-z)/vz;
        if(t2w1lwt5<1e-15)
        t2w1lwt5=t1+2.0;
        if(t2w2lwt5<1e-15)
        t2w2lwt5=t1+2.0;
        if(t2w2lwt5<t2w1lwt5)
        t2w1lwt5=t2w2lwt5;
        xintersecwlwt5=m*(vz*t2w1lwt5+z)+n;
        if (xintersecwlwt5<0){
        t2w1lwt5=t1+2.0;}
        }
  }

  if((loutwl5!=0 && linwl5==0) || (loutwl5==0 && linwl5!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl5=(2.0*m*n*pawl5+1.0)/(pawl5*m*m);
    qwl5=n*n/(m*m)-pbwl5/(pawl5*m*m);
    if(qwl5>0 && qwl5>(pwl5*pwl5/4)){
    t2w1l5=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l5=(pbwl5-pawl5*x*x-z)/vz;
      }else{
      t2w1l5=t1+2.0;
      }
    }else{
      zw1l5=-pwl5/2.0+sqrt(pwl5*pwl5/4.0-qwl5);
      zw2l5=-pwl5/2.0-sqrt(pwl5*pwl5/4.0-qwl5);
      t2w1l5=(zw1l5-z)/vz;
      t2w2l5=(zw2l5-z)/vz;
      if(t2w1l5<1e-15)
      t2w1l5=t1+2.0;
      if(t2w2l5<1e-15)
      t2w2l5=t1+2.0;
      if(t2w2l5<t2w1l5)
      t2w1l5=t2w2l5;
    }
    }
    xintersecwl5=m*(vz*t2w1l5+z)+n;
    if (xintersecwl5<0){
    t2w1l5=t1+2.0;}
    pwlwt5=(2.0*m*n*pawlwt5+1.0)/(pawlwt5*m*m);
    qwlwt5=n*n/(m*m)-pbwlwt5/(pawlwt5*m*m);
    if(qwlwt5>0 && qwlwt5>(pwlwt5*pwlwt5/4)){
    t2w1lwt5=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt5=(pbwlwt5-pawlwt5*x*x-z)/vz;
      }else{
      t2w1lwt5=t1+2.0;
      }
    }else{
      zw1lwt5=-pwlwt5/2.0+sqrt(pwlwt5*pwlwt5/4.0-qwlwt5);
      zw2lwt5=-pwlwt5/2.0-sqrt(pwlwt5*pwlwt5/4.0-qwlwt5);
      t2w1lwt5=(zw1lwt5-z)/vz;
      t2w2lwt5=(zw2lwt5-z)/vz;
      if(t2w1lwt5<1e-15)
      t2w1lwt5=t1+2.0;
      if(t2w2lwt5<1e-15)
      t2w2lwt5=t1+2.0;
      if(t2w2lwt5<t2w1lwt5)
      t2w1lwt5=t2w2lwt5;
    }
    xintersecwlwt5=m*(vz*t2w1lwt5+z)+n;
    if (xintersecwlwt5<0){
    t2w1lwt5=t1+2.0;}
  }
  }

  if(louthu5==0 && linhu5==0)
  {
  m=(h2u5-h1u5)/l;
  t2h1u5=(m*z+(h1u5)-y)/(vy-m*vz);
  t2h1uwt5=(m*z+(h1uwt5)-y)/(vy-m*vz);
  if(t2h1u5<1e-15)
  t2h1u5=t1+2.0;
  if(t2h1uwt5<1e-15)
  t2h1uwt5=t1+2.0;
  }


  if(louthu5!=0 && linhu5!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu5=2.0*(a2hu5*m*n+b2hu5*z0hu5)/(a2hu5*m*m+b2hu5);
    qhu5=(a2hu5*n*n+b2hu5*z0hu5*z0hu5-a2hu5*b2hu5)/(a2hu5*m*m+b2hu5);
    if((phu5*phu5/4.0)-qhu5<0){
    t2h1u5=t1+2.0;
    }else{
        zh1u5=-phu5/2.0+sqrt((phu5*phu5/4.0)-qhu5);
        zh2u5=-phu5/2.0-sqrt((phu5*phu5/4.0)-qhu5);
        t2h1u5=(zh1u5-z)/vz;
        t2h2u5=(zh2u5-z)/vz;
        if(t2h1u5<1e-15)
        t2h1u5=t1+2.0;
        if(t2h2u5<1e-15)
        t2h2u5=t1+2.0;
        if(t2h2u5<t2h1u5)
        t2h1u5=t2h2u5;
        yintersechu5=m*(vz*t2h1u5+z)+n;
        if (yintersechu5<0){
        t2h1u5=t1+2.0;}
        }
    phuwt5=2.0*(a2huwt5*m*n+b2huwt5*z0hu5)/(a2huwt5*m*m+b2huwt5);
    qhuwt5=(a2huwt5*n*n+b2huwt5*z0hu5*z0hu5-a2huwt5*b2huwt5)/(a2huwt5*m*m+b2huwt5);
    if((phuwt5*phuwt5/4.0)-qhuwt5<0){
    t2h1uwt5=t1+2.0;
    }else{
        zh1uwt5=-phuwt5/2.0+sqrt((phuwt5*phuwt5/4.0)-qhuwt5);
        zh2uwt5=-phuwt5/2.0-sqrt((phuwt5*phuwt5/4.0)-qhuwt5);
        t2h1uwt5=(zh1uwt5-z)/vz;
        t2h2uwt5=(zh2uwt5-z)/vz;
        if(t2h1uwt5<1e-15)
        t2h1uwt5=t1+2.0;
        if(t2h2uwt5<1e-15)
        t2h2uwt5=t1+2.0;
        if(t2h2uwt5<t2h1uwt5)
        t2h1uwt5=t2h2uwt5;
        yintersechuwt5=m*(vz*t2h1uwt5+z)+n;
        if (yintersechuwt5<0){
        t2h1uwt5=t1+2.0;}
        }
  }


  if((louthu5!=0 && linhu5==0)|| (louthu5==0 && linhu5!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu5=(2.0*m*n*pahu5+1.0)/(pahu5*m*m);	
    qhu5=n*n/(m*m)-pbhu5/(pahu5*m*m);
    if(qhu5>0 && qhu5>(phu5*phu5/4)){
    t2h1u5=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u5=(pbhu5-pahu5*y*y-z)/vz;
      }else{
      t2h1u5=t1+2.0;
      }
    }else{
      zh1u5=-phu5/2.0+sqrt(phu5*phu5/4.0-qhu5);
      zh2u5=-phu5/2.0-sqrt(phu5*phu5/4.0-qhu5);
      t2h1u5=(zh1u5-z)/vz;
      t2h2u5=(zh2u5-z)/vz;
      if(t2h1u5<1e-15)
      t2h1u5=t1+2.0;
      if(t2h2u5<1e-15)
      t2h2u5=t1+2.0;
      if(t2h2u5<t2h1u5)
      t2h1u5=t2h2u5;
    }
    yintersechu5=m*(vz*t2h1u5+z)+n;
    if (yintersechu5<0){
    t2h1u5=t1+2.0;}
  }
    phuwt5=(2.0*m*n*pahuwt5+1.0)/(pahuwt5*m*m);						
    qhuwt5=n*n/(m*m)-pbhuwt5/(pahuwt5*m*m);
    if(qhuwt5>0 && qhuwt5>(phuwt5*phuwt5/4)){
    t2h1uwt5=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt5=(pbhuwt5-pahuwt5*y*y-z)/vz;
      }else{
      t2h1uwt5=t1+2.0;
      }
    }else{
      zh1uwt5=-phuwt5/2.0+sqrt(phuwt5*phuwt5/4.0-qhuwt5);
      zh2uwt5=-phuwt5/2.0-sqrt(phuwt5*phuwt5/4.0-qhuwt5);
      t2h1uwt5=(zh1uwt5-z)/vz;
      t2h2uwt5=(zh2uwt5-z)/vz;
      if(t2h1uwt5<1e-15)
      t2h1uwt5=t1+2.0;
      if(t2h2uwt5<1e-15)
      t2h2uwt5=t1+2.0;
      if(t2h2uwt5<t2h1uwt5)
      t2h1uwt5=t2h2uwt5;
    }
    yintersechuwt5=m*(vz*t2h1uwt5+z)+n;
    if (yintersechuwt5<0){
    t2h1uwt5=t1+2.0;}
  }
  }

  if(louthd5==0 && linhd5==0)
  {
  m=(-h2d5+h1d5)/l;
  t2h1d5=(m*z+(-h1d5)-y)/(vy-m*vz);
  t2h1dwt5=(m*z+(-h1dwt5)-y)/(vy-m*vz);
  if(t2h1d5<1e-15)
  t2h1d5=t1+2.0;
  if(t2h1dwt5<1e-15)
  t2h1dwt5=t1+2.0;
  }

  if(louthd5!=0 && linhd5!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd5=2.0*(a2hd5*m*n+b2hd5*z0hd5)/(a2hd5*m*m+b2hd5);
    qhd5=(a2hd5*n*n+b2hd5*z0hd5*z0hd5-a2hd5*b2hd5)/(a2hd5*m*m+b2hd5);
    if((phd5*phd5/4.0)-qhd5<0){
    t2h1d5=t1+2.0;
    }else{
        zh1d5=-phd5/2.0+sqrt((phd5*phd5/4.0)-qhd5);
        zh2d5=-phd5/2.0-sqrt((phd5*phd5/4.0)-qhd5);
        t2h1d5=(zh1d5-z)/vz;
        t2h2d5=(zh2d5-z)/vz;
        if(t2h1d5<1e-15)
        t2h1d5=t1+2.0;
        if(t2h2d5<1e-15)
        t2h2d5=t1+2.0;
        if(t2h2d5<t2h1d5)
        t2h1d5=t2h2d5;
        yintersechd5=m*(vz*t2h1d5+z)+n;
        if (yintersechd5>0){
        t2h1d5=t1+2.0;}
        }
    phdwt5=2.0*(a2hdwt5*m*n+b2hdwt5*z0hd5)/(a2hdwt5*m*m+b2hdwt5);
    qhdwt5=(a2hdwt5*n*n+b2hdwt5*z0hd5*z0hd5-a2hdwt5*b2hdwt5)/(a2hdwt5*m*m+b2hdwt5);
    if((phdwt5*phdwt5/4.0)-qhdwt5<0){
    t2h1dwt5=t1+2.0;
    }else{
        zh1dwt5=-phdwt5/2.0+sqrt((phdwt5*phdwt5/4.0)-qhdwt5);
        zh2dwt5=-phdwt5/2.0-sqrt((phdwt5*phdwt5/4.0)-qhdwt5);
        t2h1dwt5=(zh1dwt5-z)/vz;
        t2h2dwt5=(zh2dwt5-z)/vz;
        if(t2h1dwt5<1e-15)
        t2h1dwt5=t1+2.0;
        if(t2h2dwt5<1e-15)
        t2h2dwt5=t1+2.0;
        if(t2h2dwt5<t2h1dwt5)
        t2h1dwt5=t2h2dwt5;
        yintersechdwt5=m*(vz*t2h1dwt5+z)+n;
        if (yintersechdwt5>0){
        t2h1dwt5=t1+2.0;}
        }
  }

  if((louthd5!=0 && linhd5==0)|| (louthd5==0 && linhd5!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd5=(2.0*m*n*pahd5+1.0)/(pahd5*m*m);
    qhd5=n*n/(m*m)-pbhd5/(pahd5*m*m);
    if(qhd5>0 && qhd5>(phd5*phd5/4)){
    t2h1d5=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d5=(pbhd5-pahd5*y*y-z)/vz;
      }else{
      t2h1d5=t1+2.0;
      }
    }else{
      zh1d5=-phd5/2.0+sqrt(phd5*phd5/4.0-qhd5);
      zh2d5=-phd5/2.0-sqrt(phd5*phd5/4.0-qhd5);
      t2h1d5=(zh1d5-z)/vz;
      t2h2d5=(zh2d5-z)/vz;
      if(t2h1d5<1e-15)
      t2h1d5=t1+2.0;
      if(t2h2d5<1e-15)
      t2h2d5=t1+2.0;
      if(t2h2d5<t2h1d5)
      t2h1d5=t2h2d5;
    }
    yintersechd5=m*(vz*t2h1d5+z)+n;
    if (yintersechd5>0){
    t2h1d5=t1+2.0;}
  }
    phdwt5=(2.0*m*n*pahdwt5+1.0)/(pahdwt5*m*m);
    qhdwt5=n*n/(m*m)-pbhdwt5/(pahdwt5*m*m);
    if(qhdwt5>0 && qhdwt5>(phdwt5*phdwt5/4)){
    t2h1dwt5=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt5=(pbhdwt5-pahdwt5*y*y-z)/vz;
      }else{
      t2h1dwt5=t1+2.0;
      }
    }else{
      zh1dwt5=-phdwt5/2.0+sqrt(phdwt5*phdwt5/4.0-qhdwt5);
      zh2dwt5=-phdwt5/2.0-sqrt(phdwt5*phdwt5/4.0-qhdwt5);
      t2h1dwt5=(zh1dwt5-z)/vz;
      t2h2dwt5=(zh2dwt5-z)/vz;
      if(t2h1dwt5<1e-15)
      t2h1dwt5=t1+2.0;
      if(t2h2dwt5<1e-15)
      t2h2dwt5=t1+2.0;
      if(t2h2dwt5<t2h1dwt5)
      t2h1dwt5=t2h2dwt5;
    }
    yintersechdwt5=m*(vz*t2h1dwt5+z)+n;
    if (yintersechdwt5>0){
    t2h1dwt5=t1+2.0;}
  }
  }

 if(loutwr6==0 && linwr6==0)
  {
  m=(-w2r6+w1r6)/l;
  t2w1r6=(m*z+(-w1r6)-x)/(vx-m*vz);
  t2w1rwt6=(m*z+(-w1rwt6)-x)/(vx-m*vz);
  if(t2w1r6<1e-15)
    t2w1r6=t1+2.0;
  if(t2w1rwt6<1e-15)
    t2w1rwt6=t1+2.0; 
  }


  if(loutwr6!=0 && linwr6!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr6=2.0*(a2wr6*m*n+b2wr6*z0wr6)/(a2wr6*m*m+b2wr6);
    qwr6=(a2wr6*n*n+b2wr6*z0wr6*z0wr6-a2wr6*b2wr6)/(a2wr6*m*m+b2wr6);
    if ((pwr6*pwr6/4.0)-qwr6<0){
    t2w1r6=t1+2.0;
    }else{
        zw1r6=-pwr6/2.0+sqrt((pwr6*pwr6/4.0)-qwr6);
        zw2r6=-pwr6/2.0-sqrt((pwr6*pwr6/4.0)-qwr6);
        t2w1r6=(zw1r6-z)/vz;
        t2w2r6=(zw2r6-z)/vz;
        if(t2w1r6<1e-15)
        t2w1r6=t1+2.0;
        if(t2w2r6<1e-15)
        t2w2r6=t1+2.0;
        if(t2w2r6<t2w1r6)
        t2w1r6=t2w2r6;
        xintersecwr6=m*(vz*t2w1r6+z)+n;
        if (xintersecwr6>0){
        t2w1r6=t1+2.0;}
        }
    pwrwt6=2.0*(a2wrwt6*m*n+b2wrwt6*z0wr6)/(a2wrwt6*m*m+b2wrwt6);
    qwrwt6=(a2wrwt6*n*n+b2wrwt6*z0wr6*z0wr6-a2wrwt6*b2wrwt6)/(a2wrwt6*m*m+b2wrwt6);
    if ((pwrwt6*pwrwt6/4.0)-qwrwt6<0){
    t2w1rwt6=t1+2.0;
    }else{
        zw1rwt6=-pwrwt6/2.0+sqrt((pwrwt6*pwrwt6/4.0)-qwrwt6);
        zw2rwt6=-pwrwt6/2.0-sqrt((pwrwt6*pwrwt6/4.0)-qwrwt6);
        t2w1rwt6=(zw1rwt6-z)/vz;
        t2w2rwt6=(zw2rwt6-z)/vz;
        if(t2w1rwt6<1e-15)
        t2w1rwt6=t1+2.0;
        if(t2w2rwt6<1e-15)
        t2w2rwt6=t1+2.0;
        if(t2w2rwt6<t2w1rwt6)
        t2w1rwt6=t2w2rwt6;
        xintersecwrwt6=m*(vz*t2w1rwt6+z)+n;
        if (xintersecwrwt6>0){
        t2w1rwt6=t1+2.0;}
        }
    }

  if((loutwr6!=0 && linwr6==0)|| (loutwr6==0 && linwr6!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr6=(2.0*m*n*pawr6+1.0)/(pawr6*m*m);
    qwr6=n*n/(m*m)-pbwr6/(pawr6*m*m);
    if(qwr6>0 && qwr6>(pwr6*pwr6/4)){
    t2w1r6=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r6=(pbwr6-pawr6*x*x-z)/vz;
      }else{
      t2w1r6=t1+2.0;
      }
    }else{
      zw1r6=-pwr6/2.0+sqrt(pwr6*pwr6/4.0-qwr6);
      zw2r6=-pwr6/2.0-sqrt(pwr6*pwr6/4.0-qwr6);
      t2w1r6=(zw1r6-z)/vz;
      t2w2r6=(zw2r6-z)/vz;
      if(t2w1r6<1e-15)
      t2w1r6=t1+2.0;
      if(t2w2r6<1e-15)
      t2w2r6=t1+2.0;
      if(t2w2r6<t2w1r6)
      t2w1r6=t2w2r6;
    }
    xintersecwr6=m*(vz*t2w1r6+z)+n;
    if (xintersecwr6>0){
    t2w1r6=t1+2.0;}
    }
    pwrwt6=(2.0*m*n*pawrwt6+1.0)/(pawrwt6*m*m);
    qwrwt6=n*n/(m*m)-pbwrwt6/(pawrwt6*m*m);
    if(qwrwt6>0 && qwrwt6>(pwrwt6*pwrwt6/4)){
    t2w1rwt6=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt6=(pbwrwt6-pawrwt6*x*x-z)/vz;
      }else{
      t2w1rwt6=t1+2.0; 
      }
    }else{
      zw1rwt6=-pwrwt6/2.0+sqrt(pwrwt6*pwrwt6/4.0-qwrwt6);
      zw2rwt6=-pwrwt6/2.0-sqrt(pwrwt6*pwrwt6/4.0-qwrwt6);
      t2w1rwt6=(zw1rwt6-z)/vz;
      t2w2rwt6=(zw2rwt6-z)/vz;
      if(t2w1rwt6<1e-15)
      t2w1rwt6=t1+2.0;
      if(t2w2rwt6<1e-15)
      t2w2rwt6=t1+2.0;
      if(t2w2rwt6<t2w1rwt6)
      t2w1rwt6=t2w2rwt6;
    }
    xintersecwrwt6=m*(vz*t2w1rwt6+z)+n;
    if (xintersecwrwt6>0){
    t2w1rwt6=t1+2.0;}
  }
  }

  if(loutwl6==0 && linwl6==0)
  {
  m=(w2l6-w1l6)/l;
  t2w1l6=(m*z+(w1l6)-x)/(vx-m*vz);
  t2w1lwt6=(m*z+(w1lwt6)-x)/(vx-m*vz);
  if(t2w1l6<1e-15)
  t2w1l6=t1+2.0;
  if(t2w1lwt6<1e-15)
  t2w1lwt6=t1+2.0;
  };

  if(loutwl6!=0 && linwl6!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl6=2.0*(a2wl6*m*n+b2wl6*z0wl6)/(a2wl6*m*m+b2wl6);
    qwl6=(a2wl6*n*n+b2wl6*z0wl6*z0wl6-a2wl6*b2wl6)/(a2wl6*m*m+b2wl6);
    if((pwl6*pwl6/4.0)-qwl6<0){
    t2w1l6=t1+2.0;
    }else{
        zw1l6=-pwl6/2.0+sqrt((pwl6*pwl6/4.0)-qwl6);
        zw2l6=-pwl6/2.0-sqrt((pwl6*pwl6/4.0)-qwl6);
        t2w1l6=(zw1l6-z)/vz;
        t2w2l6=(zw2l6-z)/vz;
        if(t2w1l6<1e-15)
        t2w1l6=t1+2.0;
        if(t2w2l6<1e-15)
        t2w2l6=t1+2.0;
        if(t2w2l6<t2w1l6)
        t2w1l6=t2w2l6;
        xintersecwl6=m*(vz*t2w1l6+z)+n;
        if (xintersecwl6<0){
        t2w1l6=t1+2.0;}
        }
    pwlwt6=2.0*(a2wlwt6*m*n+b2wlwt6*z0wl6)/(a2wlwt6*m*m+b2wlwt6);
    qwlwt6=(a2wlwt6*n*n+b2wlwt6*z0wl6*z0wl6-a2wlwt6*b2wlwt6)/(a2wlwt6*m*m+b2wlwt6);
    if((pwlwt6*pwlwt6/4.0)-qwlwt6<0){
    t2w1lwt6=t1+2.0;
    }else{
        zw1lwt6=-pwlwt6/2.0+sqrt((pwlwt6*pwlwt6/4.0)-qwlwt6);
        zw2lwt6=-pwlwt6/2.0-sqrt((pwlwt6*pwlwt6/4.0)-qwlwt6);
        t2w1lwt6=(zw1lwt6-z)/vz;
        t2w2lwt6=(zw2lwt6-z)/vz;
        if(t2w1lwt6<1e-15)
        t2w1lwt6=t1+2.0;
        if(t2w2lwt6<1e-15)
        t2w2lwt6=t1+2.0;
        if(t2w2lwt6<t2w1lwt6)
        t2w1lwt6=t2w2lwt6;
        xintersecwlwt6=m*(vz*t2w1lwt6+z)+n;
        if (xintersecwlwt6<0){
        t2w1lwt6=t1+2.0;}
        }
  }

  if((loutwl6!=0 && linwl6==0) || (loutwl6==0 && linwl6!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl6=(2.0*m*n*pawl6+1.0)/(pawl6*m*m);
    qwl6=n*n/(m*m)-pbwl6/(pawl6*m*m);
    if(qwl6>0 && qwl6>(pwl6*pwl6/4)){
    t2w1l6=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l6=(pbwl6-pawl6*x*x-z)/vz;
      }else{
      t2w1l6=t1+2.0;
      }
    }else{
      zw1l6=-pwl6/2.0+sqrt(pwl6*pwl6/4.0-qwl6);
      zw2l6=-pwl6/2.0-sqrt(pwl6*pwl6/4.0-qwl6);
      t2w1l6=(zw1l6-z)/vz;
      t2w2l6=(zw2l6-z)/vz;
      if(t2w1l6<1e-15)
      t2w1l6=t1+2.0;
      if(t2w2l6<1e-15)
      t2w2l6=t1+2.0;
      if(t2w2l6<t2w1l6)
      t2w1l6=t2w2l6;
    }
    }
    xintersecwl6=m*(vz*t2w1l6+z)+n;
    if (xintersecwl6<0){
    t2w1l6=t1+2.0;}
    pwlwt6=(2.0*m*n*pawlwt6+1.0)/(pawlwt6*m*m);
    qwlwt6=n*n/(m*m)-pbwlwt6/(pawlwt6*m*m);
    if(qwlwt6>0 && qwlwt6>(pwlwt6*pwlwt6/4)){
    t2w1lwt6=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt6=(pbwlwt6-pawlwt6*x*x-z)/vz;
      }else{
      t2w1lwt6=t1+2.0;
      }
    }else{
      zw1lwt6=-pwlwt6/2.0+sqrt(pwlwt6*pwlwt6/4.0-qwlwt6);
      zw2lwt6=-pwlwt6/2.0-sqrt(pwlwt6*pwlwt6/4.0-qwlwt6);
      t2w1lwt6=(zw1lwt6-z)/vz;
      t2w2lwt6=(zw2lwt6-z)/vz;
      if(t2w1lwt6<1e-15)
      t2w1lwt6=t1+2.0;
      if(t2w2lwt6<1e-15)
      t2w2lwt6=t1+2.0;
      if(t2w2lwt6<t2w1lwt6)
      t2w1lwt6=t2w2lwt6;
    }
    xintersecwlwt6=m*(vz*t2w1lwt6+z)+n;
    if (xintersecwlwt6<0){
    t2w1lwt6=t1+2.0;}
  }
  }

  if(louthu6==0 && linhu6==0)
  {
  m=(h2u6-h1u6)/l;
  t2h1u6=(m*z+(h1u6)-y)/(vy-m*vz);
  t2h1uwt6=(m*z+(h1uwt6)-y)/(vy-m*vz);
  if(t2h1u6<1e-15)
  t2h1u6=t1+2.0;
  if(t2h1uwt6<1e-15)
  t2h1uwt6=t1+2.0;
  }


  if(louthu6!=0 && linhu6!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu6=2.0*(a2hu6*m*n+b2hu6*z0hu6)/(a2hu6*m*m+b2hu6);
    qhu6=(a2hu6*n*n+b2hu6*z0hu6*z0hu6-a2hu6*b2hu6)/(a2hu6*m*m+b2hu6);
    if((phu6*phu6/4.0)-qhu6<0){
    t2h1u6=t1+2.0;
    }else{
        zh1u6=-phu6/2.0+sqrt((phu6*phu6/4.0)-qhu6);
        zh2u6=-phu6/2.0-sqrt((phu6*phu6/4.0)-qhu6);
        t2h1u6=(zh1u6-z)/vz;
        t2h2u6=(zh2u6-z)/vz;
        if(t2h1u6<1e-15)
        t2h1u6=t1+2.0;
        if(t2h2u6<1e-15)
        t2h2u6=t1+2.0;
        if(t2h2u6<t2h1u6)
        t2h1u6=t2h2u6;
        yintersechu6=m*(vz*t2h1u6+z)+n;
        if (yintersechu6<0){
        t2h1u6=t1+2.0;}
        }
    phuwt6=2.0*(a2huwt6*m*n+b2huwt6*z0hu6)/(a2huwt6*m*m+b2huwt6);
    qhuwt6=(a2huwt6*n*n+b2huwt6*z0hu6*z0hu6-a2huwt6*b2huwt6)/(a2huwt6*m*m+b2huwt6);
    if((phuwt6*phuwt6/4.0)-qhuwt6<0){
    t2h1uwt6=t1+2.0;
    }else{
        zh1uwt6=-phuwt6/2.0+sqrt((phuwt6*phuwt6/4.0)-qhuwt6);
        zh2uwt6=-phuwt6/2.0-sqrt((phuwt6*phuwt6/4.0)-qhuwt6);
        t2h1uwt6=(zh1uwt6-z)/vz;
        t2h2uwt6=(zh2uwt6-z)/vz;
        if(t2h1uwt6<1e-15)
        t2h1uwt6=t1+2.0;
        if(t2h2uwt6<1e-15)
        t2h2uwt6=t1+2.0;
        if(t2h2uwt6<t2h1uwt6)
        t2h1uwt6=t2h2uwt6;
        yintersechuwt6=m*(vz*t2h1uwt6+z)+n;
        if (yintersechuwt6<0){
        t2h1uwt6=t1+2.0;}
        }
  }


  if((louthu6!=0 && linhu6==0)|| (louthu6==0 && linhu6!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu6=(2.0*m*n*pahu6+1.0)/(pahu6*m*m);	
    qhu6=n*n/(m*m)-pbhu6/(pahu6*m*m);
    if(qhu6>0 && qhu6>(phu6*phu6/4)){
    t2h1u6=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u6=(pbhu6-pahu6*y*y-z)/vz;
      }else{
      t2h1u6=t1+2.0;
      }
    }else{
      zh1u6=-phu6/2.0+sqrt(phu6*phu6/4.0-qhu6);
      zh2u6=-phu6/2.0-sqrt(phu6*phu6/4.0-qhu6);
      t2h1u6=(zh1u6-z)/vz;
      t2h2u6=(zh2u6-z)/vz;
      if(t2h1u6<1e-15)
      t2h1u6=t1+2.0;
      if(t2h2u6<1e-15)
      t2h2u6=t1+2.0;
      if(t2h2u6<t2h1u6)
      t2h1u6=t2h2u6;
    }
    yintersechu6=m*(vz*t2h1u6+z)+n;
    if (yintersechu6<0){
    t2h1u6=t1+2.0;}
  }
    phuwt6=(2.0*m*n*pahuwt6+1.0)/(pahuwt6*m*m);						
    qhuwt6=n*n/(m*m)-pbhuwt6/(pahuwt6*m*m);
    if(qhuwt6>0 && qhuwt6>(phuwt6*phuwt6/4)){
    t2h1uwt6=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt6=(pbhuwt6-pahuwt6*y*y-z)/vz;
      }else{
      t2h1uwt6=t1+2.0;
      }
    }else{
      zh1uwt6=-phuwt6/2.0+sqrt(phuwt6*phuwt6/4.0-qhuwt6);
      zh2uwt6=-phuwt6/2.0-sqrt(phuwt6*phuwt6/4.0-qhuwt6);
      t2h1uwt6=(zh1uwt6-z)/vz;
      t2h2uwt6=(zh2uwt6-z)/vz;
      if(t2h1uwt6<1e-15)
      t2h1uwt6=t1+2.0;
      if(t2h2uwt6<1e-15)
      t2h2uwt6=t1+2.0;
      if(t2h2uwt6<t2h1uwt6)
      t2h1uwt6=t2h2uwt6;
    }
    yintersechuwt6=m*(vz*t2h1uwt6+z)+n;
    if (yintersechuwt6<0){
    t2h1uwt6=t1+2.0;}
  }
  }

  if(louthd6==0 && linhd6==0)
  {
  m=(-h2d6+h1d6)/l;
  t2h1d6=(m*z+(-h1d6)-y)/(vy-m*vz);
  t2h1dwt6=(m*z+(-h1dwt6)-y)/(vy-m*vz);
  if(t2h1d6<1e-15)
  t2h1d6=t1+2.0;
  if(t2h1dwt6<1e-15)
  t2h1dwt6=t1+2.0;
  }

  if(louthd6!=0 && linhd6!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd6=2.0*(a2hd6*m*n+b2hd6*z0hd6)/(a2hd6*m*m+b2hd6);
    qhd6=(a2hd6*n*n+b2hd6*z0hd6*z0hd6-a2hd6*b2hd6)/(a2hd6*m*m+b2hd6);
    if((phd6*phd6/4.0)-qhd6<0){
    t2h1d6=t1+2.0;
    }else{
        zh1d6=-phd6/2.0+sqrt((phd6*phd6/4.0)-qhd6);
        zh2d6=-phd6/2.0-sqrt((phd6*phd6/4.0)-qhd6);
        t2h1d6=(zh1d6-z)/vz;
        t2h2d6=(zh2d6-z)/vz;
        if(t2h1d6<1e-15)
        t2h1d6=t1+2.0;
        if(t2h2d6<1e-15)
        t2h2d6=t1+2.0;
        if(t2h2d6<t2h1d6)
        t2h1d6=t2h2d6;
        yintersechd6=m*(vz*t2h1d6+z)+n;
        if (yintersechd6>0){
        t2h1d6=t1+2.0;}
        }
    phdwt6=2.0*(a2hdwt6*m*n+b2hdwt6*z0hd6)/(a2hdwt6*m*m+b2hdwt6);
    qhdwt6=(a2hdwt6*n*n+b2hdwt6*z0hd6*z0hd6-a2hdwt6*b2hdwt6)/(a2hdwt6*m*m+b2hdwt6);
    if((phdwt6*phdwt6/4.0)-qhdwt6<0){
    t2h1dwt6=t1+2.0;
    }else{
        zh1dwt6=-phdwt6/2.0+sqrt((phdwt6*phdwt6/4.0)-qhdwt6);
        zh2dwt6=-phdwt6/2.0-sqrt((phdwt6*phdwt6/4.0)-qhdwt6);
        t2h1dwt6=(zh1dwt6-z)/vz;
        t2h2dwt6=(zh2dwt6-z)/vz;
        if(t2h1dwt6<1e-15)
        t2h1dwt6=t1+2.0;
        if(t2h2dwt6<1e-15)
        t2h2dwt6=t1+2.0;
        if(t2h2dwt6<t2h1dwt6)
        t2h1dwt6=t2h2dwt6;
        yintersechdwt6=m*(vz*t2h1dwt6+z)+n;
        if (yintersechdwt6>0){
        t2h1dwt6=t1+2.0;}
        }
  }

  if((louthd6!=0 && linhd6==0)|| (louthd6==0 && linhd6!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd6=(2.0*m*n*pahd6+1.0)/(pahd6*m*m);
    qhd6=n*n/(m*m)-pbhd6/(pahd6*m*m);
    if(qhd6>0 && qhd6>(phd6*phd6/4)){
    t2h1d6=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d6=(pbhd6-pahd6*y*y-z)/vz;
      }else{
      t2h1d6=t1+2.0;
      }
    }else{
      zh1d6=-phd6/2.0+sqrt(phd6*phd6/4.0-qhd6);
      zh2d6=-phd6/2.0-sqrt(phd6*phd6/4.0-qhd6);
      t2h1d6=(zh1d6-z)/vz;
      t2h2d6=(zh2d6-z)/vz;
      if(t2h1d6<1e-15)
      t2h1d6=t1+2.0;
      if(t2h2d6<1e-15)
      t2h2d6=t1+2.0;
      if(t2h2d6<t2h1d6)
      t2h1d6=t2h2d6;
    }
    yintersechd6=m*(vz*t2h1d6+z)+n;
    if (yintersechd6>0){
    t2h1d6=t1+2.0;}
  }
    phdwt6=(2.0*m*n*pahdwt6+1.0)/(pahdwt6*m*m);
    qhdwt6=n*n/(m*m)-pbhdwt6/(pahdwt6*m*m);
    if(qhdwt6>0 && qhdwt6>(phdwt6*phdwt6/4)){
    t2h1dwt6=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt6=(pbhdwt6-pahdwt6*y*y-z)/vz;
      }else{
      t2h1dwt6=t1+2.0;
      }
    }else{
      zh1dwt6=-phdwt6/2.0+sqrt(phdwt6*phdwt6/4.0-qhdwt6);
      zh2dwt6=-phdwt6/2.0-sqrt(phdwt6*phdwt6/4.0-qhdwt6);
      t2h1dwt6=(zh1dwt6-z)/vz;
      t2h2dwt6=(zh2dwt6-z)/vz;
      if(t2h1dwt6<1e-15)
      t2h1dwt6=t1+2.0;
      if(t2h2dwt6<1e-15)
      t2h2dwt6=t1+2.0;
      if(t2h2dwt6<t2h1dwt6)
      t2h1dwt6=t2h2dwt6;
    }
    yintersechdwt6=m*(vz*t2h1dwt6+z)+n;
    if (yintersechdwt6>0){
    t2h1dwt6=t1+2.0;}
  }
  }


  if(loutwr7==0 && linwr7==0)
  {
  m=(-w2r7+w1r7)/l;
  t2w1r7=(m*z+(-w1r7)-x)/(vx-m*vz);
  t2w1rwt7=(m*z+(-w1rwt7)-x)/(vx-m*vz);
  if(t2w1r7<1e-15)
    t2w1r7=t1+2.0;
  if(t2w1rwt7<1e-15)
    t2w1rwt7=t1+2.0; 
  }


  if(loutwr7!=0 && linwr7!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr7=2.0*(a2wr7*m*n+b2wr7*z0wr7)/(a2wr7*m*m+b2wr7);
    qwr7=(a2wr7*n*n+b2wr7*z0wr7*z0wr7-a2wr7*b2wr7)/(a2wr7*m*m+b2wr7);
    if ((pwr7*pwr7/4.0)-qwr7<0){
    t2w1r7=t1+2.0;
    }else{
        zw1r7=-pwr7/2.0+sqrt((pwr7*pwr7/4.0)-qwr7);
        zw2r7=-pwr7/2.0-sqrt((pwr7*pwr7/4.0)-qwr7);
        t2w1r7=(zw1r7-z)/vz;
        t2w2r7=(zw2r7-z)/vz;
        if(t2w1r7<1e-15)
        t2w1r7=t1+2.0;
        if(t2w2r7<1e-15)
        t2w2r7=t1+2.0;
        if(t2w2r7<t2w1r7)
        t2w1r7=t2w2r7;
        xintersecwr7=m*(vz*t2w1r7+z)+n;
        if (xintersecwr7>0){
        t2w1r7=t1+2.0;}
        }
    pwrwt7=2.0*(a2wrwt7*m*n+b2wrwt7*z0wr7)/(a2wrwt7*m*m+b2wrwt7);
    qwrwt7=(a2wrwt7*n*n+b2wrwt7*z0wr7*z0wr7-a2wrwt7*b2wrwt7)/(a2wrwt7*m*m+b2wrwt7);
    if ((pwrwt7*pwrwt7/4.0)-qwrwt7<0){
    t2w1rwt7=t1+2.0;
    }else{
        zw1rwt7=-pwrwt7/2.0+sqrt((pwrwt7*pwrwt7/4.0)-qwrwt7);
        zw2rwt7=-pwrwt7/2.0-sqrt((pwrwt7*pwrwt7/4.0)-qwrwt7);
        t2w1rwt7=(zw1rwt7-z)/vz;
        t2w2rwt7=(zw2rwt7-z)/vz;
        if(t2w1rwt7<1e-15)
        t2w1rwt7=t1+2.0;
        if(t2w2rwt7<1e-15)
        t2w2rwt7=t1+2.0;
        if(t2w2rwt7<t2w1rwt7)
        t2w1rwt7=t2w2rwt7;
        xintersecwrwt7=m*(vz*t2w1rwt7+z)+n;
        if (xintersecwrwt7>0){
        t2w1rwt7=t1+2.0;}
        }
    }

  if((loutwr7!=0 && linwr7==0)|| (loutwr7==0 && linwr7!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr7=(2.0*m*n*pawr7+1.0)/(pawr7*m*m);
    qwr7=n*n/(m*m)-pbwr7/(pawr7*m*m);
    if(qwr7>0 && qwr7>(pwr7*pwr7/4)){
    t2w1r7=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r7=(pbwr7-pawr7*x*x-z)/vz;
      }else{
      t2w1r7=t1+2.0;
      }
    }else{
      zw1r7=-pwr7/2.0+sqrt(pwr7*pwr7/4.0-qwr7);
      zw2r7=-pwr7/2.0-sqrt(pwr7*pwr7/4.0-qwr7);
      t2w1r7=(zw1r7-z)/vz;
      t2w2r7=(zw2r7-z)/vz;
      if(t2w1r7<1e-15)
      t2w1r7=t1+2.0;
      if(t2w2r7<1e-15)
      t2w2r7=t1+2.0;
      if(t2w2r7<t2w1r7)
      t2w1r7=t2w2r7;
    }
    xintersecwr7=m*(vz*t2w1r7+z)+n;
    if (xintersecwr7>0){
    t2w1r7=t1+2.0;}
    }
    pwrwt7=(2.0*m*n*pawrwt7+1.0)/(pawrwt7*m*m);
    qwrwt7=n*n/(m*m)-pbwrwt7/(pawrwt7*m*m);
    if(qwrwt7>0 && qwrwt7>(pwrwt7*pwrwt7/4)){
    t2w1rwt7=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt7=(pbwrwt7-pawrwt7*x*x-z)/vz;
      }else{
      t2w1rwt7=t1+2.0; 
      }
    }else{
      zw1rwt7=-pwrwt7/2.0+sqrt(pwrwt7*pwrwt7/4.0-qwrwt7);
      zw2rwt7=-pwrwt7/2.0-sqrt(pwrwt7*pwrwt7/4.0-qwrwt7);
      t2w1rwt7=(zw1rwt7-z)/vz;
      t2w2rwt7=(zw2rwt7-z)/vz;
      if(t2w1rwt7<1e-15)
      t2w1rwt7=t1+2.0;
      if(t2w2rwt7<1e-15)
      t2w2rwt7=t1+2.0;
      if(t2w2rwt7<t2w1rwt7)
      t2w1rwt7=t2w2rwt7;
    }
    xintersecwrwt7=m*(vz*t2w1rwt7+z)+n;
    if (xintersecwrwt7>0){
    t2w1rwt7=t1+2.0;}
  }
  }

  if(loutwl7==0 && linwl7==0)
  {
  m=(w2l7-w1l7)/l;
  t2w1l7=(m*z+(w1l7)-x)/(vx-m*vz);
  t2w1lwt7=(m*z+(w1lwt7)-x)/(vx-m*vz);
  if(t2w1l7<1e-15)
  t2w1l7=t1+2.0;
  if(t2w1lwt7<1e-15)
  t2w1lwt7=t1+2.0;
  };

  if(loutwl7!=0 && linwl7!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl7=2.0*(a2wl7*m*n+b2wl7*z0wl7)/(a2wl7*m*m+b2wl7);
    qwl7=(a2wl7*n*n+b2wl7*z0wl7*z0wl7-a2wl7*b2wl7)/(a2wl7*m*m+b2wl7);
    if((pwl7*pwl7/4.0)-qwl7<0){
    t2w1l7=t1+2.0;
    }else{
        zw1l7=-pwl7/2.0+sqrt((pwl7*pwl7/4.0)-qwl7);
        zw2l7=-pwl7/2.0-sqrt((pwl7*pwl7/4.0)-qwl7);
        t2w1l7=(zw1l7-z)/vz;
        t2w2l7=(zw2l7-z)/vz;
        if(t2w1l7<1e-15)
        t2w1l7=t1+2.0;
        if(t2w2l7<1e-15)
        t2w2l7=t1+2.0;
        if(t2w2l7<t2w1l7)
        t2w1l7=t2w2l7;
        xintersecwl7=m*(vz*t2w1l7+z)+n;
        if (xintersecwl7<0){
        t2w1l7=t1+2.0;}
        }
    pwlwt7=2.0*(a2wlwt7*m*n+b2wlwt7*z0wl7)/(a2wlwt7*m*m+b2wlwt7);
    qwlwt7=(a2wlwt7*n*n+b2wlwt7*z0wl7*z0wl7-a2wlwt7*b2wlwt7)/(a2wlwt7*m*m+b2wlwt7);
    if((pwlwt7*pwlwt7/4.0)-qwlwt7<0){
    t2w1lwt7=t1+2.0;
    }else{
        zw1lwt7=-pwlwt7/2.0+sqrt((pwlwt7*pwlwt7/4.0)-qwlwt7);
        zw2lwt7=-pwlwt7/2.0-sqrt((pwlwt7*pwlwt7/4.0)-qwlwt7);
        t2w1lwt7=(zw1lwt7-z)/vz;
        t2w2lwt7=(zw2lwt7-z)/vz;
        if(t2w1lwt7<1e-15)
        t2w1lwt7=t1+2.0;
        if(t2w2lwt7<1e-15)
        t2w2lwt7=t1+2.0;
        if(t2w2lwt7<t2w1lwt7)
        t2w1lwt7=t2w2lwt7;
        xintersecwlwt7=m*(vz*t2w1lwt7+z)+n;
        if (xintersecwlwt7<0){
        t2w1lwt7=t1+2.0;}
        }
  }

  if((loutwl7!=0 && linwl7==0) || (loutwl7==0 && linwl7!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl7=(2.0*m*n*pawl7+1.0)/(pawl7*m*m);
    qwl7=n*n/(m*m)-pbwl7/(pawl7*m*m);
    if(qwl7>0 && qwl7>(pwl7*pwl7/4)){
    t2w1l7=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l7=(pbwl7-pawl7*x*x-z)/vz;
      }else{
      t2w1l7=t1+2.0;
      }
    }else{
      zw1l7=-pwl7/2.0+sqrt(pwl7*pwl7/4.0-qwl7);
      zw2l7=-pwl7/2.0-sqrt(pwl7*pwl7/4.0-qwl7);
      t2w1l7=(zw1l7-z)/vz;
      t2w2l7=(zw2l7-z)/vz;
      if(t2w1l7<1e-15)
      t2w1l7=t1+2.0;
      if(t2w2l7<1e-15)
      t2w2l7=t1+2.0;
      if(t2w2l7<t2w1l7)
      t2w1l7=t2w2l7;
    }
    }
    xintersecwl7=m*(vz*t2w1l7+z)+n;
    if (xintersecwl7<0){
    t2w1l7=t1+2.0;}
    pwlwt7=(2.0*m*n*pawlwt7+1.0)/(pawlwt7*m*m);
    qwlwt7=n*n/(m*m)-pbwlwt7/(pawlwt7*m*m);
    if(qwlwt7>0 && qwlwt7>(pwlwt7*pwlwt7/4)){
    t2w1lwt7=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt7=(pbwlwt7-pawlwt7*x*x-z)/vz;
      }else{
      t2w1lwt7=t1+2.0;
      }
    }else{
      zw1lwt7=-pwlwt7/2.0+sqrt(pwlwt7*pwlwt7/4.0-qwlwt7);
      zw2lwt7=-pwlwt7/2.0-sqrt(pwlwt7*pwlwt7/4.0-qwlwt7);
      t2w1lwt7=(zw1lwt7-z)/vz;
      t2w2lwt7=(zw2lwt7-z)/vz;
      if(t2w1lwt7<1e-15)
      t2w1lwt7=t1+2.0;
      if(t2w2lwt7<1e-15)
      t2w2lwt7=t1+2.0;
      if(t2w2lwt7<t2w1lwt7)
      t2w1lwt7=t2w2lwt7;
    }
    xintersecwlwt7=m*(vz*t2w1lwt7+z)+n;
    if (xintersecwlwt7<0){
    t2w1lwt7=t1+2.0;}
  }
  }

  if(louthu7==0 && linhu7==0)
  {
  m=(h2u7-h1u7)/l;
  t2h1u7=(m*z+(h1u7)-y)/(vy-m*vz);
  t2h1uwt7=(m*z+(h1uwt7)-y)/(vy-m*vz);
  if(t2h1u7<1e-15)
  t2h1u7=t1+2.0;
  if(t2h1uwt7<1e-15)
  t2h1uwt7=t1+2.0;
  }


  if(louthu7!=0 && linhu7!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu7=2.0*(a2hu7*m*n+b2hu7*z0hu7)/(a2hu7*m*m+b2hu7);
    qhu7=(a2hu7*n*n+b2hu7*z0hu7*z0hu7-a2hu7*b2hu7)/(a2hu7*m*m+b2hu7);
    if((phu7*phu7/4.0)-qhu7<0){
    t2h1u7=t1+2.0;
    }else{
        zh1u7=-phu7/2.0+sqrt((phu7*phu7/4.0)-qhu7);
        zh2u7=-phu7/2.0-sqrt((phu7*phu7/4.0)-qhu7);
        t2h1u7=(zh1u7-z)/vz;
        t2h2u7=(zh2u7-z)/vz;
        if(t2h1u7<1e-15)
        t2h1u7=t1+2.0;
        if(t2h2u7<1e-15)
        t2h2u7=t1+2.0;
        if(t2h2u7<t2h1u7)
        t2h1u7=t2h2u7;
        yintersechu7=m*(vz*t2h1u7+z)+n;
        if (yintersechu7<0){
        t2h1u7=t1+2.0;}
        }
    phuwt7=2.0*(a2huwt7*m*n+b2huwt7*z0hu7)/(a2huwt7*m*m+b2huwt7);
    qhuwt7=(a2huwt7*n*n+b2huwt7*z0hu7*z0hu7-a2huwt7*b2huwt7)/(a2huwt7*m*m+b2huwt7);
    if((phuwt7*phuwt7/4.0)-qhuwt7<0){
    t2h1uwt7=t1+2.0;
    }else{
        zh1uwt7=-phuwt7/2.0+sqrt((phuwt7*phuwt7/4.0)-qhuwt7);
        zh2uwt7=-phuwt7/2.0-sqrt((phuwt7*phuwt7/4.0)-qhuwt7);
        t2h1uwt7=(zh1uwt7-z)/vz;
        t2h2uwt7=(zh2uwt7-z)/vz;
        if(t2h1uwt7<1e-15)
        t2h1uwt7=t1+2.0;
        if(t2h2uwt7<1e-15)
        t2h2uwt7=t1+2.0;
        if(t2h2uwt7<t2h1uwt7)
        t2h1uwt7=t2h2uwt7;
        yintersechuwt7=m*(vz*t2h1uwt7+z)+n;
        if (yintersechuwt7<0){
        t2h1uwt7=t1+2.0;}
        }
  }


  if((louthu7!=0 && linhu7==0)|| (louthu7==0 && linhu7!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu7=(2.0*m*n*pahu7+1.0)/(pahu7*m*m);	
    qhu7=n*n/(m*m)-pbhu7/(pahu7*m*m);
    if(qhu7>0 && qhu7>(phu7*phu7/4)){
    t2h1u7=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u7=(pbhu7-pahu7*y*y-z)/vz;
      }else{
      t2h1u7=t1+2.0;
      }
    }else{
      zh1u7=-phu7/2.0+sqrt(phu7*phu7/4.0-qhu7);
      zh2u7=-phu7/2.0-sqrt(phu7*phu7/4.0-qhu7);
      t2h1u7=(zh1u7-z)/vz;
      t2h2u7=(zh2u7-z)/vz;
      if(t2h1u7<1e-15)
      t2h1u7=t1+2.0;
      if(t2h2u7<1e-15)
      t2h2u7=t1+2.0;
      if(t2h2u7<t2h1u7)
      t2h1u7=t2h2u7;
    }
    yintersechu7=m*(vz*t2h1u7+z)+n;
    if (yintersechu7<0){
    t2h1u7=t1+2.0;}
  }
    phuwt7=(2.0*m*n*pahuwt7+1.0)/(pahuwt7*m*m);						
    qhuwt7=n*n/(m*m)-pbhuwt7/(pahuwt7*m*m);
    if(qhuwt7>0 && qhuwt7>(phuwt7*phuwt7/4)){
    t2h1uwt7=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt7=(pbhuwt7-pahuwt7*y*y-z)/vz;
      }else{
      t2h1uwt7=t1+2.0;
      }
    }else{
      zh1uwt7=-phuwt7/2.0+sqrt(phuwt7*phuwt7/4.0-qhuwt7);
      zh2uwt7=-phuwt7/2.0-sqrt(phuwt7*phuwt7/4.0-qhuwt7);
      t2h1uwt7=(zh1uwt7-z)/vz;
      t2h2uwt7=(zh2uwt7-z)/vz;
      if(t2h1uwt7<1e-15)
      t2h1uwt7=t1+2.0;
      if(t2h2uwt7<1e-15)
      t2h2uwt7=t1+2.0;
      if(t2h2uwt7<t2h1uwt7)
      t2h1uwt7=t2h2uwt7;
    }
    yintersechuwt7=m*(vz*t2h1uwt7+z)+n;
    if (yintersechuwt7<0){
    t2h1uwt7=t1+2.0;}
  }
  }

  if(louthd7==0 && linhd7==0)
  {
  m=(-h2d7+h1d7)/l;
  t2h1d7=(m*z+(-h1d7)-y)/(vy-m*vz);
  t2h1dwt7=(m*z+(-h1dwt7)-y)/(vy-m*vz);
  if(t2h1d7<1e-15)
  t2h1d7=t1+2.0;
  if(t2h1dwt7<1e-15)
  t2h1dwt7=t1+2.0;
  }

  if(louthd7!=0 && linhd7!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd7=2.0*(a2hd7*m*n+b2hd7*z0hd7)/(a2hd7*m*m+b2hd7);
    qhd7=(a2hd7*n*n+b2hd7*z0hd7*z0hd7-a2hd7*b2hd7)/(a2hd7*m*m+b2hd7);
    if((phd7*phd7/4.0)-qhd7<0){
    t2h1d7=t1+2.0;
    }else{
        zh1d7=-phd7/2.0+sqrt((phd7*phd7/4.0)-qhd7);
        zh2d7=-phd7/2.0-sqrt((phd7*phd7/4.0)-qhd7);
        t2h1d7=(zh1d7-z)/vz;
        t2h2d7=(zh2d7-z)/vz;
        if(t2h1d7<1e-15)
        t2h1d7=t1+2.0;
        if(t2h2d7<1e-15)
        t2h2d7=t1+2.0;
        if(t2h2d7<t2h1d7)
        t2h1d7=t2h2d7;
        yintersechd7=m*(vz*t2h1d7+z)+n;
        if (yintersechd7>0){
        t2h1d7=t1+2.0;}
        }
    phdwt7=2.0*(a2hdwt7*m*n+b2hdwt7*z0hd7)/(a2hdwt7*m*m+b2hdwt7);
    qhdwt7=(a2hdwt7*n*n+b2hdwt7*z0hd7*z0hd7-a2hdwt7*b2hdwt7)/(a2hdwt7*m*m+b2hdwt7);
    if((phdwt7*phdwt7/4.0)-qhdwt7<0){
    t2h1dwt7=t1+2.0;
    }else{
        zh1dwt7=-phdwt7/2.0+sqrt((phdwt7*phdwt7/4.0)-qhdwt7);
        zh2dwt7=-phdwt7/2.0-sqrt((phdwt7*phdwt7/4.0)-qhdwt7);
        t2h1dwt7=(zh1dwt7-z)/vz;
        t2h2dwt7=(zh2dwt7-z)/vz;
        if(t2h1dwt7<1e-15)
        t2h1dwt7=t1+2.0;
        if(t2h2dwt7<1e-15)
        t2h2dwt7=t1+2.0;
        if(t2h2dwt7<t2h1dwt7)
        t2h1dwt7=t2h2dwt7;
        yintersechdwt7=m*(vz*t2h1dwt7+z)+n;
        if (yintersechdwt7>0){
        t2h1dwt7=t1+2.0;}
        }
  }

  if((louthd7!=0 && linhd7==0)|| (louthd7==0 && linhd7!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd7=(2.0*m*n*pahd7+1.0)/(pahd7*m*m);
    qhd7=n*n/(m*m)-pbhd7/(pahd7*m*m);
    if(qhd7>0 && qhd7>(phd7*phd7/4)){
    t2h1d7=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d7=(pbhd7-pahd7*y*y-z)/vz;
      }else{
      t2h1d7=t1+2.0;
      }
    }else{
      zh1d7=-phd7/2.0+sqrt(phd7*phd7/4.0-qhd7);
      zh2d7=-phd7/2.0-sqrt(phd7*phd7/4.0-qhd7);
      t2h1d7=(zh1d7-z)/vz;
      t2h2d7=(zh2d7-z)/vz;
      if(t2h1d7<1e-15)
      t2h1d7=t1+2.0;
      if(t2h2d7<1e-15)
      t2h2d7=t1+2.0;
      if(t2h2d7<t2h1d7)
      t2h1d7=t2h2d7;
    }
    yintersechd7=m*(vz*t2h1d7+z)+n;
    if (yintersechd7>0){
    t2h1d7=t1+2.0;}
  }
    phdwt7=(2.0*m*n*pahdwt7+1.0)/(pahdwt7*m*m);
    qhdwt7=n*n/(m*m)-pbhdwt7/(pahdwt7*m*m);
    if(qhdwt7>0 && qhdwt7>(phdwt7*phdwt7/4)){
    t2h1dwt7=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt7=(pbhdwt7-pahdwt7*y*y-z)/vz;
      }else{
      t2h1dwt7=t1+2.0;
      }
    }else{
      zh1dwt7=-phdwt7/2.0+sqrt(phdwt7*phdwt7/4.0-qhdwt7);
      zh2dwt7=-phdwt7/2.0-sqrt(phdwt7*phdwt7/4.0-qhdwt7);
      t2h1dwt7=(zh1dwt7-z)/vz;
      t2h2dwt7=(zh2dwt7-z)/vz;
      if(t2h1dwt7<1e-15)
      t2h1dwt7=t1+2.0;
      if(t2h2dwt7<1e-15)
      t2h2dwt7=t1+2.0;
      if(t2h2dwt7<t2h1dwt7)
      t2h1dwt7=t2h2dwt7;
    }
    yintersechdwt7=m*(vz*t2h1dwt7+z)+n;
    if (yintersechdwt7>0){
    t2h1dwt7=t1+2.0;}
  }
  }


  if(loutwr8==0 && linwr8==0)
  {
  m=(-w2r8+w1r8)/l;
  t2w1r8=(m*z+(-w1r8)-x)/(vx-m*vz);
  t2w1rwt8=(m*z+(-w1rwt8)-x)/(vx-m*vz);
  if(t2w1r8<1e-15)
    t2w1r8=t1+2.0;
  if(t2w1rwt8<1e-15)
    t2w1rwt8=t1+2.0; 
  }


  if(loutwr8!=0 && linwr8!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr8=2.0*(a2wr8*m*n+b2wr8*z0wr8)/(a2wr8*m*m+b2wr8);
    qwr8=(a2wr8*n*n+b2wr8*z0wr8*z0wr8-a2wr8*b2wr8)/(a2wr8*m*m+b2wr8);
    if ((pwr8*pwr8/4.0)-qwr8<0){
    t2w1r8=t1+2.0;
    }else{
        zw1r8=-pwr8/2.0+sqrt((pwr8*pwr8/4.0)-qwr8);
        zw2r8=-pwr8/2.0-sqrt((pwr8*pwr8/4.0)-qwr8);
        t2w1r8=(zw1r8-z)/vz;
        t2w2r8=(zw2r8-z)/vz;
        if(t2w1r8<1e-15)
        t2w1r8=t1+2.0;
        if(t2w2r8<1e-15)
        t2w2r8=t1+2.0;
        if(t2w2r8<t2w1r8)
        t2w1r8=t2w2r8;
        xintersecwr8=m*(vz*t2w1r8+z)+n;
        if (xintersecwr8>0){
        t2w1r8=t1+2.0;}
        }
    pwrwt8=2.0*(a2wrwt8*m*n+b2wrwt8*z0wr8)/(a2wrwt8*m*m+b2wrwt8);
    qwrwt8=(a2wrwt8*n*n+b2wrwt8*z0wr8*z0wr8-a2wrwt8*b2wrwt8)/(a2wrwt8*m*m+b2wrwt8);
    if ((pwrwt8*pwrwt8/4.0)-qwrwt8<0){
    t2w1rwt8=t1+2.0;
    }else{
        zw1rwt8=-pwrwt8/2.0+sqrt((pwrwt8*pwrwt8/4.0)-qwrwt8);
        zw2rwt8=-pwrwt8/2.0-sqrt((pwrwt8*pwrwt8/4.0)-qwrwt8);
        t2w1rwt8=(zw1rwt8-z)/vz;
        t2w2rwt8=(zw2rwt8-z)/vz;
        if(t2w1rwt8<1e-15)
        t2w1rwt8=t1+2.0;
        if(t2w2rwt8<1e-15)
        t2w2rwt8=t1+2.0;
        if(t2w2rwt8<t2w1rwt8)
        t2w1rwt8=t2w2rwt8;
        xintersecwrwt8=m*(vz*t2w1rwt8+z)+n;
        if (xintersecwrwt8>0){
        t2w1rwt8=t1+2.0;}
        }
    }

  if((loutwr8!=0 && linwr8==0)|| (loutwr8==0 && linwr8!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr8=(2.0*m*n*pawr8+1.0)/(pawr8*m*m);
    qwr8=n*n/(m*m)-pbwr8/(pawr8*m*m);
    if(qwr8>0 && qwr8>(pwr8*pwr8/4)){
    t2w1r8=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r8=(pbwr8-pawr8*x*x-z)/vz;
      }else{
      t2w1r8=t1+2.0;
      }
    }else{
      zw1r8=-pwr8/2.0+sqrt(pwr8*pwr8/4.0-qwr8);
      zw2r8=-pwr8/2.0-sqrt(pwr8*pwr8/4.0-qwr8);
      t2w1r8=(zw1r8-z)/vz;
      t2w2r8=(zw2r8-z)/vz;
      if(t2w1r8<1e-15)
      t2w1r8=t1+2.0;
      if(t2w2r8<1e-15)
      t2w2r8=t1+2.0;
      if(t2w2r8<t2w1r8)
      t2w1r8=t2w2r8;
    }
    xintersecwr8=m*(vz*t2w1r8+z)+n;
    if (xintersecwr8>0){
    t2w1r8=t1+2.0;}
    }
    pwrwt8=(2.0*m*n*pawrwt8+1.0)/(pawrwt8*m*m);
    qwrwt8=n*n/(m*m)-pbwrwt8/(pawrwt8*m*m);
    if(qwrwt8>0 && qwrwt8>(pwrwt8*pwrwt8/4)){
    t2w1rwt8=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt8=(pbwrwt8-pawrwt8*x*x-z)/vz;
      }else{
      t2w1rwt8=t1+2.0; 
      }
    }else{
      zw1rwt8=-pwrwt8/2.0+sqrt(pwrwt8*pwrwt8/4.0-qwrwt8);
      zw2rwt8=-pwrwt8/2.0-sqrt(pwrwt8*pwrwt8/4.0-qwrwt8);
      t2w1rwt8=(zw1rwt8-z)/vz;
      t2w2rwt8=(zw2rwt8-z)/vz;
      if(t2w1rwt8<1e-15)
      t2w1rwt8=t1+2.0;
      if(t2w2rwt8<1e-15)
      t2w2rwt8=t1+2.0;
      if(t2w2rwt8<t2w1rwt8)
      t2w1rwt8=t2w2rwt8;
    }
    xintersecwrwt8=m*(vz*t2w1rwt8+z)+n;
    if (xintersecwrwt8>0){
    t2w1rwt8=t1+2.0;}
  }
  }

  if(loutwl8==0 && linwl8==0)
  {
  m=(w2l8-w1l8)/l;
  t2w1l8=(m*z+(w1l8)-x)/(vx-m*vz);
  t2w1lwt8=(m*z+(w1lwt8)-x)/(vx-m*vz);
  if(t2w1l8<1e-15)
  t2w1l8=t1+2.0;
  if(t2w1lwt8<1e-15)
  t2w1lwt8=t1+2.0;
  };

  if(loutwl8!=0 && linwl8!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl8=2.0*(a2wl8*m*n+b2wl8*z0wl8)/(a2wl8*m*m+b2wl8);
    qwl8=(a2wl8*n*n+b2wl8*z0wl8*z0wl8-a2wl8*b2wl8)/(a2wl8*m*m+b2wl8);
    if((pwl8*pwl8/4.0)-qwl8<0){
    t2w1l8=t1+2.0;
    }else{
        zw1l8=-pwl8/2.0+sqrt((pwl8*pwl8/4.0)-qwl8);
        zw2l8=-pwl8/2.0-sqrt((pwl8*pwl8/4.0)-qwl8);
        t2w1l8=(zw1l8-z)/vz;
        t2w2l8=(zw2l8-z)/vz;
        if(t2w1l8<1e-15)
        t2w1l8=t1+2.0;
        if(t2w2l8<1e-15)
        t2w2l8=t1+2.0;
        if(t2w2l8<t2w1l8)
        t2w1l8=t2w2l8;
        xintersecwl8=m*(vz*t2w1l8+z)+n;
        if (xintersecwl8<0){
        t2w1l8=t1+2.0;}
        }
    pwlwt8=2.0*(a2wlwt8*m*n+b2wlwt8*z0wl8)/(a2wlwt8*m*m+b2wlwt8);
    qwlwt8=(a2wlwt8*n*n+b2wlwt8*z0wl8*z0wl8-a2wlwt8*b2wlwt8)/(a2wlwt8*m*m+b2wlwt8);
    if((pwlwt8*pwlwt8/4.0)-qwlwt8<0){
    t2w1lwt8=t1+2.0;
    }else{
        zw1lwt8=-pwlwt8/2.0+sqrt((pwlwt8*pwlwt8/4.0)-qwlwt8);
        zw2lwt8=-pwlwt8/2.0-sqrt((pwlwt8*pwlwt8/4.0)-qwlwt8);
        t2w1lwt8=(zw1lwt8-z)/vz;
        t2w2lwt8=(zw2lwt8-z)/vz;
        if(t2w1lwt8<1e-15)
        t2w1lwt8=t1+2.0;
        if(t2w2lwt8<1e-15)
        t2w2lwt8=t1+2.0;
        if(t2w2lwt8<t2w1lwt8)
        t2w1lwt8=t2w2lwt8;
        xintersecwlwt8=m*(vz*t2w1lwt8+z)+n;
        if (xintersecwlwt8<0){
        t2w1lwt8=t1+2.0;}
        }
  }

  if((loutwl8!=0 && linwl8==0) || (loutwl8==0 && linwl8!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl8=(2.0*m*n*pawl8+1.0)/(pawl8*m*m);
    qwl8=n*n/(m*m)-pbwl8/(pawl8*m*m);
    if(qwl8>0 && qwl8>(pwl8*pwl8/4)){
    t2w1l8=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l8=(pbwl8-pawl8*x*x-z)/vz;
      }else{
      t2w1l8=t1+2.0;
      }
    }else{
      zw1l8=-pwl8/2.0+sqrt(pwl8*pwl8/4.0-qwl8);
      zw2l8=-pwl8/2.0-sqrt(pwl8*pwl8/4.0-qwl8);
      t2w1l8=(zw1l8-z)/vz;
      t2w2l8=(zw2l8-z)/vz;
      if(t2w1l8<1e-15)
      t2w1l8=t1+2.0;
      if(t2w2l8<1e-15)
      t2w2l8=t1+2.0;
      if(t2w2l8<t2w1l8)
      t2w1l8=t2w2l8;
    }
    }
    xintersecwl8=m*(vz*t2w1l8+z)+n;
    if (xintersecwl8<0){
    t2w1l8=t1+2.0;}
    pwlwt8=(2.0*m*n*pawlwt8+1.0)/(pawlwt8*m*m);
    qwlwt8=n*n/(m*m)-pbwlwt8/(pawlwt8*m*m);
    if(qwlwt8>0 && qwlwt8>(pwlwt8*pwlwt8/4)){
    t2w1lwt8=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt8=(pbwlwt8-pawlwt8*x*x-z)/vz;
      }else{
      t2w1lwt8=t1+2.0;
      }
    }else{
      zw1lwt8=-pwlwt8/2.0+sqrt(pwlwt8*pwlwt8/4.0-qwlwt8);
      zw2lwt8=-pwlwt8/2.0-sqrt(pwlwt8*pwlwt8/4.0-qwlwt8);
      t2w1lwt8=(zw1lwt8-z)/vz;
      t2w2lwt8=(zw2lwt8-z)/vz;
      if(t2w1lwt8<1e-15)
      t2w1lwt8=t1+2.0;
      if(t2w2lwt8<1e-15)
      t2w2lwt8=t1+2.0;
      if(t2w2lwt8<t2w1lwt8)
      t2w1lwt8=t2w2lwt8;
    }
    xintersecwlwt8=m*(vz*t2w1lwt8+z)+n;
    if (xintersecwlwt8<0){
    t2w1lwt8=t1+2.0;}
  }
  }

  if(louthu8==0 && linhu8==0)
  {
  m=(h2u8-h1u8)/l;
  t2h1u8=(m*z+(h1u8)-y)/(vy-m*vz);
  t2h1uwt8=(m*z+(h1uwt8)-y)/(vy-m*vz);
  if(t2h1u8<1e-15)
  t2h1u8=t1+2.0;
  if(t2h1uwt8<1e-15)
  t2h1uwt8=t1+2.0;
  }


  if(louthu8!=0 && linhu8!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu8=2.0*(a2hu8*m*n+b2hu8*z0hu8)/(a2hu8*m*m+b2hu8);
    qhu8=(a2hu8*n*n+b2hu8*z0hu8*z0hu8-a2hu8*b2hu8)/(a2hu8*m*m+b2hu8);
    if((phu8*phu8/4.0)-qhu8<0){
    t2h1u8=t1+2.0;
    }else{
        zh1u8=-phu8/2.0+sqrt((phu8*phu8/4.0)-qhu8);
        zh2u8=-phu8/2.0-sqrt((phu8*phu8/4.0)-qhu8);
        t2h1u8=(zh1u8-z)/vz;
        t2h2u8=(zh2u8-z)/vz;
        if(t2h1u8<1e-15)
        t2h1u8=t1+2.0;
        if(t2h2u8<1e-15)
        t2h2u8=t1+2.0;
        if(t2h2u8<t2h1u8)
        t2h1u8=t2h2u8;
        yintersechu8=m*(vz*t2h1u8+z)+n;
        if (yintersechu8<0){
        t2h1u8=t1+2.0;}
        }
    phuwt8=2.0*(a2huwt8*m*n+b2huwt8*z0hu8)/(a2huwt8*m*m+b2huwt8);
    qhuwt8=(a2huwt8*n*n+b2huwt8*z0hu8*z0hu8-a2huwt8*b2huwt8)/(a2huwt8*m*m+b2huwt8);
    if((phuwt8*phuwt8/4.0)-qhuwt8<0){
    t2h1uwt8=t1+2.0;
    }else{
        zh1uwt8=-phuwt8/2.0+sqrt((phuwt8*phuwt8/4.0)-qhuwt8);
        zh2uwt8=-phuwt8/2.0-sqrt((phuwt8*phuwt8/4.0)-qhuwt8);
        t2h1uwt8=(zh1uwt8-z)/vz;
        t2h2uwt8=(zh2uwt8-z)/vz;
        if(t2h1uwt8<1e-15)
        t2h1uwt8=t1+2.0;
        if(t2h2uwt8<1e-15)
        t2h2uwt8=t1+2.0;
        if(t2h2uwt8<t2h1uwt8)
        t2h1uwt8=t2h2uwt8;
        yintersechuwt8=m*(vz*t2h1uwt8+z)+n;
        if (yintersechuwt8<0){
        t2h1uwt8=t1+2.0;}
        }
  }


  if((louthu8!=0 && linhu8==0)|| (louthu8==0 && linhu8!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu8=(2.0*m*n*pahu8+1.0)/(pahu8*m*m);	
    qhu8=n*n/(m*m)-pbhu8/(pahu8*m*m);
    if(qhu8>0 && qhu8>(phu8*phu8/4)){
    t2h1u8=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u8=(pbhu8-pahu8*y*y-z)/vz;
      }else{
      t2h1u8=t1+2.0;
      }
    }else{
      zh1u8=-phu8/2.0+sqrt(phu8*phu8/4.0-qhu8);
      zh2u8=-phu8/2.0-sqrt(phu8*phu8/4.0-qhu8);
      t2h1u8=(zh1u8-z)/vz;
      t2h2u8=(zh2u8-z)/vz;
      if(t2h1u8<1e-15)
      t2h1u8=t1+2.0;
      if(t2h2u8<1e-15)
      t2h2u8=t1+2.0;
      if(t2h2u8<t2h1u8)
      t2h1u8=t2h2u8;
    }
    yintersechu8=m*(vz*t2h1u8+z)+n;
    if (yintersechu8<0){
    t2h1u8=t1+2.0;}
  }
    phuwt8=(2.0*m*n*pahuwt8+1.0)/(pahuwt8*m*m);						
    qhuwt8=n*n/(m*m)-pbhuwt8/(pahuwt8*m*m);
    if(qhuwt8>0 && qhuwt8>(phuwt8*phuwt8/4)){
    t2h1uwt8=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt8=(pbhuwt8-pahuwt8*y*y-z)/vz;
      }else{
      t2h1uwt8=t1+2.0;
      }
    }else{
      zh1uwt8=-phuwt8/2.0+sqrt(phuwt8*phuwt8/4.0-qhuwt8);
      zh2uwt8=-phuwt8/2.0-sqrt(phuwt8*phuwt8/4.0-qhuwt8);
      t2h1uwt8=(zh1uwt8-z)/vz;
      t2h2uwt8=(zh2uwt8-z)/vz;
      if(t2h1uwt8<1e-15)
      t2h1uwt8=t1+2.0;
      if(t2h2uwt8<1e-15)
      t2h2uwt8=t1+2.0;
      if(t2h2uwt8<t2h1uwt8)
      t2h1uwt8=t2h2uwt8;
    }
    yintersechuwt8=m*(vz*t2h1uwt8+z)+n;
    if (yintersechuwt8<0){
    t2h1uwt8=t1+2.0;}
  }
  }

  if(louthd8==0 && linhd8==0)
  {
  m=(-h2d8+h1d8)/l;
  t2h1d8=(m*z+(-h1d8)-y)/(vy-m*vz);
  t2h1dwt8=(m*z+(-h1dwt8)-y)/(vy-m*vz);
  if(t2h1d8<1e-15)
  t2h1d8=t1+2.0;
  if(t2h1dwt8<1e-15)
  t2h1dwt8=t1+2.0;
  }

  if(louthd8!=0 && linhd8!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd8=2.0*(a2hd8*m*n+b2hd8*z0hd8)/(a2hd8*m*m+b2hd8);
    qhd8=(a2hd8*n*n+b2hd8*z0hd8*z0hd8-a2hd8*b2hd8)/(a2hd8*m*m+b2hd8);
    if((phd8*phd8/4.0)-qhd8<0){
    t2h1d8=t1+2.0;
    }else{
        zh1d8=-phd8/2.0+sqrt((phd8*phd8/4.0)-qhd8);
        zh2d8=-phd8/2.0-sqrt((phd8*phd8/4.0)-qhd8);
        t2h1d8=(zh1d8-z)/vz;
        t2h2d8=(zh2d8-z)/vz;
        if(t2h1d8<1e-15)
        t2h1d8=t1+2.0;
        if(t2h2d8<1e-15)
        t2h2d8=t1+2.0;
        if(t2h2d8<t2h1d8)
        t2h1d8=t2h2d8;
        yintersechd8=m*(vz*t2h1d8+z)+n;
        if (yintersechd8>0){
        t2h1d8=t1+2.0;}
        }
    phdwt8=2.0*(a2hdwt8*m*n+b2hdwt8*z0hd8)/(a2hdwt8*m*m+b2hdwt8);
    qhdwt8=(a2hdwt8*n*n+b2hdwt8*z0hd8*z0hd8-a2hdwt8*b2hdwt8)/(a2hdwt8*m*m+b2hdwt8);
    if((phdwt8*phdwt8/4.0)-qhdwt8<0){
    t2h1dwt8=t1+2.0;
    }else{
        zh1dwt8=-phdwt8/2.0+sqrt((phdwt8*phdwt8/4.0)-qhdwt8);
        zh2dwt8=-phdwt8/2.0-sqrt((phdwt8*phdwt8/4.0)-qhdwt8);
        t2h1dwt8=(zh1dwt8-z)/vz;
        t2h2dwt8=(zh2dwt8-z)/vz;
        if(t2h1dwt8<1e-15)
        t2h1dwt8=t1+2.0;
        if(t2h2dwt8<1e-15)
        t2h2dwt8=t1+2.0;
        if(t2h2dwt8<t2h1dwt8)
        t2h1dwt8=t2h2dwt8;
        yintersechdwt8=m*(vz*t2h1dwt8+z)+n;
        if (yintersechdwt8>0){
        t2h1dwt8=t1+2.0;}
        }
  }

  if((louthd8!=0 && linhd8==0)|| (louthd8==0 && linhd8!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd8=(2.0*m*n*pahd8+1.0)/(pahd8*m*m);
    qhd8=n*n/(m*m)-pbhd8/(pahd8*m*m);
    if(qhd8>0 && qhd8>(phd8*phd8/4)){
    t2h1d8=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d8=(pbhd8-pahd8*y*y-z)/vz;
      }else{
      t2h1d8=t1+2.0;
      }
    }else{
      zh1d8=-phd8/2.0+sqrt(phd8*phd8/4.0-qhd8);
      zh2d8=-phd8/2.0-sqrt(phd8*phd8/4.0-qhd8);
      t2h1d8=(zh1d8-z)/vz;
      t2h2d8=(zh2d8-z)/vz;
      if(t2h1d8<1e-15)
      t2h1d8=t1+2.0;
      if(t2h2d8<1e-15)
      t2h2d8=t1+2.0;
      if(t2h2d8<t2h1d8)
      t2h1d8=t2h2d8;
    }
    yintersechd8=m*(vz*t2h1d8+z)+n;
    if (yintersechd8>0){
    t2h1d8=t1+2.0;}
  }
    phdwt8=(2.0*m*n*pahdwt8+1.0)/(pahdwt8*m*m);
    qhdwt8=n*n/(m*m)-pbhdwt8/(pahdwt8*m*m);
    if(qhdwt8>0 && qhdwt8>(phdwt8*phdwt8/4)){
    t2h1dwt8=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt8=(pbhdwt8-pahdwt8*y*y-z)/vz;
      }else{
      t2h1dwt8=t1+2.0;
      }
    }else{
      zh1dwt8=-phdwt8/2.0+sqrt(phdwt8*phdwt8/4.0-qhdwt8);
      zh2dwt8=-phdwt8/2.0-sqrt(phdwt8*phdwt8/4.0-qhdwt8);
      t2h1dwt8=(zh1dwt8-z)/vz;
      t2h2dwt8=(zh2dwt8-z)/vz;
      if(t2h1dwt8<1e-15)
      t2h1dwt8=t1+2.0;
      if(t2h2dwt8<1e-15)
      t2h2dwt8=t1+2.0;
      if(t2h2dwt8<t2h1dwt8)
      t2h1dwt8=t2h2dwt8;
    }
    yintersechdwt8=m*(vz*t2h1dwt8+z)+n;
    if (yintersechdwt8>0){
    t2h1dwt8=t1+2.0;}
  }
  }


  if(loutwr9==0 && linwr9==0)
  {
  m=(-w2r9+w1r9)/l;
  t2w1r9=(m*z+(-w1r9)-x)/(vx-m*vz);
  t2w1rwt9=(m*z+(-w1rwt9)-x)/(vx-m*vz);
  if(t2w1r9<1e-15)
    t2w1r9=t1+2.0;
  if(t2w1rwt9<1e-15)
    t2w1rwt9=t1+2.0; 
  }


  if(loutwr9!=0 && linwr9!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr9=2.0*(a2wr9*m*n+b2wr9*z0wr9)/(a2wr9*m*m+b2wr9);
    qwr9=(a2wr9*n*n+b2wr9*z0wr9*z0wr9-a2wr9*b2wr9)/(a2wr9*m*m+b2wr9);
    if ((pwr9*pwr9/4.0)-qwr9<0){
    t2w1r9=t1+2.0;
    }else{
        zw1r9=-pwr9/2.0+sqrt((pwr9*pwr9/4.0)-qwr9);
        zw2r9=-pwr9/2.0-sqrt((pwr9*pwr9/4.0)-qwr9);
        t2w1r9=(zw1r9-z)/vz;
        t2w2r9=(zw2r9-z)/vz;
        if(t2w1r9<1e-15)
        t2w1r9=t1+2.0;
        if(t2w2r9<1e-15)
        t2w2r9=t1+2.0;
        if(t2w2r9<t2w1r9)
        t2w1r9=t2w2r9;
        xintersecwr9=m*(vz*t2w1r9+z)+n;
        if (xintersecwr9>0){
        t2w1r9=t1+2.0;}
        }
    pwrwt9=2.0*(a2wrwt9*m*n+b2wrwt9*z0wr9)/(a2wrwt9*m*m+b2wrwt9);
    qwrwt9=(a2wrwt9*n*n+b2wrwt9*z0wr9*z0wr9-a2wrwt9*b2wrwt9)/(a2wrwt9*m*m+b2wrwt9);
    if ((pwrwt9*pwrwt9/4.0)-qwrwt9<0){
    t2w1rwt9=t1+2.0;
    }else{
        zw1rwt9=-pwrwt9/2.0+sqrt((pwrwt9*pwrwt9/4.0)-qwrwt9);
        zw2rwt9=-pwrwt9/2.0-sqrt((pwrwt9*pwrwt9/4.0)-qwrwt9);
        t2w1rwt9=(zw1rwt9-z)/vz;
        t2w2rwt9=(zw2rwt9-z)/vz;
        if(t2w1rwt9<1e-15)
        t2w1rwt9=t1+2.0;
        if(t2w2rwt9<1e-15)
        t2w2rwt9=t1+2.0;
        if(t2w2rwt9<t2w1rwt9)
        t2w1rwt9=t2w2rwt9;
        xintersecwrwt9=m*(vz*t2w1rwt9+z)+n;
        if (xintersecwrwt9>0){
        t2w1rwt9=t1+2.0;}
        }
    }

  if((loutwr9!=0 && linwr9==0)|| (loutwr9==0 && linwr9!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr9=(2.0*m*n*pawr9+1.0)/(pawr9*m*m);
    qwr9=n*n/(m*m)-pbwr9/(pawr9*m*m);
    if(qwr9>0 && qwr9>(pwr9*pwr9/4)){
    t2w1r9=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r9=(pbwr9-pawr9*x*x-z)/vz;
      }else{
      t2w1r9=t1+2.0;
      }
    }else{
      zw1r9=-pwr9/2.0+sqrt(pwr9*pwr9/4.0-qwr9);
      zw2r9=-pwr9/2.0-sqrt(pwr9*pwr9/4.0-qwr9);
      t2w1r9=(zw1r9-z)/vz;
      t2w2r9=(zw2r9-z)/vz;
      if(t2w1r9<1e-15)
      t2w1r9=t1+2.0;
      if(t2w2r9<1e-15)
      t2w2r9=t1+2.0;
      if(t2w2r9<t2w1r9)
      t2w1r9=t2w2r9;
    }
    xintersecwr9=m*(vz*t2w1r9+z)+n;
    if (xintersecwr9>0){
    t2w1r9=t1+2.0;}
    }
    pwrwt9=(2.0*m*n*pawrwt9+1.0)/(pawrwt9*m*m);
    qwrwt9=n*n/(m*m)-pbwrwt9/(pawrwt9*m*m);
    if(qwrwt9>0 && qwrwt9>(pwrwt9*pwrwt9/4)){
    t2w1rwt9=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt9=(pbwrwt9-pawrwt9*x*x-z)/vz;
      }else{
      t2w1rwt9=t1+2.0; 
      }
    }else{
      zw1rwt9=-pwrwt9/2.0+sqrt(pwrwt9*pwrwt9/4.0-qwrwt9);
      zw2rwt9=-pwrwt9/2.0-sqrt(pwrwt9*pwrwt9/4.0-qwrwt9);
      t2w1rwt9=(zw1rwt9-z)/vz;
      t2w2rwt9=(zw2rwt9-z)/vz;
      if(t2w1rwt9<1e-15)
      t2w1rwt9=t1+2.0;
      if(t2w2rwt9<1e-15)
      t2w2rwt9=t1+2.0;
      if(t2w2rwt9<t2w1rwt9)
      t2w1rwt9=t2w2rwt9;
    }
    xintersecwrwt9=m*(vz*t2w1rwt9+z)+n;
    if (xintersecwrwt9>0){
    t2w1rwt9=t1+2.0;}
  }
  }

  if(loutwl9==0 && linwl9==0)
  {
  m=(w2l9-w1l9)/l;
  t2w1l9=(m*z+(w1l9)-x)/(vx-m*vz);
  t2w1lwt9=(m*z+(w1lwt9)-x)/(vx-m*vz);
  if(t2w1l9<1e-15)
  t2w1l9=t1+2.0;
  if(t2w1lwt9<1e-15)
  t2w1lwt9=t1+2.0;
  };

  if(loutwl9!=0 && linwl9!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl9=2.0*(a2wl9*m*n+b2wl9*z0wl9)/(a2wl9*m*m+b2wl9);
    qwl9=(a2wl9*n*n+b2wl9*z0wl9*z0wl9-a2wl9*b2wl9)/(a2wl9*m*m+b2wl9);
    if((pwl9*pwl9/4.0)-qwl9<0){
    t2w1l9=t1+2.0;
    }else{
        zw1l9=-pwl9/2.0+sqrt((pwl9*pwl9/4.0)-qwl9);
        zw2l9=-pwl9/2.0-sqrt((pwl9*pwl9/4.0)-qwl9);
        t2w1l9=(zw1l9-z)/vz;
        t2w2l9=(zw2l9-z)/vz;
        if(t2w1l9<1e-15)
        t2w1l9=t1+2.0;
        if(t2w2l9<1e-15)
        t2w2l9=t1+2.0;
        if(t2w2l9<t2w1l9)
        t2w1l9=t2w2l9;
        xintersecwl9=m*(vz*t2w1l9+z)+n;
        if (xintersecwl9<0){
        t2w1l9=t1+2.0;}
        }
    pwlwt9=2.0*(a2wlwt9*m*n+b2wlwt9*z0wl9)/(a2wlwt9*m*m+b2wlwt9);
    qwlwt9=(a2wlwt9*n*n+b2wlwt9*z0wl9*z0wl9-a2wlwt9*b2wlwt9)/(a2wlwt9*m*m+b2wlwt9);
    if((pwlwt9*pwlwt9/4.0)-qwlwt9<0){
    t2w1lwt9=t1+2.0;
    }else{
        zw1lwt9=-pwlwt9/2.0+sqrt((pwlwt9*pwlwt9/4.0)-qwlwt9);
        zw2lwt9=-pwlwt9/2.0-sqrt((pwlwt9*pwlwt9/4.0)-qwlwt9);
        t2w1lwt9=(zw1lwt9-z)/vz;
        t2w2lwt9=(zw2lwt9-z)/vz;
        if(t2w1lwt9<1e-15)
        t2w1lwt9=t1+2.0;
        if(t2w2lwt9<1e-15)
        t2w2lwt9=t1+2.0;
        if(t2w2lwt9<t2w1lwt9)
        t2w1lwt9=t2w2lwt9;
        xintersecwlwt9=m*(vz*t2w1lwt9+z)+n;
        if (xintersecwlwt9<0){
        t2w1lwt9=t1+2.0;}
        }
  }

  if((loutwl9!=0 && linwl9==0) || (loutwl9==0 && linwl9!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl9=(2.0*m*n*pawl9+1.0)/(pawl9*m*m);
    qwl9=n*n/(m*m)-pbwl9/(pawl9*m*m);
    if(qwl9>0 && qwl9>(pwl9*pwl9/4)){
    t2w1l9=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l9=(pbwl9-pawl9*x*x-z)/vz;
      }else{
      t2w1l9=t1+2.0;
      }
    }else{
      zw1l9=-pwl9/2.0+sqrt(pwl9*pwl9/4.0-qwl9);
      zw2l9=-pwl9/2.0-sqrt(pwl9*pwl9/4.0-qwl9);
      t2w1l9=(zw1l9-z)/vz;
      t2w2l9=(zw2l9-z)/vz;
      if(t2w1l9<1e-15)
      t2w1l9=t1+2.0;
      if(t2w2l9<1e-15)
      t2w2l9=t1+2.0;
      if(t2w2l9<t2w1l9)
      t2w1l9=t2w2l9;
    }
    }
    xintersecwl9=m*(vz*t2w1l9+z)+n;
    if (xintersecwl9<0){
    t2w1l9=t1+2.0;}
    pwlwt9=(2.0*m*n*pawlwt9+1.0)/(pawlwt9*m*m);
    qwlwt9=n*n/(m*m)-pbwlwt9/(pawlwt9*m*m);
    if(qwlwt9>0 && qwlwt9>(pwlwt9*pwlwt9/4)){
    t2w1lwt9=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt9=(pbwlwt9-pawlwt9*x*x-z)/vz;
      }else{
      t2w1lwt9=t1+2.0;
      }
    }else{
      zw1lwt9=-pwlwt9/2.0+sqrt(pwlwt9*pwlwt9/4.0-qwlwt9);
      zw2lwt9=-pwlwt9/2.0-sqrt(pwlwt9*pwlwt9/4.0-qwlwt9);
      t2w1lwt9=(zw1lwt9-z)/vz;
      t2w2lwt9=(zw2lwt9-z)/vz;
      if(t2w1lwt9<1e-15)
      t2w1lwt9=t1+2.0;
      if(t2w2lwt9<1e-15)
      t2w2lwt9=t1+2.0;
      if(t2w2lwt9<t2w1lwt9)
      t2w1lwt9=t2w2lwt9;
    }
    xintersecwlwt9=m*(vz*t2w1lwt9+z)+n;
    if (xintersecwlwt9<0){
    t2w1lwt9=t1+2.0;}
  }
  }

  if(louthu9==0 && linhu9==0)
  {
  m=(h2u9-h1u9)/l;
  t2h1u9=(m*z+(h1u9)-y)/(vy-m*vz);
  t2h1uwt9=(m*z+(h1uwt9)-y)/(vy-m*vz);
  if(t2h1u9<1e-15)
  t2h1u9=t1+2.0;
  if(t2h1uwt9<1e-15)
  t2h1uwt9=t1+2.0;
  }


  if(louthu9!=0 && linhu9!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu9=2.0*(a2hu9*m*n+b2hu9*z0hu9)/(a2hu9*m*m+b2hu9);
    qhu9=(a2hu9*n*n+b2hu9*z0hu9*z0hu9-a2hu9*b2hu9)/(a2hu9*m*m+b2hu9);
    if((phu9*phu9/4.0)-qhu9<0){
    t2h1u9=t1+2.0;
    }else{
        zh1u9=-phu9/2.0+sqrt((phu9*phu9/4.0)-qhu9);
        zh2u9=-phu9/2.0-sqrt((phu9*phu9/4.0)-qhu9);
        t2h1u9=(zh1u9-z)/vz;
        t2h2u9=(zh2u9-z)/vz;
        if(t2h1u9<1e-15)
        t2h1u9=t1+2.0;
        if(t2h2u9<1e-15)
        t2h2u9=t1+2.0;
        if(t2h2u9<t2h1u9)
        t2h1u9=t2h2u9;
        yintersechu9=m*(vz*t2h1u9+z)+n;
        if (yintersechu9<0){
        t2h1u9=t1+2.0;}
        }
    phuwt9=2.0*(a2huwt9*m*n+b2huwt9*z0hu9)/(a2huwt9*m*m+b2huwt9);
    qhuwt9=(a2huwt9*n*n+b2huwt9*z0hu9*z0hu9-a2huwt9*b2huwt9)/(a2huwt9*m*m+b2huwt9);
    if((phuwt9*phuwt9/4.0)-qhuwt9<0){
    t2h1uwt9=t1+2.0;
    }else{
        zh1uwt9=-phuwt9/2.0+sqrt((phuwt9*phuwt9/4.0)-qhuwt9);
        zh2uwt9=-phuwt9/2.0-sqrt((phuwt9*phuwt9/4.0)-qhuwt9);
        t2h1uwt9=(zh1uwt9-z)/vz;
        t2h2uwt9=(zh2uwt9-z)/vz;
        if(t2h1uwt9<1e-15)
        t2h1uwt9=t1+2.0;
        if(t2h2uwt9<1e-15)
        t2h2uwt9=t1+2.0;
        if(t2h2uwt9<t2h1uwt9)
        t2h1uwt9=t2h2uwt9;
        yintersechuwt9=m*(vz*t2h1uwt9+z)+n;
        if (yintersechuwt9<0){
        t2h1uwt9=t1+2.0;}
        }
  }


  if((louthu9!=0 && linhu9==0)|| (louthu9==0 && linhu9!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu9=(2.0*m*n*pahu9+1.0)/(pahu9*m*m);	
    qhu9=n*n/(m*m)-pbhu9/(pahu9*m*m);
    if(qhu9>0 && qhu9>(phu9*phu9/4)){
    t2h1u9=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u9=(pbhu9-pahu9*y*y-z)/vz;
      }else{
      t2h1u9=t1+2.0;
      }
    }else{
      zh1u9=-phu9/2.0+sqrt(phu9*phu9/4.0-qhu9);
      zh2u9=-phu9/2.0-sqrt(phu9*phu9/4.0-qhu9);
      t2h1u9=(zh1u9-z)/vz;
      t2h2u9=(zh2u9-z)/vz;
      if(t2h1u9<1e-15)
      t2h1u9=t1+2.0;
      if(t2h2u9<1e-15)
      t2h2u9=t1+2.0;
      if(t2h2u9<t2h1u9)
      t2h1u9=t2h2u9;
    }
    yintersechu9=m*(vz*t2h1u9+z)+n;
    if (yintersechu9<0){
    t2h1u9=t1+2.0;}
  }
    phuwt9=(2.0*m*n*pahuwt9+1.0)/(pahuwt9*m*m);						
    qhuwt9=n*n/(m*m)-pbhuwt9/(pahuwt9*m*m);
    if(qhuwt9>0 && qhuwt9>(phuwt9*phuwt9/4)){
    t2h1uwt9=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt9=(pbhuwt9-pahuwt9*y*y-z)/vz;
      }else{
      t2h1uwt9=t1+2.0;
      }
    }else{
      zh1uwt9=-phuwt9/2.0+sqrt(phuwt9*phuwt9/4.0-qhuwt9);
      zh2uwt9=-phuwt9/2.0-sqrt(phuwt9*phuwt9/4.0-qhuwt9);
      t2h1uwt9=(zh1uwt9-z)/vz;
      t2h2uwt9=(zh2uwt9-z)/vz;
      if(t2h1uwt9<1e-15)
      t2h1uwt9=t1+2.0;
      if(t2h2uwt9<1e-15)
      t2h2uwt9=t1+2.0;
      if(t2h2uwt9<t2h1uwt9)
      t2h1uwt9=t2h2uwt9;
    }
    yintersechuwt9=m*(vz*t2h1uwt9+z)+n;
    if (yintersechuwt9<0){
    t2h1uwt9=t1+2.0;}
  }
  }

  if(louthd9==0 && linhd9==0)
  {
  m=(-h2d9+h1d9)/l;
  t2h1d9=(m*z+(-h1d9)-y)/(vy-m*vz);
  t2h1dwt9=(m*z+(-h1dwt9)-y)/(vy-m*vz);
  if(t2h1d9<1e-15)
  t2h1d9=t1+2.0;
  if(t2h1dwt9<1e-15)
  t2h1dwt9=t1+2.0;
  }

  if(louthd9!=0 && linhd9!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd9=2.0*(a2hd9*m*n+b2hd9*z0hd9)/(a2hd9*m*m+b2hd9);
    qhd9=(a2hd9*n*n+b2hd9*z0hd9*z0hd9-a2hd9*b2hd9)/(a2hd9*m*m+b2hd9);
    if((phd9*phd9/4.0)-qhd9<0){
    t2h1d9=t1+2.0;
    }else{
        zh1d9=-phd9/2.0+sqrt((phd9*phd9/4.0)-qhd9);
        zh2d9=-phd9/2.0-sqrt((phd9*phd9/4.0)-qhd9);
        t2h1d9=(zh1d9-z)/vz;
        t2h2d9=(zh2d9-z)/vz;
        if(t2h1d9<1e-15)
        t2h1d9=t1+2.0;
        if(t2h2d9<1e-15)
        t2h2d9=t1+2.0;
        if(t2h2d9<t2h1d9)
        t2h1d9=t2h2d9;
        yintersechd9=m*(vz*t2h1d9+z)+n;
        if (yintersechd9>0){
        t2h1d9=t1+2.0;}
        }
    phdwt9=2.0*(a2hdwt9*m*n+b2hdwt9*z0hd9)/(a2hdwt9*m*m+b2hdwt9);
    qhdwt9=(a2hdwt9*n*n+b2hdwt9*z0hd9*z0hd9-a2hdwt9*b2hdwt9)/(a2hdwt9*m*m+b2hdwt9);
    if((phdwt9*phdwt9/4.0)-qhdwt9<0){
    t2h1dwt9=t1+2.0;
    }else{
        zh1dwt9=-phdwt9/2.0+sqrt((phdwt9*phdwt9/4.0)-qhdwt9);
        zh2dwt9=-phdwt9/2.0-sqrt((phdwt9*phdwt9/4.0)-qhdwt9);
        t2h1dwt9=(zh1dwt9-z)/vz;
        t2h2dwt9=(zh2dwt9-z)/vz;
        if(t2h1dwt9<1e-15)
        t2h1dwt9=t1+2.0;
        if(t2h2dwt9<1e-15)
        t2h2dwt9=t1+2.0;
        if(t2h2dwt9<t2h1dwt9)
        t2h1dwt9=t2h2dwt9;
        yintersechdwt9=m*(vz*t2h1dwt9+z)+n;
        if (yintersechdwt9>0){
        t2h1dwt9=t1+2.0;}
        }
  }

  if((louthd9!=0 && linhd9==0)|| (louthd9==0 && linhd9!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd9=(2.0*m*n*pahd9+1.0)/(pahd9*m*m);
    qhd9=n*n/(m*m)-pbhd9/(pahd9*m*m);
    if(qhd9>0 && qhd9>(phd9*phd9/4)){
    t2h1d9=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d9=(pbhd9-pahd9*y*y-z)/vz;
      }else{
      t2h1d9=t1+2.0;
      }
    }else{
      zh1d9=-phd9/2.0+sqrt(phd9*phd9/4.0-qhd9);
      zh2d9=-phd9/2.0-sqrt(phd9*phd9/4.0-qhd9);
      t2h1d9=(zh1d9-z)/vz;
      t2h2d9=(zh2d9-z)/vz;
      if(t2h1d9<1e-15)
      t2h1d9=t1+2.0;
      if(t2h2d9<1e-15)
      t2h2d9=t1+2.0;
      if(t2h2d9<t2h1d9)
      t2h1d9=t2h2d9;
    }
    yintersechd9=m*(vz*t2h1d9+z)+n;
    if (yintersechd9>0){
    t2h1d9=t1+2.0;}
  }
    phdwt9=(2.0*m*n*pahdwt9+1.0)/(pahdwt9*m*m);
    qhdwt9=n*n/(m*m)-pbhdwt9/(pahdwt9*m*m);
    if(qhdwt9>0 && qhdwt9>(phdwt9*phdwt9/4)){
    t2h1dwt9=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt9=(pbhdwt9-pahdwt9*y*y-z)/vz;
      }else{
      t2h1dwt9=t1+2.0;
      }
    }else{
      zh1dwt9=-phdwt9/2.0+sqrt(phdwt9*phdwt9/4.0-qhdwt9);
      zh2dwt9=-phdwt9/2.0-sqrt(phdwt9*phdwt9/4.0-qhdwt9);
      t2h1dwt9=(zh1dwt9-z)/vz;
      t2h2dwt9=(zh2dwt9-z)/vz;
      if(t2h1dwt9<1e-15)
      t2h1dwt9=t1+2.0;
      if(t2h2dwt9<1e-15)
      t2h2dwt9=t1+2.0;
      if(t2h2dwt9<t2h1dwt9)
      t2h1dwt9=t2h2dwt9;
    }
    yintersechdwt9=m*(vz*t2h1dwt9+z)+n;
    if (yintersechdwt9>0){
    t2h1dwt9=t1+2.0;}
  }
  }


  if(loutwr10==0 && linwr10==0)
  {
  m=(-w2r10+w1r10)/l;
  t2w1r10=(m*z+(-w1r10)-x)/(vx-m*vz);
  t2w1rwt10=(m*z+(-w1rwt10)-x)/(vx-m*vz);
  if(t2w1r10<1e-15)
    t2w1r10=t1+2.0;
  if(t2w1rwt10<1e-15)
    t2w1rwt10=t1+2.0; 
  }


  if(loutwr10!=0 && linwr10!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwr10=2.0*(a2wr10*m*n+b2wr10*z0wr10)/(a2wr10*m*m+b2wr10);
    qwr10=(a2wr10*n*n+b2wr10*z0wr10*z0wr10-a2wr10*b2wr10)/(a2wr10*m*m+b2wr10);
    if ((pwr10*pwr10/4.0)-qwr10<0){
    t2w1r10=t1+2.0;
    }else{
        zw1r10=-pwr10/2.0+sqrt((pwr10*pwr10/4.0)-qwr10);
        zw2r10=-pwr10/2.0-sqrt((pwr10*pwr10/4.0)-qwr10);
        t2w1r10=(zw1r10-z)/vz;
        t2w2r10=(zw2r10-z)/vz;
        if(t2w1r10<1e-15)
        t2w1r10=t1+2.0;
        if(t2w2r10<1e-15)
        t2w2r10=t1+2.0;
        if(t2w2r10<t2w1r10)
        t2w1r10=t2w2r10;
        xintersecwr10=m*(vz*t2w1r10+z)+n;
        if (xintersecwr10>0){
        t2w1r10=t1+2.0;}
        }
    pwrwt10=2.0*(a2wrwt10*m*n+b2wrwt10*z0wr10)/(a2wrwt10*m*m+b2wrwt10);
    qwrwt10=(a2wrwt10*n*n+b2wrwt10*z0wr10*z0wr10-a2wrwt10*b2wrwt10)/(a2wrwt10*m*m+b2wrwt10);
    if ((pwrwt10*pwrwt10/4.0)-qwrwt10<0){
    t2w1rwt10=t1+2.0;
    }else{
        zw1rwt10=-pwrwt10/2.0+sqrt((pwrwt10*pwrwt10/4.0)-qwrwt10);
        zw2rwt10=-pwrwt10/2.0-sqrt((pwrwt10*pwrwt10/4.0)-qwrwt10);
        t2w1rwt10=(zw1rwt10-z)/vz;
        t2w2rwt10=(zw2rwt10-z)/vz;
        if(t2w1rwt10<1e-15)
        t2w1rwt10=t1+2.0;
        if(t2w2rwt10<1e-15)
        t2w2rwt10=t1+2.0;
        if(t2w2rwt10<t2w1rwt10)
        t2w1rwt10=t2w2rwt10;
        xintersecwrwt10=m*(vz*t2w1rwt10+z)+n;
        if (xintersecwrwt10>0){
        t2w1rwt10=t1+2.0;}
        }
    }

  if((loutwr10!=0 && linwr10==0)|| (loutwr10==0 && linwr10!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwr10=(2.0*m*n*pawr10+1.0)/(pawr10*m*m);
    qwr10=n*n/(m*m)-pbwr10/(pawr10*m*m);
    if(qwr10>0 && qwr10>(pwr10*pwr10/4)){
    t2w1r10=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1r10=(pbwr10-pawr10*x*x-z)/vz;
      }else{
      t2w1r10=t1+2.0;
      }
    }else{
      zw1r10=-pwr10/2.0+sqrt(pwr10*pwr10/4.0-qwr10);
      zw2r10=-pwr10/2.0-sqrt(pwr10*pwr10/4.0-qwr10);
      t2w1r10=(zw1r10-z)/vz;
      t2w2r10=(zw2r10-z)/vz;
      if(t2w1r10<1e-15)
      t2w1r10=t1+2.0;
      if(t2w2r10<1e-15)
      t2w2r10=t1+2.0;
      if(t2w2r10<t2w1r10)
      t2w1r10=t2w2r10;
    }
    xintersecwr10=m*(vz*t2w1r10+z)+n;
    if (xintersecwr10>0){
    t2w1r10=t1+2.0;}
    }
    pwrwt10=(2.0*m*n*pawrwt10+1.0)/(pawrwt10*m*m);
    qwrwt10=n*n/(m*m)-pbwrwt10/(pawrwt10*m*m);
    if(qwrwt10>0 && qwrwt10>(pwrwt10*pwrwt10/4)){
    t2w1rwt10=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x<0){
      t2w1rwt10=(pbwrwt10-pawrwt10*x*x-z)/vz;
      }else{
      t2w1rwt10=t1+2.0; 
      }
    }else{
      zw1rwt10=-pwrwt10/2.0+sqrt(pwrwt10*pwrwt10/4.0-qwrwt10);
      zw2rwt10=-pwrwt10/2.0-sqrt(pwrwt10*pwrwt10/4.0-qwrwt10);
      t2w1rwt10=(zw1rwt10-z)/vz;
      t2w2rwt10=(zw2rwt10-z)/vz;
      if(t2w1rwt10<1e-15)
      t2w1rwt10=t1+2.0;
      if(t2w2rwt10<1e-15)
      t2w2rwt10=t1+2.0;
      if(t2w2rwt10<t2w1rwt10)
      t2w1rwt10=t2w2rwt10;
    }
    xintersecwrwt10=m*(vz*t2w1rwt10+z)+n;
    if (xintersecwrwt10>0){
    t2w1rwt10=t1+2.0;}
  }
  }

  if(loutwl10==0 && linwl10==0)
  {
  m=(w2l10-w1l10)/l;
  t2w1l10=(m*z+(w1l10)-x)/(vx-m*vz);
  t2w1lwt10=(m*z+(w1lwt10)-x)/(vx-m*vz);
  if(t2w1l10<1e-15)
  t2w1l10=t1+2.0;
  if(t2w1lwt10<1e-15)
  t2w1lwt10=t1+2.0;
  };

  if(loutwl10!=0 && linwl10!=0)
  { 
    m=vx/vz;
    n=-m*z+x;
    pwl10=2.0*(a2wl10*m*n+b2wl10*z0wl10)/(a2wl10*m*m+b2wl10);
    qwl10=(a2wl10*n*n+b2wl10*z0wl10*z0wl10-a2wl10*b2wl10)/(a2wl10*m*m+b2wl10);
    if((pwl10*pwl10/4.0)-qwl10<0){
    t2w1l10=t1+2.0;
    }else{
        zw1l10=-pwl10/2.0+sqrt((pwl10*pwl10/4.0)-qwl10);
        zw2l10=-pwl10/2.0-sqrt((pwl10*pwl10/4.0)-qwl10);
        t2w1l10=(zw1l10-z)/vz;
        t2w2l10=(zw2l10-z)/vz;
        if(t2w1l10<1e-15)
        t2w1l10=t1+2.0;
        if(t2w2l10<1e-15)
        t2w2l10=t1+2.0;
        if(t2w2l10<t2w1l10)
        t2w1l10=t2w2l10;
        xintersecwl10=m*(vz*t2w1l10+z)+n;
        if (xintersecwl10<0){
        t2w1l10=t1+2.0;}
        }
    pwlwt10=2.0*(a2wlwt10*m*n+b2wlwt10*z0wl10)/(a2wlwt10*m*m+b2wlwt10);
    qwlwt10=(a2wlwt10*n*n+b2wlwt10*z0wl10*z0wl10-a2wlwt10*b2wlwt10)/(a2wlwt10*m*m+b2wlwt10);
    if((pwlwt10*pwlwt10/4.0)-qwlwt10<0){
    t2w1lwt10=t1+2.0;
    }else{
        zw1lwt10=-pwlwt10/2.0+sqrt((pwlwt10*pwlwt10/4.0)-qwlwt10);
        zw2lwt10=-pwlwt10/2.0-sqrt((pwlwt10*pwlwt10/4.0)-qwlwt10);
        t2w1lwt10=(zw1lwt10-z)/vz;
        t2w2lwt10=(zw2lwt10-z)/vz;
        if(t2w1lwt10<1e-15)
        t2w1lwt10=t1+2.0;
        if(t2w2lwt10<1e-15)
        t2w2lwt10=t1+2.0;
        if(t2w2lwt10<t2w1lwt10)
        t2w1lwt10=t2w2lwt10;
        xintersecwlwt10=m*(vz*t2w1lwt10+z)+n;
        if (xintersecwlwt10<0){
        t2w1lwt10=t1+2.0;}
        }
  }

  if((loutwl10!=0 && linwl10==0) || (loutwl10==0 && linwl10!=0))
  {
    m=vx/vz;
    n=-m*z+x;
    pwl10=(2.0*m*n*pawl10+1.0)/(pawl10*m*m);
    qwl10=n*n/(m*m)-pbwl10/(pawl10*m*m);
    if(qwl10>0 && qwl10>(pwl10*pwl10/4)){
    t2w1l10=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1l10=(pbwl10-pawl10*x*x-z)/vz;
      }else{
      t2w1l10=t1+2.0;
      }
    }else{
      zw1l10=-pwl10/2.0+sqrt(pwl10*pwl10/4.0-qwl10);
      zw2l10=-pwl10/2.0-sqrt(pwl10*pwl10/4.0-qwl10);
      t2w1l10=(zw1l10-z)/vz;
      t2w2l10=(zw2l10-z)/vz;
      if(t2w1l10<1e-15)
      t2w1l10=t1+2.0;
      if(t2w2l10<1e-15)
      t2w2l10=t1+2.0;
      if(t2w2l10<t2w1l10)
      t2w1l10=t2w2l10;
    }
    }
    xintersecwl10=m*(vz*t2w1l10+z)+n;
    if (xintersecwl10<0){
    t2w1l10=t1+2.0;}
    pwlwt10=(2.0*m*n*pawlwt10+1.0)/(pawlwt10*m*m);
    qwlwt10=n*n/(m*m)-pbwlwt10/(pawlwt10*m*m);
    if(qwlwt10>0 && qwlwt10>(pwlwt10*pwlwt10/4)){
    t2w1lwt10=t1+2.0;
    }else{
    if(vx==0)
    {
      if(x>0){
      t2w1lwt10=(pbwlwt10-pawlwt10*x*x-z)/vz;
      }else{
      t2w1lwt10=t1+2.0;
      }
    }else{
      zw1lwt10=-pwlwt10/2.0+sqrt(pwlwt10*pwlwt10/4.0-qwlwt10);
      zw2lwt10=-pwlwt10/2.0-sqrt(pwlwt10*pwlwt10/4.0-qwlwt10);
      t2w1lwt10=(zw1lwt10-z)/vz;
      t2w2lwt10=(zw2lwt10-z)/vz;
      if(t2w1lwt10<1e-15)
      t2w1lwt10=t1+2.0;
      if(t2w2lwt10<1e-15)
      t2w2lwt10=t1+2.0;
      if(t2w2lwt10<t2w1lwt10)
      t2w1lwt10=t2w2lwt10;
    }
    xintersecwlwt10=m*(vz*t2w1lwt10+z)+n;
    if (xintersecwlwt10<0){
    t2w1lwt10=t1+2.0;}
  }
  }

  if(louthu10==0 && linhu10==0)
  {
  m=(h2u10-h1u10)/l;
  t2h1u10=(m*z+(h1u10)-y)/(vy-m*vz);
  t2h1uwt10=(m*z+(h1uwt10)-y)/(vy-m*vz);
  if(t2h1u10<1e-15)
  t2h1u10=t1+2.0;
  if(t2h1uwt10<1e-15)
  t2h1uwt10=t1+2.0;
  }


  if(louthu10!=0 && linhu10!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phu10=2.0*(a2hu10*m*n+b2hu10*z0hu10)/(a2hu10*m*m+b2hu10);
    qhu10=(a2hu10*n*n+b2hu10*z0hu10*z0hu10-a2hu10*b2hu10)/(a2hu10*m*m+b2hu10);
    if((phu10*phu10/4.0)-qhu10<0){
    t2h1u10=t1+2.0;
    }else{
        zh1u10=-phu10/2.0+sqrt((phu10*phu10/4.0)-qhu10);
        zh2u10=-phu10/2.0-sqrt((phu10*phu10/4.0)-qhu10);
        t2h1u10=(zh1u10-z)/vz;
        t2h2u10=(zh2u10-z)/vz;
        if(t2h1u10<1e-15)
        t2h1u10=t1+2.0;
        if(t2h2u10<1e-15)
        t2h2u10=t1+2.0;
        if(t2h2u10<t2h1u10)
        t2h1u10=t2h2u10;
        yintersechu10=m*(vz*t2h1u10+z)+n;
        if (yintersechu10<0){
        t2h1u10=t1+2.0;}
        }
    phuwt10=2.0*(a2huwt10*m*n+b2huwt10*z0hu10)/(a2huwt10*m*m+b2huwt10);
    qhuwt10=(a2huwt10*n*n+b2huwt10*z0hu10*z0hu10-a2huwt10*b2huwt10)/(a2huwt10*m*m+b2huwt10);
    if((phuwt10*phuwt10/4.0)-qhuwt10<0){
    t2h1uwt10=t1+2.0;
    }else{
        zh1uwt10=-phuwt10/2.0+sqrt((phuwt10*phuwt10/4.0)-qhuwt10);
        zh2uwt10=-phuwt10/2.0-sqrt((phuwt10*phuwt10/4.0)-qhuwt10);
        t2h1uwt10=(zh1uwt10-z)/vz;
        t2h2uwt10=(zh2uwt10-z)/vz;
        if(t2h1uwt10<1e-15)
        t2h1uwt10=t1+2.0;
        if(t2h2uwt10<1e-15)
        t2h2uwt10=t1+2.0;
        if(t2h2uwt10<t2h1uwt10)
        t2h1uwt10=t2h2uwt10;
        yintersechuwt10=m*(vz*t2h1uwt10+z)+n;
        if (yintersechuwt10<0){
        t2h1uwt10=t1+2.0;}
        }
  }


  if((louthu10!=0 && linhu10==0)|| (louthu10==0 && linhu10!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phu10=(2.0*m*n*pahu10+1.0)/(pahu10*m*m);	
    qhu10=n*n/(m*m)-pbhu10/(pahu10*m*m);
    if(qhu10>0 && qhu10>(phu10*phu10/4)){
    t2h1u10=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1u10=(pbhu10-pahu10*y*y-z)/vz;
      }else{
      t2h1u10=t1+2.0;
      }
    }else{
      zh1u10=-phu10/2.0+sqrt(phu10*phu10/4.0-qhu10);
      zh2u10=-phu10/2.0-sqrt(phu10*phu10/4.0-qhu10);
      t2h1u10=(zh1u10-z)/vz;
      t2h2u10=(zh2u10-z)/vz;
      if(t2h1u10<1e-15)
      t2h1u10=t1+2.0;
      if(t2h2u10<1e-15)
      t2h2u10=t1+2.0;
      if(t2h2u10<t2h1u10)
      t2h1u10=t2h2u10;
    }
    yintersechu10=m*(vz*t2h1u10+z)+n;
    if (yintersechu10<0){
    t2h1u10=t1+2.0;}
  }
    phuwt10=(2.0*m*n*pahuwt10+1.0)/(pahuwt10*m*m);						
    qhuwt10=n*n/(m*m)-pbhuwt10/(pahuwt10*m*m);
    if(qhuwt10>0 && qhuwt10>(phuwt10*phuwt10/4)){
    t2h1uwt10=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y>0){
      t2h1uwt10=(pbhuwt10-pahuwt10*y*y-z)/vz;
      }else{
      t2h1uwt10=t1+2.0;
      }
    }else{
      zh1uwt10=-phuwt10/2.0+sqrt(phuwt10*phuwt10/4.0-qhuwt10);
      zh2uwt10=-phuwt10/2.0-sqrt(phuwt10*phuwt10/4.0-qhuwt10);
      t2h1uwt10=(zh1uwt10-z)/vz;
      t2h2uwt10=(zh2uwt10-z)/vz;
      if(t2h1uwt10<1e-15)
      t2h1uwt10=t1+2.0;
      if(t2h2uwt10<1e-15)
      t2h2uwt10=t1+2.0;
      if(t2h2uwt10<t2h1uwt10)
      t2h1uwt10=t2h2uwt10;
    }
    yintersechuwt10=m*(vz*t2h1uwt10+z)+n;
    if (yintersechuwt10<0){
    t2h1uwt10=t1+2.0;}
  }
  }

  if(louthd10==0 && linhd10==0)
  {
  m=(-h2d10+h1d10)/l;
  t2h1d10=(m*z+(-h1d10)-y)/(vy-m*vz);
  t2h1dwt10=(m*z+(-h1dwt10)-y)/(vy-m*vz);
  if(t2h1d10<1e-15)
  t2h1d10=t1+2.0;
  if(t2h1dwt10<1e-15)
  t2h1dwt10=t1+2.0;
  }

  if(louthd10!=0 && linhd10!=0)
  { 
    m=vy/vz;
    n=-m*z+y;
    phd10=2.0*(a2hd10*m*n+b2hd10*z0hd10)/(a2hd10*m*m+b2hd10);
    qhd10=(a2hd10*n*n+b2hd10*z0hd10*z0hd10-a2hd10*b2hd10)/(a2hd10*m*m+b2hd10);
    if((phd10*phd10/4.0)-qhd10<0){
    t2h1d10=t1+2.0;
    }else{
        zh1d10=-phd10/2.0+sqrt((phd10*phd10/4.0)-qhd10);
        zh2d10=-phd10/2.0-sqrt((phd10*phd10/4.0)-qhd10);
        t2h1d10=(zh1d10-z)/vz;
        t2h2d10=(zh2d10-z)/vz;
        if(t2h1d10<1e-15)
        t2h1d10=t1+2.0;
        if(t2h2d10<1e-15)
        t2h2d10=t1+2.0;
        if(t2h2d10<t2h1d10)
        t2h1d10=t2h2d10;
        yintersechd10=m*(vz*t2h1d10+z)+n;
        if (yintersechd10>0){
        t2h1d10=t1+2.0;}
        }
    phdwt10=2.0*(a2hdwt10*m*n+b2hdwt10*z0hd10)/(a2hdwt10*m*m+b2hdwt10);
    qhdwt10=(a2hdwt10*n*n+b2hdwt10*z0hd10*z0hd10-a2hdwt10*b2hdwt10)/(a2hdwt10*m*m+b2hdwt10);
    if((phdwt10*phdwt10/4.0)-qhdwt10<0){
    t2h1dwt10=t1+2.0;
    }else{
        zh1dwt10=-phdwt10/2.0+sqrt((phdwt10*phdwt10/4.0)-qhdwt10);
        zh2dwt10=-phdwt10/2.0-sqrt((phdwt10*phdwt10/4.0)-qhdwt10);
        t2h1dwt10=(zh1dwt10-z)/vz;
        t2h2dwt10=(zh2dwt10-z)/vz;
        if(t2h1dwt10<1e-15)
        t2h1dwt10=t1+2.0;
        if(t2h2dwt10<1e-15)
        t2h2dwt10=t1+2.0;
        if(t2h2dwt10<t2h1dwt10)
        t2h1dwt10=t2h2dwt10;
        yintersechdwt10=m*(vz*t2h1dwt10+z)+n;
        if (yintersechdwt10>0){
        t2h1dwt10=t1+2.0;}
        }
  }

  if((louthd10!=0 && linhd10==0)|| (louthd10==0 && linhd10!=0))
  {
    m=vy/vz;
    n=-m*z+y;
    phd10=(2.0*m*n*pahd10+1.0)/(pahd10*m*m);
    qhd10=n*n/(m*m)-pbhd10/(pahd10*m*m);
    if(qhd10>0 && qhd10>(phd10*phd10/4)){
    t2h1d10=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1d10=(pbhd10-pahd10*y*y-z)/vz;
      }else{
      t2h1d10=t1+2.0;
      }
    }else{
      zh1d10=-phd10/2.0+sqrt(phd10*phd10/4.0-qhd10);
      zh2d10=-phd10/2.0-sqrt(phd10*phd10/4.0-qhd10);
      t2h1d10=(zh1d10-z)/vz;
      t2h2d10=(zh2d10-z)/vz;
      if(t2h1d10<1e-15)
      t2h1d10=t1+2.0;
      if(t2h2d10<1e-15)
      t2h2d10=t1+2.0;
      if(t2h2d10<t2h1d10)
      t2h1d10=t2h2d10;
    }
    yintersechd10=m*(vz*t2h1d10+z)+n;
    if (yintersechd10>0){
    t2h1d10=t1+2.0;}
  }
    phdwt10=(2.0*m*n*pahdwt10+1.0)/(pahdwt10*m*m);
    qhdwt10=n*n/(m*m)-pbhdwt10/(pahdwt10*m*m);
    if(qhdwt10>0 && qhdwt10>(phdwt10*phdwt10/4)){
    t2h1dwt10=t1+2.0;
    }else{
    if(vy==0)
    {
      if(y<0){
      t2h1dwt10=(pbhdwt10-pahdwt10*y*y-z)/vz;
      }else{
      t2h1dwt10=t1+2.0;
      }
    }else{
      zh1dwt10=-phdwt10/2.0+sqrt(phdwt10*phdwt10/4.0-qhdwt10);
      zh2dwt10=-phdwt10/2.0-sqrt(phdwt10*phdwt10/4.0-qhdwt10);
      t2h1dwt10=(zh1dwt10-z)/vz;
      t2h2dwt10=(zh2dwt10-z)/vz;
      if(t2h1dwt10<1e-15)
      t2h1dwt10=t1+2.0;
      if(t2h2dwt10<1e-15)
      t2h2dwt10=t1+2.0;
      if(t2h2dwt10<t2h1dwt10)
      t2h1dwt10=t2h2dwt10;
    }
    yintersechdwt10=m*(vz*t2h1dwt10+z)+n;
    if (yintersechdwt10>0){
    t2h1dwt10=t1+2.0;}
  }
  }


													/* TEST OF THE INNER INTERSECTION - TIMES */
													/* possible interactions outside the guide have to be eliminated*/

if(t2w1r<t1+2.0){											/* test of RIGHT INNER wall interaction time*/
if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1r+z)-h1d;								/* calculation of the lower y-limit given by a linear bottom wall and the interaction time*/
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1r+z))*(z0hd+(vz*t2w1r+z)))/a2hd);				/* calculation of the lower y-limit given by a elliptic bottom wall and the interaction time*/
      }else{
      ylimitd=-sqrt(((vz*t2w1r+z)-pbhd)/-pahd);							/* calculation of the lower y-limit given by a parabolic bottom wall and the interaction time*/
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1r+z)+h1u;								/* calculation of the upper y-limit given by a linear top wall and the interaction time*/
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1r+z))*(z0hu+(vz*t2w1r+z)))/a2hu);				/* calculation of the upper y-limit given by a elliptic top wall and the interaction time*/
     }else{
     ylimitu=sqrt(((vz*t2w1r+z)-pbhu)/-pahu);							/* calculation of the upper y-limit given by a parabolic top wall and the interaction time*/
    }
    }
  ytest=vy*t2w1r+y;											/* calculation of the y coordinate of the neutron at the interaction time */
  if (ytest<ylimitd || ytest>ylimitu){									/* if the neutron is below or above the outer bottom or top wall of the guide NO interaction is possible!*/
  t2w1r=t1+2.0;
  }
  }


if(t2w1l<t1+2.0){											/* test of LEFT INNER wall interaction time - analog to right wall*/
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1l+z)-h1d;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1l+z))*(z0hd+(vz*t2w1l+z)))/a2hd);
      }else{
      ylimitd=-sqrt(((vz*t2w1l+z)-pbhd)/-pahd);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1l+z)+h1u;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1l+z))*(z0hu+(vz*t2w1l+z)))/a2hu);
     }else{
     ylimitu=sqrt(((vz*t2w1l+z)-pbhu)/-pahu);
    }
    }
  ytest=vy*t2w1l+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l=t1+2.0;
  }
  }

if(t2h1u<t1+2.0){											/* test of TOP INNER wall interaction time - analog to right wall*/
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1u+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1u+z))*(z0wr+(vz*t2h1u+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1u+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1u+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1u+z))*(z0wl+(vz*t2h1u+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1u+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1u+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u=t1+2.0;
  }
  }


if(t2h1d<t1+2.0){											/* test of BOTTOM INNER wall interaction time - analog to right wall*/
if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1d+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1d+z))*(z0wr+(vz*t2h1d+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1d+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1d+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1d+z))*(z0wl+(vz*t2h1d+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1d+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1d+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d=t1+2.0;
  }
  }


													/* TEST OF THE OUTER INTERSECTION - TIMES */

if(t2w1rwt<t1+2.0){											/* test of RIGHT OUTER wall interaction time - analog inner wall*/
if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1rwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1rwt+z))*(z0hd+(vz*t2w1rwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1rwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1rwt+z))*(z0hu+(vz*t2w1rwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1rwt+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt=t1+2.0;
  }
  }


if(t2w1lwt<t1+2.0){											/* test of LEFT OUTER wall interaction time - analog inner wall*/
if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1lwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1lwt+z))*(z0hd+(vz*t2w1lwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1lwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1lwt+z))*(z0hu+(vz*t2w1lwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1lwt+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt=t1+2.0;
  }
  }

if(t2h1uwt<t1+2.0){											/* test of TOP OUTER wall interaction time - analog inner wall*/
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1uwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1uwt+z))*(z0wr+(vz*t2h1uwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1uwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1uwt+z))*(z0wl+(vz*t2h1uwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1uwt+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt=t1+2.0;
  }
  }


if(t2h1dwt<t1+2.0){											/* test of BOTTOM OUTER wall interaction time - analog inner wall*/
if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1dwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1dwt+z))*(z0wr+(vz*t2h1dwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1dwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1dwt+z))*(z0wl+(vz*t2h1dwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1dwt+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt=t1+2.0;
  }
  }


								/*         INTERACTION OF FIRST SHELL                  */


									/* test INNER wall interaction time*/


if(t2w1r1<t1+2.0){
if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1r1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1r1+z))*(z0hd1+(vz*t2w1r1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1r1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1r1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1r1+z))*(z0hu1+(vz*t2w1r1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1r1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1r1+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r1=t1+2.0;
  }
  }


if(t2w1l1<t1+2.0){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1l1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1l1+z))*(z0hd1+(vz*t2w1l1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1l1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1l1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1l1+z))*(z0hu1+(vz*t2w1l1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1l1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1l1+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l1=t1+2.0;
  }
  }

if(t2h1u1<t1+2.0){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1u1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1u1+z))*(z0wr1+(vz*t2h1u1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1u1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1u1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1u1+z))*(z0wl1+(vz*t2h1u1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1u1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1u1+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u1=t1+2.0;
  }
  }


if(t2h1d1<t1+2.0){
if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1d1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1d1+z))*(z0wr1+(vz*t2h1d1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1d1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1d1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1d1+z))*(z0wl1+(vz*t2h1d1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1d1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1d1+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d1=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt1<t1+2.0){
if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1rwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1rwt1+z))*(z0hd1+(vz*t2w1rwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1rwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1rwt1+z))*(z0hu1+(vz*t2w1rwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1rwt1+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt1=t1+2.0;
  }
  }


if(t2w1lwt1<t1+2.0){
if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1lwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1lwt1+z))*(z0hd1+(vz*t2w1lwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1lwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1lwt1+z))*(z0hu1+(vz*t2w1lwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1lwt1+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt1=t1+2.0;
  }
  }

if(t2h1uwt1<t1+2.0){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1uwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1uwt1+z))*(z0wr1+(vz*t2h1uwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1uwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1uwt1+z))*(z0wl1+(vz*t2h1uwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1uwt1+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt1=t1+2.0;
  }
  }


if(t2h1dwt1<t1+2.0){
if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1dwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1dwt1+z))*(z0wr1+(vz*t2h1dwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1dwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1dwt1+z))*(z0wl1+(vz*t2h1dwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1dwt1+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt1=t1+2.0;
  }
  }

								/* INTERACTION SECOND SHELL */

									/* test INNER wall interaction time*/


if(t2w1r2<t1+2.0){
if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1r2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1r2+z))*(z0hd2+(vz*t2w1r2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1r2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1r2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1r2+z))*(z0hu2+(vz*t2w1r2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1r2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1r2+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r2=t1+2.0;
  }
  }


if(t2w1l2<t1+2.0){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1l2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1l2+z))*(z0hd2+(vz*t2w1l2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1l2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1l2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1l2+z))*(z0hu2+(vz*t2w1l2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1l2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1l2+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l2=t1+2.0;
  }
  }

if(t2h1u2<t1+2.0){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1u2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1u2+z))*(z0wr2+(vz*t2h1u2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1u2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1u2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1u2+z))*(z0wl2+(vz*t2h1u2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1u2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1u2+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u2=t1+2.0;
  }
  }


if(t2h1d2<t1+2.0){
if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1d2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1d2+z))*(z0wr2+(vz*t2h1d2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1d2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1d2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1d2+z))*(z0wl2+(vz*t2h1d2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1d2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1d2+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d2=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt2<t1+2.0){
if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1rwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1rwt2+z))*(z0hd2+(vz*t2w1rwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1rwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1rwt2+z))*(z0hu2+(vz*t2w1rwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1rwt2+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt2=t1+2.0;
  }
  }


if(t2w1lwt2<t1+2.0){
if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1lwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1lwt2+z))*(z0hd2+(vz*t2w1lwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1lwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1lwt2+z))*(z0hu2+(vz*t2w1lwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1lwt2+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt2=t1+2.0;
  }
  }

if(t2h1uwt2<t1+2.0){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1uwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1uwt2+z))*(z0wr2+(vz*t2h1uwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1uwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1uwt2+z))*(z0wl2+(vz*t2h1uwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1uwt2+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt2=t1+2.0;
  }
  }


if(t2h1dwt2<t1+2.0){
if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1dwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1dwt2+z))*(z0wr2+(vz*t2h1dwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1dwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1dwt2+z))*(z0wl2+(vz*t2h1dwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1dwt2+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt2=t1+2.0;
  }
  }


									/* TEST THIRD SHELL*/


if(t2w1r3<t1+2.0){
if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1r3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1r3+z))*(z0hd3+(vz*t2w1r3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1r3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1r3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1r3+z))*(z0hu3+(vz*t2w1r3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1r3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1r3+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r3=t1+2.0;
  }
  }


if(t2w1l3<t1+2.0){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1l3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1l3+z))*(z0hd3+(vz*t2w1l3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1l3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1l3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1l3+z))*(z0hu3+(vz*t2w1l3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1l3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1l3+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l3=t1+2.0;
  }
  }

if(t2h1u3<t1+2.0){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1u3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1u3+z))*(z0wr3+(vz*t2h1u3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1u3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1u3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1u3+z))*(z0wl3+(vz*t2h1u3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1u3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1u3+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u3=t1+2.0;
  }
  }


if(t2h1d3<t1+2.0){
if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1d3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1d3+z))*(z0wr3+(vz*t2h1d3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1d3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1d3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1d3+z))*(z0wl3+(vz*t2h1d3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1d3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1d3+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d3=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt3<t1+2.0){
if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1rwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1rwt3+z))*(z0hd3+(vz*t2w1rwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1rwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1rwt3+z))*(z0hu3+(vz*t2w1rwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1rwt3+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt3=t1+2.0;
  }
  }


if(t2w1lwt3<t1+2.0){
if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1lwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1lwt3+z))*(z0hd3+(vz*t2w1lwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1lwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1lwt3+z))*(z0hu3+(vz*t2w1lwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1lwt3+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt3=t1+2.0;
  }
  }

if(t2h1uwt3<t1+2.0){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1uwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1uwt3+z))*(z0wr3+(vz*t2h1uwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1uwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1uwt3+z))*(z0wl3+(vz*t2h1uwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1uwt3+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt3=t1+2.0;
  }
  }


if(t2h1dwt3<t1+2.0){
if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1dwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1dwt3+z))*(z0wr3+(vz*t2h1dwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1dwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1dwt3+z))*(z0wl3+(vz*t2h1dwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1dwt3+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt3=t1+2.0;
  }
  }

											/*  FOURTH SHELL */


if(t2w1r4<t1+2.0){
if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1r4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1r4+z))*(z0hd4+(vz*t2w1r4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1r4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1r4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1r4+z))*(z0hu4+(vz*t2w1r4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1r4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1r4+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r4=t1+2.0;
  }
  }


if(t2w1l4<t1+2.0){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1l4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1l4+z))*(z0hd4+(vz*t2w1l4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1l4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1l4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1l4+z))*(z0hu4+(vz*t2w1l4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1l4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1l4+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l4=t1+2.0;
  }
  }

if(t2h1u4<t1+2.0){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1u4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1u4+z))*(z0wr4+(vz*t2h1u4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1u4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1u4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1u4+z))*(z0wl4+(vz*t2h1u4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1u4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1u4+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u4=t1+2.0;
  }
  }


if(t2h1d4<t1+2.0){
if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1d4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1d4+z))*(z0wr4+(vz*t2h1d4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1d4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1d4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1d4+z))*(z0wl4+(vz*t2h1d4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1d4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1d4+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d4=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt4<t1+2.0){
if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1rwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1rwt4+z))*(z0hd4+(vz*t2w1rwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1rwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1rwt4+z))*(z0hu4+(vz*t2w1rwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1rwt4+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt4=t1+2.0;
  }
  }


if(t2w1lwt4<t1+2.0){
if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1lwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1lwt4+z))*(z0hd4+(vz*t2w1lwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1lwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1lwt4+z))*(z0hu4+(vz*t2w1lwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1lwt4+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt4=t1+2.0;
  }
  }

if(t2h1uwt4<t1+2.0){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1uwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1uwt4+z))*(z0wr4+(vz*t2h1uwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1uwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1uwt4+z))*(z0wl4+(vz*t2h1uwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1uwt4+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt4=t1+2.0;
  }
  }


if(t2h1dwt4<t1+2.0){
if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1dwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1dwt4+z))*(z0wr4+(vz*t2h1dwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1dwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1dwt4+z))*(z0wl4+(vz*t2h1dwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1dwt4+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt4=t1+2.0;
  }
  }

						/*        FIFTH SHELL          */


									/* test INNER wall interaction time*/


if(t2w1r5<t1+2.0){
if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1r5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1r5+z))*(z0hd5+(vz*t2w1r5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1r5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1r5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1r5+z))*(z0hu5+(vz*t2w1r5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1r5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1r5+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r5=t1+2.0;
  }
  }


if(t2w1l5<t1+2.0){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1l5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1l5+z))*(z0hd5+(vz*t2w1l5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1l5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1l5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1l5+z))*(z0hu5+(vz*t2w1l5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1l5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1l5+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l5=t1+2.0;
  }
  }

if(t2h1u5<t1+2.0){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1u5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1u5+z))*(z0wr5+(vz*t2h1u5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1u5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1u5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1u5+z))*(z0wl5+(vz*t2h1u5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1u5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1u5+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u5=t1+2.0;
  }
  }


if(t2h1d5<t1+2.0){
if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1d5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1d5+z))*(z0wr5+(vz*t2h1d5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1d5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1d5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1d5+z))*(z0wl5+(vz*t2h1d5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1d5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1d5+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d5=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt5<t1+2.0){
if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1rwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1rwt5+z))*(z0hd5+(vz*t2w1rwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1rwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1rwt5+z))*(z0hu5+(vz*t2w1rwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1rwt5+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt5=t1+2.0;
  }
  }


if(t2w1lwt5<t1+2.0){
if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1lwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1lwt5+z))*(z0hd5+(vz*t2w1lwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1lwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1lwt5+z))*(z0hu5+(vz*t2w1lwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1lwt5+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt5=t1+2.0;
  }
  }

if(t2h1uwt5<t1+2.0){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1uwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1uwt5+z))*(z0wr5+(vz*t2h1uwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1uwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1uwt5+z))*(z0wl5+(vz*t2h1uwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1uwt5+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt5=t1+2.0;
  }
  }


if(t2h1dwt5<t1+2.0){
if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1dwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1dwt5+z))*(z0wr5+(vz*t2h1dwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1dwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1dwt5+z))*(z0wl5+(vz*t2h1dwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1dwt5+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt5=t1+2.0;
  }
  }


											/*   SIXT SHELL   */

									/* test INNER wall interaction time*/


if(t2w1r6<t1+2.0){
if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1r6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1r6+z))*(z0hd6+(vz*t2w1r6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1r6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1r6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1r6+z))*(z0hu6+(vz*t2w1r6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1r6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1r6+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r6=t1+2.0;
  }
  }


if(t2w1l6<t1+2.0){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1l6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1l6+z))*(z0hd6+(vz*t2w1l6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1l6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1l6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1l6+z))*(z0hu6+(vz*t2w1l6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1l6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1l6+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l6=t1+2.0;
  }
  }

if(t2h1u6<t1+2.0){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1u6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1u6+z))*(z0wr6+(vz*t2h1u6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1u6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1u6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1u6+z))*(z0wl6+(vz*t2h1u6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1u6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1u6+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u6=t1+2.0;
  }
  }


if(t2h1d6<t1+2.0){
if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1d6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1d6+z))*(z0wr6+(vz*t2h1d6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1d6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1d6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1d6+z))*(z0wl6+(vz*t2h1d6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1d6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1d6+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d6=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt6<t1+2.0){
if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1rwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1rwt6+z))*(z0hd6+(vz*t2w1rwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1rwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1rwt6+z))*(z0hu6+(vz*t2w1rwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1rwt6+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt6=t1+2.0;
  }
  }


if(t2w1lwt6<t1+2.0){
if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1lwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1lwt6+z))*(z0hd6+(vz*t2w1lwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1lwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1lwt6+z))*(z0hu6+(vz*t2w1lwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1lwt6+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt6=t1+2.0;
  }
  }

if(t2h1uwt6<t1+2.0){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1uwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1uwt6+z))*(z0wr6+(vz*t2h1uwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1uwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1uwt6+z))*(z0wl6+(vz*t2h1uwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1uwt6+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt6=t1+2.0;
  }
  }


if(t2h1dwt6<t1+2.0){
if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1dwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1dwt6+z))*(z0wr6+(vz*t2h1dwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1dwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1dwt6+z))*(z0wl6+(vz*t2h1dwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1dwt6+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt6=t1+2.0;
  }
  }

									/* SEVENTH SHELL */

									/* test INNER wall interaction time*/


if(t2w1r7<t1+2.0){
if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1r7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1r7+z))*(z0hd7+(vz*t2w1r7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1r7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1r7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1r7+z))*(z0hu7+(vz*t2w1r7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1r7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1r7+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r7=t1+2.0;
  }
  }


if(t2w1l7<t1+2.0){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1l7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1l7+z))*(z0hd7+(vz*t2w1l7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1l7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1l7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1l7+z))*(z0hu7+(vz*t2w1l7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1l7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1l7+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l7=t1+2.0;
  }
  }

if(t2h1u7<t1+2.0){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1u7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1u7+z))*(z0wr7+(vz*t2h1u7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1u7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1u7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1u7+z))*(z0wl7+(vz*t2h1u7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1u7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1u7+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u7=t1+2.0;
  }
  }


if(t2h1d7<t1+2.0){
if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1d7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1d7+z))*(z0wr7+(vz*t2h1d7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1d7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1d7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1d7+z))*(z0wl7+(vz*t2h1d7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1d7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1d7+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d7=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt7<t1+2.0){
if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1rwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1rwt7+z))*(z0hd7+(vz*t2w1rwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1rwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1rwt7+z))*(z0hu7+(vz*t2w1rwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1rwt7+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt7=t1+2.0;
  }
  }


if(t2w1lwt7<t1+2.0){
if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1lwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1lwt7+z))*(z0hd7+(vz*t2w1lwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1lwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1lwt7+z))*(z0hu7+(vz*t2w1lwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1lwt7+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt7=t1+2.0;
  }
  }

if(t2h1uwt7<t1+2.0){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1uwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1uwt7+z))*(z0wr7+(vz*t2h1uwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1uwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1uwt7+z))*(z0wl7+(vz*t2h1uwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1uwt7+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt7=t1+2.0;
  }
  }


if(t2h1dwt7<t1+2.0){
if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1dwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1dwt7+z))*(z0wr7+(vz*t2h1dwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1dwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1dwt7+z))*(z0wl7+(vz*t2h1dwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1dwt7+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt7=t1+2.0;
  }
  }

									/*	EIGHTH SHELL	*/

									/* test INNER wall interaction time*/


if(t2w1r8<t1+2.0){
if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1r8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1r8+z))*(z0hd8+(vz*t2w1r8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1r8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1r8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1r8+z))*(z0hu8+(vz*t2w1r8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1r8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1r8+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r8=t1+2.0;
  }
  }


if(t2w1l8<t1+2.0){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1l8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1l8+z))*(z0hd8+(vz*t2w1l8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1l8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1l8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1l8+z))*(z0hu8+(vz*t2w1l8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1l8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1l8+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l8=t1+2.0;
  }
  }

if(t2h1u8<t1+2.0){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1u8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1u8+z))*(z0wr8+(vz*t2h1u8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1u8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1u8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1u8+z))*(z0wl8+(vz*t2h1u8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1u8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1u8+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u8=t1+2.0;
  }
  }


if(t2h1d8<t1+2.0){
if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1d8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1d8+z))*(z0wr8+(vz*t2h1d8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1d8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1d8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1d8+z))*(z0wl8+(vz*t2h1d8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1d8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1d8+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d8=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt8<t1+2.0){
if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1rwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1rwt8+z))*(z0hd8+(vz*t2w1rwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1rwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1rwt8+z))*(z0hu8+(vz*t2w1rwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1rwt8+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt8=t1+2.0;
  }
  }


if(t2w1lwt8<t1+2.0){
if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1lwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1lwt8+z))*(z0hd8+(vz*t2w1lwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1lwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1lwt8+z))*(z0hu8+(vz*t2w1lwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1lwt8+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt8=t1+2.0;
  }
  }

if(t2h1uwt8<t1+2.0){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1uwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1uwt8+z))*(z0wr8+(vz*t2h1uwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1uwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1uwt8+z))*(z0wl8+(vz*t2h1uwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1uwt8+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt8=t1+2.0;
  }
  }


if(t2h1dwt8<t1+2.0){
if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1dwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1dwt8+z))*(z0wr8+(vz*t2h1dwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1dwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1dwt8+z))*(z0wl8+(vz*t2h1dwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1dwt8+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt8=t1+2.0;
  }
  }

									/*	NINTH SHELL	*/

									/* test INNER wall interaction time*/


if(t2w1r9<t1+2.0){
if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1r9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1r9+z))*(z0hd9+(vz*t2w1r9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1r9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1r9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1r9+z))*(z0hu9+(vz*t2w1r9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1r9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1r9+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r9=t1+2.0;
  }
  }


if(t2w1l9<t1+2.0){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1l9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1l9+z))*(z0hd9+(vz*t2w1l9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1l9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1l9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1l9+z))*(z0hu9+(vz*t2w1l9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1l9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1l9+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l9=t1+2.0;
  }
  }

if(t2h1u9<t1+2.0){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1u9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1u9+z))*(z0wr9+(vz*t2h1u9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1u9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1u9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1u9+z))*(z0wl9+(vz*t2h1u9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1u9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1u9+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u9=t1+2.0;
  }
  }


if(t2h1d9<t1+2.0){
if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1d9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1d9+z))*(z0wr9+(vz*t2h1d9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1d9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1d9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1d9+z))*(z0wl9+(vz*t2h1d9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1d9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1d9+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d9=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt9<t1+2.0){
if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1rwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1rwt9+z))*(z0hd9+(vz*t2w1rwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1rwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1rwt9+z))*(z0hu9+(vz*t2w1rwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1rwt9+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt9=t1+2.0;
  }
  }


if(t2w1lwt9<t1+2.0){
if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1lwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1lwt9+z))*(z0hd9+(vz*t2w1lwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1lwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1lwt9+z))*(z0hu9+(vz*t2w1lwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1lwt9+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt9=t1+2.0;
  }
  }

if(t2h1uwt9<t1+2.0){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1uwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1uwt9+z))*(z0wr9+(vz*t2h1uwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1uwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1uwt9+z))*(z0wl9+(vz*t2h1uwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1uwt9+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt9=t1+2.0;
  }
  }


if(t2h1dwt9<t1+2.0){
if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1dwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1dwt9+z))*(z0wr9+(vz*t2h1dwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1dwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1dwt9+z))*(z0wl9+(vz*t2h1dwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1dwt9+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt9=t1+2.0;
  }
  }

								/*	TENTH SHELL */

									/* test INNER wall interaction time*/


if(t2w1r10<t1+2.0){
if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1r10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1r10+z))*(z0hd10+(vz*t2w1r10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1r10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1r10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1r10+z))*(z0hu10+(vz*t2w1r10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1r10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1r10+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1r10=t1+2.0;
  }
  }


if(t2w1l10<t1+2.0){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1l10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1l10+z))*(z0hd10+(vz*t2w1l10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1l10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1l10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1l10+z))*(z0hu10+(vz*t2w1l10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1l10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1l10+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1l10=t1+2.0;
  }
  }

if(t2h1u10<t1+2.0){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1u10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1u10+z))*(z0wr10+(vz*t2h1u10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1u10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1u10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1u10+z))*(z0wl10+(vz*t2h1u10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1u10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1u10+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1u10=t1+2.0;
  }
  }


if(t2h1d10<t1+2.0){
if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1d10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1d10+z))*(z0wr10+(vz*t2h1d10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1d10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1d10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1d10+z))*(z0wl10+(vz*t2h1d10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1d10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1d10+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1d10=t1+2.0;
  }
  }


							/* TEST OF THE OUTER INTERSECTION - TIMES */



if(t2w1rwt10<t1+2.0){
if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1rwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1rwt10+z))*(z0hd10+(vz*t2w1rwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1rwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1rwt10+z))*(z0hu10+(vz*t2w1rwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1rwt10+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1rwt10=t1+2.0;
  }
  }


if(t2w1lwt10<t1+2.0){
if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1lwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1lwt10+z))*(z0hd10+(vz*t2w1lwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1lwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1lwt10+z))*(z0hu10+(vz*t2w1lwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1lwt10+y;
  if (ytest<ylimitd || ytest>ylimitu){
  t2w1lwt10=t1+2.0;
  }
  }

if(t2h1uwt10<t1+2.0){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1uwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1uwt10+z))*(z0wr10+(vz*t2h1uwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1uwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1uwt10+z))*(z0wl10+(vz*t2h1uwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1uwt10+x;
  if (xtest<xlimitr || xtest>xlimitl){
  t2h1uwt10=t1+2.0;
  }
  }


if(t2h1dwt10<t1+2.0){
if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1dwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1dwt10+z))*(z0wr10+(vz*t2h1dwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1dwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1dwt10+z))*(z0wl10+(vz*t2h1dwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1dwt10+x;
  if (xtest<xlimitr || xtest>xlimitl)
  {
  t2h1dwt10=t1+2.0;
  }
  }



/* printf("t1 = %f \n",t1);
printf("t2w1r = %f \n",t2w1r);
printf("t2w1l = %f \n",t2w1l);
printf("t2h1u = %f \n",t2h1u);
printf("t2h1d = %f \n",t2h1d);
*/
/*
 printf("t1 = %f \n",t1);
printf("t2w1rwt = %f \n",t2w1rwt);
printf("t2w1lwt = %f \n",t2w1lwt);
printf("t2h1uwt = %f \n",t2h1uwt);
printf("t2h1dwt = %f \n",t2h1dwt);
*/

/*
printf("t2w1r1 = %f \n",t2w1r1);
printf("t2w1l1 = %f \n",t2w1l1);
printf("t2h1u1 = %f \n",t2h1u1);
printf("t2h1d1 = %f \n",t2h1d1);
*/

/*
printf("vx = %f \n",vx);
printf("x = %f \n",x); */

/*printf("mxr = %f \n", mxr);
printf("mxl = %f \n", mxl);
printf("myu = %f \n", myu);
printf("myd = %f \n", myd);*/

																				/* which wall is hit first? which geometry? */

  if (t1 < t2w1r && t1 < t2w1l && t1 < t2h1u && t1 < t2h1d && t1 < t2w1rwt && t1 < t2w1lwt && t1 < t2h1uwt && t1 < t2h1dwt && t1 < t2w1r1 && t1 < t2w1l1 && t1 < t2h1u1 && t1 < t2h1d1 && t1 < t2w1rwt1 && t1 < t2w1lwt1 && t1 < t2h1uwt1 && t1 < t2h1dwt1 && t1 < t2w1r2 && t1 < t2w1l2 && t1 < t2h1u2 && t1 < t2h1d2 && t1 < t2w1rwt2 && t1 < t2w1lwt2 && t1 < t2h1uwt2 && t1 < t2h1dwt2 && t1 < t2w1r3 && t1 < t2w1l3 && t1 < t2h1u3 && t1 < t2h1d3 && t1 < t2w1rwt3 && t1 < t2w1lwt3 && t1 < t2h1uwt3 && t1 < t2h1dwt3 && t1 < t2w1r4 && t1 < t2w1l4 && t1 < t2h1u4 && t1 < t2h1d4 && t1 < t2w1rwt4 && t1 < t2w1lwt4 && t1 < t2h1uwt4 && t1 < t2h1dwt4 && t1 < t2w1r5 && t1 < t2w1l5 && t1 < t2h1u5 && t1 < t2h1d5 && t1 < t2w1rwt5 && t1 < t2w1lwt5 && t1 < t2h1uwt5 && t1 < t2h1dwt5 && t1 < t2w1r6 && t1 < t2w1l6 && t1 < t2h1u6 && t1 < t2h1d6 && t1 < t2w1rwt6 && t1 < t2w1lwt6 && t1 < t2h1uwt6 && t1 < t2h1dwt6 && t1 < t2w1r7 && t1 < t2w1l7 && t1 < t2h1u7 && t1 < t2h1d7 && t1 < t2w1rwt7 && t1 < t2w1lwt7 && t1 < t2h1uwt7 && t1 < t2h1dwt7 && t1 < t2w1r8 && t1 < t2w1l8 && t1 < t2h1u8 && t1 < t2h1d8 && t1 < t2w1rwt8 && t1 < t2w1lwt8 && t1 < t2h1uwt8 && t1 < t2h1dwt8 && t1 < t2w1r9 && t1 < t2w1l9 && t1 < t2h1u9 && t1 < t2h1d9 && t1 < t2w1rwt9 && t1 < t2w1lwt9 && t1 < t2h1uwt9 && t1 < t2h1dwt9 && t1 < t2w1r10 && t1 < t2w1l10 && t1 < t2h1u10 && t1 < t2h1d10 && t1 < t2w1rwt10 && t1 < t2w1lwt10 && t1 < t2h1uwt10 && t1 < t2h1dwt10){
  i=1;
  }

													/* neutron interacts with the INNER elliptic right wall and this wall is NOT transparent*/

  if (mxr!=-1 && t2w1r > 0 && t2w1r < t1 
     && t2w1r < t2w1l && t2w1r < t2h1u && t2w1r < t2h1d && t2w1r < t2w1rwt && t2w1r < t2w1lwt && t2w1r < t2h1uwt && t2w1r < t2h1dwt
     && t2w1r < t2w1r1 && t2w1r < t2w1l1 && t2w1r < t2h1u1 && t2w1r < t2h1d1 && t2w1r < t2w1rwt1 && t2w1r < t2w1lwt1 && t2w1r < t2h1uwt1 && t2w1r < t2h1dwt1
     && t2w1r < t2w1r2 && t2w1r < t2w1l2 && t2w1r < t2h1u2 && t2w1r < t2h1d2 && t2w1r < t2w1rwt2 && t2w1r < t2w1lwt2 && t2w1r < t2h1uwt2 && t2w1r < t2h1dwt2 
     && t2w1r < t2w1r3 && t2w1r < t2w1l3 && t2w1r < t2h1u3 && t2w1r < t2h1d3 && t2w1r < t2w1rwt3 && t2w1r < t2w1lwt3 && t2w1r < t2h1uwt3 && t2w1r < t2h1dwt3
     && t2w1r < t2w1r4 && t2w1r < t2w1l4 && t2w1r < t2h1u4 && t2w1r < t2h1d4 && t2w1r < t2w1rwt4 && t2w1r < t2w1lwt4 && t2w1r < t2h1uwt4 && t2w1r < t2h1dwt4
     && t2w1r < t2w1r5 && t2w1r < t2w1l5 && t2w1r < t2h1u5 && t2w1r < t2h1d5 && t2w1r < t2w1rwt5 && t2w1r < t2w1lwt5 && t2w1r < t2h1uwt5 && t2w1r < t2h1dwt5
     && t2w1r < t2w1r6 && t2w1r < t2w1l6 && t2w1r < t2h1u6 && t2w1r < t2h1d6 && t2w1r < t2w1rwt6 && t2w1r < t2w1lwt6 && t2w1r < t2h1uwt6 && t2w1r < t2h1dwt6
     && t2w1r < t2w1r7 && t2w1r < t2w1l7 && t2w1r < t2h1u7 && t2w1r < t2h1d7 && t2w1r < t2w1rwt7 && t2w1r < t2w1lwt7 && t2w1r < t2h1uwt7 && t2w1r < t2h1dwt7
     && t2w1r < t2w1r8 && t2w1r < t2w1l8 && t2w1r < t2h1u8 && t2w1r < t2h1d8 && t2w1r < t2w1rwt8 && t2w1r < t2w1lwt8 && t2w1r < t2h1uwt8 && t2w1r < t2h1dwt8
     && t2w1r < t2w1r9 && t2w1r < t2w1l9 && t2w1r < t2h1u9 && t2w1r < t2h1d9 && t2w1r < t2w1rwt9 && t2w1r < t2w1lwt9 && t2w1r < t2h1uwt9 && t2w1r < t2h1dwt9
     && t2w1r < t2w1r10 && t2w1r < t2w1l10 && t2w1r < t2h1u10 && t2w1r < t2h1d10 && t2w1r < t2w1rwt10 && t2w1r < t2w1lwt10 && t2w1r < t2h1uwt10 && t2w1r < t2h1dwt10
     && ((linwr!=0) && (loutwr!=0) )) {	
    if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1r+z)-h1d;								/* calculation of the lower y-limit given by a linear INNER bottom wall and the interaction time*/
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1r+z))*(z0hd+(vz*t2w1r+z)))/a2hd);				/* calculation of the lower y-limit given by a elliptic INNER bottom wall and the interaction time*/
      }else{
      ylimitd=-sqrt(((vz*t2w1r+z)-pbhd)/-pahd);								/* calculation of the lower y-limit given by a parabolic INNER bottom wall and the interaction time*/
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1r+z)+h1u;								/* calculation of the upper y-limit given by a linear INNER top wall and the interaction time*/
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1r+z))*(z0hu+(vz*t2w1r+z)))/a2hu);				/* calculation of the upper y-limit given by a elliptic INNER top wall and the interaction time*/
     }else{
     ylimitu=sqrt(((vz*t2w1r+z)-pbhu)/-pahu);								/* calculation of the upper y-limit given by a parabolic INNER top wall and the interaction time*/
    }
    }
  ytest=vy*t2w1r+y;											/* calculation of y-coordinate of the neutron at the interaction time*/
  xlimitr=bwr*sqrt(1-((vz*t2w1r+z)+z0wr)*((vz*t2w1r+z)+z0wr)/a2wr);					/* calculation of right INNER limit given by a elliptic shape of the wall*/
  xtest=vx*t2w1r+x;											/* calculation of x-coordinate of the neutron at the interaction time*/
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr > 0){					/* only if the neutron is realy inside the guide (testet by the limits) and the wall is reflecting*/
  i=2;													/* the neutron will be reflected*/
  }else{
  i=18;													/* otherwise it will be absorbed*/
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr!=-1 && t2w1r > 0 && t2w1r < t1 
     && t2w1r < t2w1l && t2w1r < t2h1u && t2w1r < t2h1d && t2w1r < t2w1rwt && t2w1r < t2w1lwt && t2w1r < t2h1uwt && t2w1r < t2h1dwt
     && t2w1r < t2w1r1 && t2w1r < t2w1l1 && t2w1r < t2h1u1 && t2w1r < t2h1d1 && t2w1r < t2w1rwt1 && t2w1r < t2w1lwt1 && t2w1r < t2h1uwt1 && t2w1r < t2h1dwt1
     && t2w1r < t2w1r2 && t2w1r < t2w1l2 && t2w1r < t2h1u2 && t2w1r < t2h1d2 && t2w1r < t2w1rwt2 && t2w1r < t2w1lwt2 && t2w1r < t2h1uwt2 && t2w1r < t2h1dwt2 
     && t2w1r < t2w1r3 && t2w1r < t2w1l3 && t2w1r < t2h1u3 && t2w1r < t2h1d3 && t2w1r < t2w1rwt3 && t2w1r < t2w1lwt3 && t2w1r < t2h1uwt3 && t2w1r < t2h1dwt3
     && t2w1r < t2w1r4 && t2w1r < t2w1l4 && t2w1r < t2h1u4 && t2w1r < t2h1d4 && t2w1r < t2w1rwt4 && t2w1r < t2w1lwt4 && t2w1r < t2h1uwt4 && t2w1r < t2h1dwt4
     && t2w1r < t2w1r5 && t2w1r < t2w1l5 && t2w1r < t2h1u5 && t2w1r < t2h1d5 && t2w1r < t2w1rwt5 && t2w1r < t2w1lwt5 && t2w1r < t2h1uwt5 && t2w1r < t2h1dwt5
     && t2w1r < t2w1r6 && t2w1r < t2w1l6 && t2w1r < t2h1u6 && t2w1r < t2h1d6 && t2w1r < t2w1rwt6 && t2w1r < t2w1lwt6 && t2w1r < t2h1uwt6 && t2w1r < t2h1dwt6
     && t2w1r < t2w1r7 && t2w1r < t2w1l7 && t2w1r < t2h1u7 && t2w1r < t2h1d7 && t2w1r < t2w1rwt7 && t2w1r < t2w1lwt7 && t2w1r < t2h1uwt7 && t2w1r < t2h1dwt7
     && t2w1r < t2w1r8 && t2w1r < t2w1l8 && t2w1r < t2h1u8 && t2w1r < t2h1d8 && t2w1r < t2w1rwt8 && t2w1r < t2w1lwt8 && t2w1r < t2h1uwt8 && t2w1r < t2h1dwt8
     && t2w1r < t2w1r9 && t2w1r < t2w1l9 && t2w1r < t2h1u9 && t2w1r < t2h1d9 && t2w1r < t2w1rwt9 && t2w1r < t2w1lwt9 && t2w1r < t2h1uwt9 && t2w1r < t2h1dwt9
     && t2w1r < t2w1r10 && t2w1r < t2w1l10 && t2w1r < t2h1u10 && t2w1r < t2h1d10 && t2w1r < t2w1rwt10 && t2w1r < t2w1lwt10 && t2w1r < t2h1uwt10 && t2w1r < t2h1dwt10
     && ((loutwr!=0 && linwr==0) || (loutwr==0 && linwr!=0))){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1r+z)-h1d;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1r+z))*(z0hd+(vz*t2w1r+z)))/a2hd);
      }else{
      ylimitd=-sqrt(((vz*t2w1r+z)-pbhd)/-pahd);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1r+z)+h1u;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1r+z))*(z0hu+(vz*t2w1r+z)))/a2hu);
     }else{
     ylimitu=sqrt(((vz*t2w1r+z)-pbhu)/-pahu);
    }
    }
  ytest=vy*t2w1r+y;
  xtest=vx*t2w1r+x;
  xlimitr=-sqrt(pbwr-(vz*t2w1r+z)/pawr);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr > 0){
  i=3;
  }else{
  i=18;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr!=-1 && t2w1r > 0 && t2w1r < t1 
     && t2w1r < t2w1l && t2w1r < t2h1u && t2w1r < t2h1d && t2w1r < t2w1rwt && t2w1r < t2w1lwt && t2w1r < t2h1uwt && t2w1r < t2h1dwt
     && t2w1r < t2w1r1 && t2w1r < t2w1l1 && t2w1r < t2h1u1 && t2w1r < t2h1d1 && t2w1r < t2w1rwt1 && t2w1r < t2w1lwt1 && t2w1r < t2h1uwt1 && t2w1r < t2h1dwt1
     && t2w1r < t2w1r2 && t2w1r < t2w1l2 && t2w1r < t2h1u2 && t2w1r < t2h1d2 && t2w1r < t2w1rwt2 && t2w1r < t2w1lwt2 && t2w1r < t2h1uwt2 && t2w1r < t2h1dwt2 
     && t2w1r < t2w1r3 && t2w1r < t2w1l3 && t2w1r < t2h1u3 && t2w1r < t2h1d3 && t2w1r < t2w1rwt3 && t2w1r < t2w1lwt3 && t2w1r < t2h1uwt3 && t2w1r < t2h1dwt3
     && t2w1r < t2w1r4 && t2w1r < t2w1l4 && t2w1r < t2h1u4 && t2w1r < t2h1d4 && t2w1r < t2w1rwt4 && t2w1r < t2w1lwt4 && t2w1r < t2h1uwt4 && t2w1r < t2h1dwt4
     && t2w1r < t2w1r5 && t2w1r < t2w1l5 && t2w1r < t2h1u5 && t2w1r < t2h1d5 && t2w1r < t2w1rwt5 && t2w1r < t2w1lwt5 && t2w1r < t2h1uwt5 && t2w1r < t2h1dwt5
     && t2w1r < t2w1r6 && t2w1r < t2w1l6 && t2w1r < t2h1u6 && t2w1r < t2h1d6 && t2w1r < t2w1rwt6 && t2w1r < t2w1lwt6 && t2w1r < t2h1uwt6 && t2w1r < t2h1dwt6
     && t2w1r < t2w1r7 && t2w1r < t2w1l7 && t2w1r < t2h1u7 && t2w1r < t2h1d7 && t2w1r < t2w1rwt7 && t2w1r < t2w1lwt7 && t2w1r < t2h1uwt7 && t2w1r < t2h1dwt7
     && t2w1r < t2w1r8 && t2w1r < t2w1l8 && t2w1r < t2h1u8 && t2w1r < t2h1d8 && t2w1r < t2w1rwt8 && t2w1r < t2w1lwt8 && t2w1r < t2h1uwt8 && t2w1r < t2h1dwt8
     && t2w1r < t2w1r9 && t2w1r < t2w1l9 && t2w1r < t2h1u9 && t2w1r < t2h1d9 && t2w1r < t2w1rwt9 && t2w1r < t2w1lwt9 && t2w1r < t2h1uwt9 && t2w1r < t2h1dwt9
     && t2w1r < t2w1r10 && t2w1r < t2w1l10 && t2w1r < t2h1u10 && t2w1r < t2h1d10 && t2w1r < t2w1rwt10 && t2w1r < t2w1lwt10 && t2w1r < t2h1uwt10 && t2w1r < t2h1dwt10
     && (loutwr==0 && linwr==0)){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1r+z)-h1d;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1r+z))*(z0hd+(vz*t2w1r+z)))/a2hd);
      }else{
      ylimitd=-sqrt(((vz*t2w1r+z)-pbhd)/-pahd);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1r+z)+h1u;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1r+z))*(z0hu+(vz*t2w1r+z)))/a2hu);
     }else{
     ylimitu=sqrt(((vz*t2w1r+z)-pbhu)/-pahu);
    }
    }
  ytest=vy*t2w1r+y;
  xtest=vx*t2w1r+x;
  xlimitr=-(w2r+w1r)*(vz*t2w1r+z)/l-w1r;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr>0){
  i=4;
  }else{
  i=18;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl!=-1 && t2w1l > 0 && t2w1l < t1 
      && t2w1l < t2w1r  && t2w1l < t2h1u && t2w1l < t2h1d && t2w1l < t2w1rwt && t2w1l < t2w1lwt && t2w1l < t2h1uwt && t2w1l < t2h1dwt
      && t2w1l < t2w1r1 && t2w1l < t2w1l1 && t2w1l < t2h1u1 && t2w1l < t2h1d1 && t2w1l < t2w1rwt1 && t2w1l < t2w1lwt1 && t2w1l < t2h1uwt1 && t2w1l < t2h1dwt1
      && t2w1l < t2w1r2 && t2w1l < t2w1l2 && t2w1l < t2h1u2 && t2w1l < t2h1d2 && t2w1l < t2w1rwt2 && t2w1l < t2w1lwt2 && t2w1l < t2h1uwt2 && t2w1l < t2h1dwt2
      && t2w1l < t2w1r3 && t2w1l < t2w1l3 && t2w1l < t2h1u3 && t2w1l < t2h1d3 && t2w1l < t2w1rwt3 && t2w1l < t2w1lwt3 && t2w1l < t2h1uwt3 && t2w1l < t2h1dwt3
      && t2w1l < t2w1r4 && t2w1l < t2w1l4 && t2w1l < t2h1u4 && t2w1l < t2h1d4 && t2w1l < t2w1rwt4 && t2w1l < t2w1lwt4 && t2w1l < t2h1uwt4 && t2w1l < t2h1dwt4
      && t2w1l < t2w1r5 && t2w1l < t2w1l5 && t2w1l < t2h1u5 && t2w1l < t2h1d5 && t2w1l < t2w1rwt5 && t2w1l < t2w1lwt5 && t2w1l < t2h1uwt5 && t2w1l < t2h1dwt5
      && t2w1l < t2w1r6 && t2w1l < t2w1l6 && t2w1l < t2h1u6 && t2w1l < t2h1d6 && t2w1l < t2w1rwt6 && t2w1l < t2w1lwt6 && t2w1l < t2h1uwt6 && t2w1l < t2h1dwt6
      && t2w1l < t2w1r7 && t2w1l < t2w1l7 && t2w1l < t2h1u7 && t2w1l < t2h1d7 && t2w1l < t2w1rwt7 && t2w1l < t2w1lwt7 && t2w1l < t2h1uwt7 && t2w1l < t2h1dwt7
      && t2w1l < t2w1r8 && t2w1l < t2w1l8 && t2w1l < t2h1u8 && t2w1l < t2h1d8 && t2w1l < t2w1rwt8 && t2w1l < t2w1lwt8 && t2w1l < t2h1uwt8 && t2w1l < t2h1dwt8
      && t2w1l < t2w1r9 && t2w1l < t2w1l9 && t2w1l < t2h1u9 && t2w1l < t2h1d9 && t2w1l < t2w1rwt9 && t2w1l < t2w1lwt9 && t2w1l < t2h1uwt9 && t2w1l < t2h1dwt9
      && t2w1l < t2w1r10 && t2w1l < t2w1l10 && t2w1l < t2h1u10 && t2w1l < t2h1d10 && t2w1l < t2w1rwt10 && t2w1l < t2w1lwt10 && t2w1l < t2h1uwt10 && t2w1l < t2h1dwt10
      && ((linwl!=0) && (loutwl!=0) )){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1l+z)-h1d;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1l+z))*(z0hd+(vz*t2w1l+z)))/a2hd);
      }else{
      ylimitd=-sqrt(((vz*t2w1l+z)-pbhd)/-pahd);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1l+z)+h1u;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1l+z))*(z0hu+(vz*t2w1l+z)))/a2hu);
     }else{
     ylimitu=sqrt(((vz*t2w1l+z)-pbhu)/-pahu);
    }
    }
  ytest=vy*t2w1l+y;
  xlimitl=bwl*sqrt(1-((vz*t2w1l+z)+z0wl)*((vz*t2w1l+z)+z0wl)/a2wl);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl>0){
  i=5;
  }else{
  i=19;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl!=-1 && t2w1l > 0 && t2w1l < t1 
      && t2w1l < t2w1r  && t2w1l < t2h1u && t2w1l < t2h1d && t2w1l < t2w1rwt && t2w1l < t2w1lwt && t2w1l < t2h1uwt && t2w1l < t2h1dwt
      && t2w1l < t2w1r1 && t2w1l < t2w1l1 && t2w1l < t2h1u1 && t2w1l < t2h1d1 && t2w1l < t2w1rwt1 && t2w1l < t2w1lwt1 && t2w1l < t2h1uwt1 && t2w1l < t2h1dwt1
      && t2w1l < t2w1r2 && t2w1l < t2w1l2 && t2w1l < t2h1u2 && t2w1l < t2h1d2 && t2w1l < t2w1rwt2 && t2w1l < t2w1lwt2 && t2w1l < t2h1uwt2 && t2w1l < t2h1dwt2
      && t2w1l < t2w1r3 && t2w1l < t2w1l3 && t2w1l < t2h1u3 && t2w1l < t2h1d3 && t2w1l < t2w1rwt3 && t2w1l < t2w1lwt3 && t2w1l < t2h1uwt3 && t2w1l < t2h1dwt3
      && t2w1l < t2w1r4 && t2w1l < t2w1l4 && t2w1l < t2h1u4 && t2w1l < t2h1d4 && t2w1l < t2w1rwt4 && t2w1l < t2w1lwt4 && t2w1l < t2h1uwt4 && t2w1l < t2h1dwt4
      && t2w1l < t2w1r5 && t2w1l < t2w1l5 && t2w1l < t2h1u5 && t2w1l < t2h1d5 && t2w1l < t2w1rwt5 && t2w1l < t2w1lwt5 && t2w1l < t2h1uwt5 && t2w1l < t2h1dwt5
      && t2w1l < t2w1r6 && t2w1l < t2w1l6 && t2w1l < t2h1u6 && t2w1l < t2h1d6 && t2w1l < t2w1rwt6 && t2w1l < t2w1lwt6 && t2w1l < t2h1uwt6 && t2w1l < t2h1dwt6
      && t2w1l < t2w1r7 && t2w1l < t2w1l7 && t2w1l < t2h1u7 && t2w1l < t2h1d7 && t2w1l < t2w1rwt7 && t2w1l < t2w1lwt7 && t2w1l < t2h1uwt7 && t2w1l < t2h1dwt7
      && t2w1l < t2w1r8 && t2w1l < t2w1l8 && t2w1l < t2h1u8 && t2w1l < t2h1d8 && t2w1l < t2w1rwt8 && t2w1l < t2w1lwt8 && t2w1l < t2h1uwt8 && t2w1l < t2h1dwt8
      && t2w1l < t2w1r9 && t2w1l < t2w1l9 && t2w1l < t2h1u9 && t2w1l < t2h1d9 && t2w1l < t2w1rwt9 && t2w1l < t2w1lwt9 && t2w1l < t2h1uwt9 && t2w1l < t2h1dwt9
      && t2w1l < t2w1r10 && t2w1l < t2w1l10 && t2w1l < t2h1u10 && t2w1l < t2h1d10 && t2w1l < t2w1rwt10 && t2w1l < t2w1lwt10 && t2w1l < t2h1uwt10 && t2w1l < t2h1dwt10
      && ((loutwl!=0 && linwl==0) || (loutwl==0 && linwl!=0))){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1l+z)-h1d;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1l+z))*(z0hd+(vz*t2w1l+z)))/a2hd);
      }else{
      ylimitd=-sqrt(((vz*t2w1l+z)-pbhd)/-pahd);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1l+z)+h1u;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1l+z))*(z0hu+(vz*t2w1l+z)))/a2hu);
     }else{
     ylimitu=sqrt(((vz*t2w1l+z)-pbhu)/-pahu);
    }
    }
  ytest=vy*t2w1l+y;
  xlimitl=sqrt(pbwl-(vz*t2w1l+z)/pawl);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl>0){
  i=6;
  }else{
  i=19;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl!=-1 && t2w1l > 0 && t2w1l < t1 
      && t2w1l < t2w1r  && t2w1l < t2h1u && t2w1l < t2h1d && t2w1l < t2w1rwt && t2w1l < t2w1lwt && t2w1l < t2h1uwt && t2w1l < t2h1dwt
      && t2w1l < t2w1r1 && t2w1l < t2w1l1 && t2w1l < t2h1u1 && t2w1l < t2h1d1 && t2w1l < t2w1rwt1 && t2w1l < t2w1lwt1 && t2w1l < t2h1uwt1 && t2w1l < t2h1dwt1
      && t2w1l < t2w1r2 && t2w1l < t2w1l2 && t2w1l < t2h1u2 && t2w1l < t2h1d2 && t2w1l < t2w1rwt2 && t2w1l < t2w1lwt2 && t2w1l < t2h1uwt2 && t2w1l < t2h1dwt2
      && t2w1l < t2w1r3 && t2w1l < t2w1l3 && t2w1l < t2h1u3 && t2w1l < t2h1d3 && t2w1l < t2w1rwt3 && t2w1l < t2w1lwt3 && t2w1l < t2h1uwt3 && t2w1l < t2h1dwt3
      && t2w1l < t2w1r4 && t2w1l < t2w1l4 && t2w1l < t2h1u4 && t2w1l < t2h1d4 && t2w1l < t2w1rwt4 && t2w1l < t2w1lwt4 && t2w1l < t2h1uwt4 && t2w1l < t2h1dwt4
      && t2w1l < t2w1r5 && t2w1l < t2w1l5 && t2w1l < t2h1u5 && t2w1l < t2h1d5 && t2w1l < t2w1rwt5 && t2w1l < t2w1lwt5 && t2w1l < t2h1uwt5 && t2w1l < t2h1dwt5
      && t2w1l < t2w1r6 && t2w1l < t2w1l6 && t2w1l < t2h1u6 && t2w1l < t2h1d6 && t2w1l < t2w1rwt6 && t2w1l < t2w1lwt6 && t2w1l < t2h1uwt6 && t2w1l < t2h1dwt6
      && t2w1l < t2w1r7 && t2w1l < t2w1l7 && t2w1l < t2h1u7 && t2w1l < t2h1d7 && t2w1l < t2w1rwt7 && t2w1l < t2w1lwt7 && t2w1l < t2h1uwt7 && t2w1l < t2h1dwt7
      && t2w1l < t2w1r8 && t2w1l < t2w1l8 && t2w1l < t2h1u8 && t2w1l < t2h1d8 && t2w1l < t2w1rwt8 && t2w1l < t2w1lwt8 && t2w1l < t2h1uwt8 && t2w1l < t2h1dwt8
      && t2w1l < t2w1r9 && t2w1l < t2w1l9 && t2w1l < t2h1u9 && t2w1l < t2h1d9 && t2w1l < t2w1rwt9 && t2w1l < t2w1lwt9 && t2w1l < t2h1uwt9 && t2w1l < t2h1dwt9
      && t2w1l < t2w1r10 && t2w1l < t2w1l10 && t2w1l < t2h1u10 && t2w1l < t2h1d10 && t2w1l < t2w1rwt10 && t2w1l < t2w1lwt10 && t2w1l < t2h1uwt10 && t2w1l < t2h1dwt10
      && (loutwl==0 && linwl==0)){
 if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1l+z)-h1d;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhd*sqrt(1-((z0hd+(vz*t2w1l+z))*(z0hd+(vz*t2w1l+z)))/a2hd);
      }else{
      ylimitd=-sqrt(((vz*t2w1l+z)-pbhd)/-pahd);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1l+z)+h1u;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhu*sqrt(1-((z0hu+(vz*t2w1l+z))*(z0hu+(vz*t2w1l+z)))/a2hu);
     }else{
     ylimitu=sqrt(((vz*t2w1l+z)-pbhu)/-pahu);
    }
    }
  ytest=vy*t2w1l+y;
  xlimitl=(w2l-w1l)*(vz*t2w1l+z)/l+w1l;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl>0){
  i=7;
  }else{
  i=19;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu!=-1 && t2h1u > 0 && t2h1u < t1 
  && t2h1u < t2w1r && t2h1u < t2w1l && t2h1u < t2h1d && t2h1u < t2w1rwt && t2h1u < t2w1lwt && t2h1u < t2h1uwt && t2h1u < t2h1dwt
  && t2h1u < t2w1r1 && t2h1u < t2w1l1 && t2h1u < t2h1u1 && t2h1u < t2h1d1 && t2h1u < t2w1rwt1 && t2h1u < t2w1lwt1 && t2h1u < t2h1uwt1 && t2h1u < t2h1dwt1
  && t2h1u < t2w1r2 && t2h1u < t2w1l2 && t2h1u < t2h1u2 && t2h1u < t2h1d2 && t2h1u < t2w1rwt2 && t2h1u < t2w1lwt2 && t2h1u < t2h1uwt2 && t2h1u < t2h1dwt2
  && t2h1u < t2w1r3 && t2h1u < t2w1l3 && t2h1u < t2h1u3 && t2h1u < t2h1d3 && t2h1u < t2w1rwt3 && t2h1u < t2w1lwt3 && t2h1u < t2h1uwt3 && t2h1u < t2h1dwt3
  && t2h1u < t2w1r4 && t2h1u < t2w1l4 && t2h1u < t2h1u4 && t2h1u < t2h1d4 && t2h1u < t2w1rwt4 && t2h1u < t2w1lwt4 && t2h1u < t2h1uwt4 && t2h1u < t2h1dwt4
  && t2h1u < t2w1r5 && t2h1u < t2w1l5 && t2h1u < t2h1u5 && t2h1u < t2h1d5 && t2h1u < t2w1rwt5 && t2h1u < t2w1lwt5 && t2h1u < t2h1uwt5 && t2h1u < t2h1dwt5
  && t2h1u < t2w1r6 && t2h1u < t2w1l6 && t2h1u < t2h1u6 && t2h1u < t2h1d6 && t2h1u < t2w1rwt6 && t2h1u < t2w1lwt6 && t2h1u < t2h1uwt6 && t2h1u < t2h1dwt6
  && t2h1u < t2w1r7 && t2h1u < t2w1l7 && t2h1u < t2h1u7 && t2h1u < t2h1d7 && t2h1u < t2w1rwt7 && t2h1u < t2w1lwt7 && t2h1u < t2h1uwt7 && t2h1u < t2h1dwt7
  && t2h1u < t2w1r8 && t2h1u < t2w1l8 && t2h1u < t2h1u8 && t2h1u < t2h1d8 && t2h1u < t2w1rwt8 && t2h1u < t2w1lwt8 && t2h1u < t2h1uwt8 && t2h1u < t2h1dwt8
  && t2h1u < t2w1r9 && t2h1u < t2w1l9 && t2h1u < t2h1u9 && t2h1u < t2h1d9 && t2h1u < t2w1rwt9 && t2h1u < t2w1lwt9 && t2h1u < t2h1uwt9 && t2h1u < t2h1dwt9
  && t2h1u < t2w1r10 && t2h1u < t2w1l10 && t2h1u < t2h1u10 && t2h1u < t2h1d10 && t2h1u < t2w1rwt10 && t2h1u < t2w1lwt10 && t2h1u < t2h1uwt10 && t2h1u < t2h1dwt10
  && (louthu !=0 && linhu!=0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1u+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1u+z))*(z0wr+(vz*t2h1u+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1u+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1u+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1u+z))*(z0wl+(vz*t2h1u+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1u+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1u+x;
  ylimitu=bhu*sqrt(1-((vz*t2h1u+z)+z0hu)*((vz*t2h1u+z)+z0hu)/a2hu);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu>0 ){
  i=8;
  }else{
  i=20;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu!=-1 && t2h1u > 0 && t2h1u < t1 
  && t2h1u < t2w1r && t2h1u < t2w1l && t2h1u < t2h1d && t2h1u < t2w1rwt && t2h1u < t2w1lwt && t2h1u < t2h1uwt && t2h1u < t2h1dwt
  && t2h1u < t2w1r1 && t2h1u < t2w1l1 && t2h1u < t2h1u1 && t2h1u < t2h1d1 && t2h1u < t2w1rwt1 && t2h1u < t2w1lwt1 && t2h1u < t2h1uwt1 && t2h1u < t2h1dwt1
  && t2h1u < t2w1r2 && t2h1u < t2w1l2 && t2h1u < t2h1u2 && t2h1u < t2h1d2 && t2h1u < t2w1rwt2 && t2h1u < t2w1lwt2 && t2h1u < t2h1uwt2 && t2h1u < t2h1dwt2
  && t2h1u < t2w1r3 && t2h1u < t2w1l3 && t2h1u < t2h1u3 && t2h1u < t2h1d3 && t2h1u < t2w1rwt3 && t2h1u < t2w1lwt3 && t2h1u < t2h1uwt3 && t2h1u < t2h1dwt3
  && t2h1u < t2w1r4 && t2h1u < t2w1l4 && t2h1u < t2h1u4 && t2h1u < t2h1d4 && t2h1u < t2w1rwt4 && t2h1u < t2w1lwt4 && t2h1u < t2h1uwt4 && t2h1u < t2h1dwt4
  && t2h1u < t2w1r5 && t2h1u < t2w1l5 && t2h1u < t2h1u5 && t2h1u < t2h1d5 && t2h1u < t2w1rwt5 && t2h1u < t2w1lwt5 && t2h1u < t2h1uwt5 && t2h1u < t2h1dwt5
  && t2h1u < t2w1r6 && t2h1u < t2w1l6 && t2h1u < t2h1u6 && t2h1u < t2h1d6 && t2h1u < t2w1rwt6 && t2h1u < t2w1lwt6 && t2h1u < t2h1uwt6 && t2h1u < t2h1dwt6
  && t2h1u < t2w1r7 && t2h1u < t2w1l7 && t2h1u < t2h1u7 && t2h1u < t2h1d7 && t2h1u < t2w1rwt7 && t2h1u < t2w1lwt7 && t2h1u < t2h1uwt7 && t2h1u < t2h1dwt7
  && t2h1u < t2w1r8 && t2h1u < t2w1l8 && t2h1u < t2h1u8 && t2h1u < t2h1d8 && t2h1u < t2w1rwt8 && t2h1u < t2w1lwt8 && t2h1u < t2h1uwt8 && t2h1u < t2h1dwt8
  && t2h1u < t2w1r9 && t2h1u < t2w1l9 && t2h1u < t2h1u9 && t2h1u < t2h1d9 && t2h1u < t2w1rwt9 && t2h1u < t2w1lwt9 && t2h1u < t2h1uwt9 && t2h1u < t2h1dwt9
  && t2h1u < t2w1r10 && t2h1u < t2w1l10 && t2h1u < t2h1u10 && t2h1u < t2h1d10 && t2h1u < t2w1rwt10 && t2h1u < t2w1lwt10 && t2h1u < t2h1uwt10 && t2h1u < t2h1dwt10
  &&  ((louthu!=0 && linhu==0) || (louthu==0 && linhu!=0))){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1u+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1u+z))*(z0wr+(vz*t2h1u+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1u+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1u+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1u+z))*(z0wl+(vz*t2h1u+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1u+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1u+x;
  ylimitu=sqrt(pbhu-(vz*t2h1u+z)/pahu);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu>0){
  i=9;
  }else{
  i=20;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu!=-1 && t2h1u > 0 && t2h1u < t1 
  && t2h1u < t2w1r && t2h1u < t2w1l && t2h1u < t2h1d && t2h1u < t2w1rwt && t2h1u < t2w1lwt && t2h1u < t2h1uwt && t2h1u < t2h1dwt
  && t2h1u < t2w1r1 && t2h1u < t2w1l1 && t2h1u < t2h1u1 && t2h1u < t2h1d1 && t2h1u < t2w1rwt1 && t2h1u < t2w1lwt1 && t2h1u < t2h1uwt1 && t2h1u < t2h1dwt1
  && t2h1u < t2w1r2 && t2h1u < t2w1l2 && t2h1u < t2h1u2 && t2h1u < t2h1d2 && t2h1u < t2w1rwt2 && t2h1u < t2w1lwt2 && t2h1u < t2h1uwt2 && t2h1u < t2h1dwt2
  && t2h1u < t2w1r3 && t2h1u < t2w1l3 && t2h1u < t2h1u3 && t2h1u < t2h1d3 && t2h1u < t2w1rwt3 && t2h1u < t2w1lwt3 && t2h1u < t2h1uwt3 && t2h1u < t2h1dwt3
  && t2h1u < t2w1r4 && t2h1u < t2w1l4 && t2h1u < t2h1u4 && t2h1u < t2h1d4 && t2h1u < t2w1rwt4 && t2h1u < t2w1lwt4 && t2h1u < t2h1uwt4 && t2h1u < t2h1dwt4
  && t2h1u < t2w1r5 && t2h1u < t2w1l5 && t2h1u < t2h1u5 && t2h1u < t2h1d5 && t2h1u < t2w1rwt5 && t2h1u < t2w1lwt5 && t2h1u < t2h1uwt5 && t2h1u < t2h1dwt5
  && t2h1u < t2w1r6 && t2h1u < t2w1l6 && t2h1u < t2h1u6 && t2h1u < t2h1d6 && t2h1u < t2w1rwt6 && t2h1u < t2w1lwt6 && t2h1u < t2h1uwt6 && t2h1u < t2h1dwt6
  && t2h1u < t2w1r7 && t2h1u < t2w1l7 && t2h1u < t2h1u7 && t2h1u < t2h1d7 && t2h1u < t2w1rwt7 && t2h1u < t2w1lwt7 && t2h1u < t2h1uwt7 && t2h1u < t2h1dwt7
  && t2h1u < t2w1r8 && t2h1u < t2w1l8 && t2h1u < t2h1u8 && t2h1u < t2h1d8 && t2h1u < t2w1rwt8 && t2h1u < t2w1lwt8 && t2h1u < t2h1uwt8 && t2h1u < t2h1dwt8
  && t2h1u < t2w1r9 && t2h1u < t2w1l9 && t2h1u < t2h1u9 && t2h1u < t2h1d9 && t2h1u < t2w1rwt9 && t2h1u < t2w1lwt9 && t2h1u < t2h1uwt9 && t2h1u < t2h1dwt9
  && t2h1u < t2w1r10 && t2h1u < t2w1l10 && t2h1u < t2h1u10 && t2h1u < t2h1d10 && t2h1u < t2w1rwt10 && t2h1u < t2w1lwt10 && t2h1u < t2h1uwt10 && t2h1u < t2h1dwt10
  &&  (louthu == 0 && linhu == 0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1u+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1u+z))*(z0wr+(vz*t2h1u+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1u+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1u+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1u+z))*(z0wl+(vz*t2h1u+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1u+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1u+x;
  ylimitu=(h2u-h1u)*(vz*t2h1u+z)/l+h1u;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu>0 ){
  i=10;
  }else{
  i=20;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd!=-1 && t2h1d > 0 && t2h1d < t1 
  && t2h1d < t2w1r && t2h1d < t2w1l && t2h1d < t2h1u && t2h1d < t2w1rwt && t2h1d < t2w1lwt && t2h1d < t2h1uwt && t2h1d < t2h1dwt
  && t2h1d < t2w1r1 && t2h1d < t2w1l1 && t2h1d < t2h1u1 && t2h1d < t2h1d1 && t2h1d < t2w1rwt1 && t2h1d < t2w1lwt1 && t2h1d < t2h1uwt1 && t2h1d < t2h1dwt1
  && t2h1d < t2w1r2 && t2h1d < t2w1l2 && t2h1d < t2h1u2 && t2h1d < t2h1d2 && t2h1d < t2w1rwt2 && t2h1d < t2w1lwt2 && t2h1d < t2h1uwt2 && t2h1d < t2h1dwt2
  && t2h1d < t2w1r3 && t2h1d < t2w1l3 && t2h1d < t2h1u3 && t2h1d < t2h1d3 && t2h1d < t2w1rwt3 && t2h1d < t2w1lwt3 && t2h1d < t2h1uwt3 && t2h1d < t2h1dwt3
  && t2h1d < t2w1r4 && t2h1d < t2w1l4 && t2h1d < t2h1u4 && t2h1d < t2h1d4 && t2h1d < t2w1rwt4 && t2h1d < t2w1lwt4 && t2h1d < t2h1uwt4 && t2h1d < t2h1dwt4
  && t2h1d < t2w1r5 && t2h1d < t2w1l5 && t2h1d < t2h1u5 && t2h1d < t2h1d5 && t2h1d < t2w1rwt5 && t2h1d < t2w1lwt5 && t2h1d < t2h1uwt5 && t2h1d < t2h1dwt5
  && t2h1d < t2w1r6 && t2h1d < t2w1l6 && t2h1d < t2h1u6 && t2h1d < t2h1d6 && t2h1d < t2w1rwt6 && t2h1d < t2w1lwt6 && t2h1d < t2h1uwt6 && t2h1d < t2h1dwt6
  && t2h1d < t2w1r7 && t2h1d < t2w1l7 && t2h1d < t2h1u7 && t2h1d < t2h1d7 && t2h1d < t2w1rwt7 && t2h1d < t2w1lwt7 && t2h1d < t2h1uwt7 && t2h1d < t2h1dwt7
  && t2h1d < t2w1r8 && t2h1d < t2w1l8 && t2h1d < t2h1u8 && t2h1d < t2h1d8 && t2h1d < t2w1rwt8 && t2h1d < t2w1lwt8 && t2h1d < t2h1uwt8 && t2h1d < t2h1dwt8
  && t2h1d < t2w1r9 && t2h1d < t2w1l9 && t2h1d < t2h1u9 && t2h1d < t2h1d9 && t2h1d < t2w1rwt9 && t2h1d < t2w1lwt9 && t2h1d < t2h1uwt9 && t2h1d < t2h1dwt9
  && t2h1d < t2w1r10 && t2h1d < t2w1l10 && t2h1d < t2h1u10 && t2h1d < t2h1d10 && t2h1d < t2w1rwt10 && t2h1d < t2w1lwt10 && t2h1d < t2h1uwt10 && t2h1d < t2h1dwt10
  && (louthd !=0 && linhd!=0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1d+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1d+z))*(z0wr+(vz*t2h1d+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1d+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1d+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1d+z))*(z0wl+(vz*t2h1d+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1d+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1d+x;
  ylimitd=-bhd*sqrt(1-((vz*t2h1d+z)+z0hd)*((vz*t2h1d+z)+z0hd)/a2hd);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd>0){
  i=11;
  }else{
  i=21;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd!=-1 && t2h1d > 0 && t2h1d < t1 
  && t2h1d < t2w1r && t2h1d < t2w1l && t2h1d < t2h1u && t2h1d < t2w1rwt && t2h1d < t2w1lwt && t2h1d < t2h1uwt && t2h1d < t2h1dwt
  && t2h1d < t2w1r1 && t2h1d < t2w1l1 && t2h1d < t2h1u1 && t2h1d < t2h1d1 && t2h1d < t2w1rwt1 && t2h1d < t2w1lwt1 && t2h1d < t2h1uwt1 && t2h1d < t2h1dwt1
  && t2h1d < t2w1r2 && t2h1d < t2w1l2 && t2h1d < t2h1u2 && t2h1d < t2h1d2 && t2h1d < t2w1rwt2 && t2h1d < t2w1lwt2 && t2h1d < t2h1uwt2 && t2h1d < t2h1dwt2
  && t2h1d < t2w1r3 && t2h1d < t2w1l3 && t2h1d < t2h1u3 && t2h1d < t2h1d3 && t2h1d < t2w1rwt3 && t2h1d < t2w1lwt3 && t2h1d < t2h1uwt3 && t2h1d < t2h1dwt3
  && t2h1d < t2w1r4 && t2h1d < t2w1l4 && t2h1d < t2h1u4 && t2h1d < t2h1d4 && t2h1d < t2w1rwt4 && t2h1d < t2w1lwt4 && t2h1d < t2h1uwt4 && t2h1d < t2h1dwt4
  && t2h1d < t2w1r5 && t2h1d < t2w1l5 && t2h1d < t2h1u5 && t2h1d < t2h1d5 && t2h1d < t2w1rwt5 && t2h1d < t2w1lwt5 && t2h1d < t2h1uwt5 && t2h1d < t2h1dwt5
  && t2h1d < t2w1r6 && t2h1d < t2w1l6 && t2h1d < t2h1u6 && t2h1d < t2h1d6 && t2h1d < t2w1rwt6 && t2h1d < t2w1lwt6 && t2h1d < t2h1uwt6 && t2h1d < t2h1dwt6
  && t2h1d < t2w1r7 && t2h1d < t2w1l7 && t2h1d < t2h1u7 && t2h1d < t2h1d7 && t2h1d < t2w1rwt7 && t2h1d < t2w1lwt7 && t2h1d < t2h1uwt7 && t2h1d < t2h1dwt7
  && t2h1d < t2w1r8 && t2h1d < t2w1l8 && t2h1d < t2h1u8 && t2h1d < t2h1d8 && t2h1d < t2w1rwt8 && t2h1d < t2w1lwt8 && t2h1d < t2h1uwt8 && t2h1d < t2h1dwt8
  && t2h1d < t2w1r9 && t2h1d < t2w1l9 && t2h1d < t2h1u9 && t2h1d < t2h1d9 && t2h1d < t2w1rwt9 && t2h1d < t2w1lwt9 && t2h1d < t2h1uwt9 && t2h1d < t2h1dwt9
  && t2h1d < t2w1r10 && t2h1d < t2w1l10 && t2h1d < t2h1u10 && t2h1d < t2h1d10 && t2h1d < t2w1rwt10 && t2h1d < t2w1lwt10 && t2h1d < t2h1uwt10 && t2h1d < t2h1dwt10
  && ((louthd !=0 && linhd==0) || (louthd ==0 && linhd!=0))){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1d+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1d+z))*(z0wr+(vz*t2h1d+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1d+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1d+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1d+z))*(z0wl+(vz*t2h1d+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1d+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1d+x;
  ylimitd=-sqrt(pbhd-(vz*t2h1d+z)/pahd);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd>0 ){
  i=12;
  }else{
  i=21;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd!=-1 && t2h1d > 0 && t2h1d < t1 
  && t2h1d < t2w1r && t2h1d < t2w1l && t2h1d < t2h1u && t2h1d < t2w1rwt && t2h1d < t2w1lwt && t2h1d < t2h1uwt && t2h1d < t2h1dwt
  && t2h1d < t2w1r1 && t2h1d < t2w1l1 && t2h1d < t2h1u1 && t2h1d < t2h1d1 && t2h1d < t2w1rwt1 && t2h1d < t2w1lwt1 && t2h1d < t2h1uwt1 && t2h1d < t2h1dwt1
  && t2h1d < t2w1r2 && t2h1d < t2w1l2 && t2h1d < t2h1u2 && t2h1d < t2h1d2 && t2h1d < t2w1rwt2 && t2h1d < t2w1lwt2 && t2h1d < t2h1uwt2 && t2h1d < t2h1dwt2
  && t2h1d < t2w1r3 && t2h1d < t2w1l3 && t2h1d < t2h1u3 && t2h1d < t2h1d3 && t2h1d < t2w1rwt3 && t2h1d < t2w1lwt3 && t2h1d < t2h1uwt3 && t2h1d < t2h1dwt3
  && t2h1d < t2w1r4 && t2h1d < t2w1l4 && t2h1d < t2h1u4 && t2h1d < t2h1d4 && t2h1d < t2w1rwt4 && t2h1d < t2w1lwt4 && t2h1d < t2h1uwt4 && t2h1d < t2h1dwt4
  && t2h1d < t2w1r5 && t2h1d < t2w1l5 && t2h1d < t2h1u5 && t2h1d < t2h1d5 && t2h1d < t2w1rwt5 && t2h1d < t2w1lwt5 && t2h1d < t2h1uwt5 && t2h1d < t2h1dwt5
  && t2h1d < t2w1r6 && t2h1d < t2w1l6 && t2h1d < t2h1u6 && t2h1d < t2h1d6 && t2h1d < t2w1rwt6 && t2h1d < t2w1lwt6 && t2h1d < t2h1uwt6 && t2h1d < t2h1dwt6
  && t2h1d < t2w1r7 && t2h1d < t2w1l7 && t2h1d < t2h1u7 && t2h1d < t2h1d7 && t2h1d < t2w1rwt7 && t2h1d < t2w1lwt7 && t2h1d < t2h1uwt7 && t2h1d < t2h1dwt7
  && t2h1d < t2w1r8 && t2h1d < t2w1l8 && t2h1d < t2h1u8 && t2h1d < t2h1d8 && t2h1d < t2w1rwt8 && t2h1d < t2w1lwt8 && t2h1d < t2h1uwt8 && t2h1d < t2h1dwt8
  && t2h1d < t2w1r9 && t2h1d < t2w1l9 && t2h1d < t2h1u9 && t2h1d < t2h1d9 && t2h1d < t2w1rwt9 && t2h1d < t2w1lwt9 && t2h1d < t2h1uwt9 && t2h1d < t2h1dwt9
  && t2h1d < t2w1r10 && t2h1d < t2w1l10 && t2h1d < t2h1u10 && t2h1d < t2h1d10 && t2h1d < t2w1rwt10 && t2h1d < t2w1lwt10 && t2h1d < t2h1uwt10 && t2h1d < t2h1dwt10
  && (louthd == 0 && linhd == 0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1d+z)-w1r;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwr*sqrt(1-((z0wr+(vz*t2h1d+z))*(z0wr+(vz*t2h1d+z)))/a2wr);
    }else{
    xlimitr=-sqrt(((vz*t2h1d+z)-pbwr)/-pawr);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1d+z)+w1l;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwl*sqrt(1-((z0wl+(vz*t2h1d+z))*(z0wl+(vz*t2h1d+z)))/a2wl);
      }else{
      xlimitl=sqrt(((vz*t2h1d+z)-pbwl)/-pawl);
      }
   }
  xtest=vx*t2h1d+x;
  ylimitd=(-h2d+h1d)*(vz*t2h1d+z)/l-h1d;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd>0 ){
  i=13;
  }else{
  i=21;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr==-1 && t2w1r > 0 && t2w1r < t1 
     && t2w1r < t2w1l && t2w1r < t2h1u && t2w1r < t2h1d && t2w1r < t2w1rwt && t2w1r < t2w1lwt && t2w1r < t2h1uwt && t2w1r < t2h1dwt
     && t2w1r < t2w1r1 && t2w1r < t2w1l1 && t2w1r < t2h1u1 && t2w1r < t2h1d1 && t2w1r < t2w1rwt1 && t2w1r < t2w1lwt1 && t2w1r < t2h1uwt1 && t2w1r < t2h1dwt1
     && t2w1r < t2w1r2 && t2w1r < t2w1l2 && t2w1r < t2h1u2 && t2w1r < t2h1d2 && t2w1r < t2w1rwt2 && t2w1r < t2w1lwt2 && t2w1r < t2h1uwt2 && t2w1r < t2h1dwt2 
     && t2w1r < t2w1r3 && t2w1r < t2w1l3 && t2w1r < t2h1u3 && t2w1r < t2h1d3 && t2w1r < t2w1rwt3 && t2w1r < t2w1lwt3 && t2w1r < t2h1uwt3 && t2w1r < t2h1dwt3
     && t2w1r < t2w1r4 && t2w1r < t2w1l4 && t2w1r < t2h1u4 && t2w1r < t2h1d4 && t2w1r < t2w1rwt4 && t2w1r < t2w1lwt4 && t2w1r < t2h1uwt4 && t2w1r < t2h1dwt4
     && t2w1r < t2w1r5 && t2w1r < t2w1l5 && t2w1r < t2h1u5 && t2w1r < t2h1d5 && t2w1r < t2w1rwt5 && t2w1r < t2w1lwt5 && t2w1r < t2h1uwt5 && t2w1r < t2h1dwt5
     && t2w1r < t2w1r6 && t2w1r < t2w1l6 && t2w1r < t2h1u6 && t2w1r < t2h1d6 && t2w1r < t2w1rwt6 && t2w1r < t2w1lwt6 && t2w1r < t2h1uwt6 && t2w1r < t2h1dwt6
     && t2w1r < t2w1r7 && t2w1r < t2w1l7 && t2w1r < t2h1u7 && t2w1r < t2h1d7 && t2w1r < t2w1rwt7 && t2w1r < t2w1lwt7 && t2w1r < t2h1uwt7 && t2w1r < t2h1dwt7
     && t2w1r < t2w1r8 && t2w1r < t2w1l8 && t2w1r < t2h1u8 && t2w1r < t2h1d8 && t2w1r < t2w1rwt8 && t2w1r < t2w1lwt8 && t2w1r < t2h1uwt8 && t2w1r < t2h1dwt8
     && t2w1r < t2w1r9 && t2w1r < t2w1l9 && t2w1r < t2h1u9 && t2w1r < t2h1d9 && t2w1r < t2w1rwt9 && t2w1r < t2w1lwt9 && t2w1r < t2h1uwt9 && t2w1r < t2h1dwt9
     && t2w1r < t2w1r10 && t2w1r < t2w1l10 && t2w1r < t2h1u10 && t2w1r < t2h1d10 && t2w1r < t2w1rwt10 && t2w1r < t2w1lwt10 && t2w1r < t2h1uwt10 && t2w1r < t2h1dwt10
     && ((linwr!=0) && (loutwr!=0) )) {
  i=14;
  }

  if (mxr==-1 && t2w1r > 0 && t2w1r < t1 
     && t2w1r < t2w1l && t2w1r < t2h1u && t2w1r < t2h1d && t2w1r < t2w1rwt && t2w1r < t2w1lwt && t2w1r < t2h1uwt && t2w1r < t2h1dwt
     && t2w1r < t2w1r1 && t2w1r < t2w1l1 && t2w1r < t2h1u1 && t2w1r < t2h1d1 && t2w1r < t2w1rwt1 && t2w1r < t2w1lwt1 && t2w1r < t2h1uwt1 && t2w1r < t2h1dwt1
     && t2w1r < t2w1r2 && t2w1r < t2w1l2 && t2w1r < t2h1u2 && t2w1r < t2h1d2 && t2w1r < t2w1rwt2 && t2w1r < t2w1lwt2 && t2w1r < t2h1uwt2 && t2w1r < t2h1dwt2 
     && t2w1r < t2w1r3 && t2w1r < t2w1l3 && t2w1r < t2h1u3 && t2w1r < t2h1d3 && t2w1r < t2w1rwt3 && t2w1r < t2w1lwt3 && t2w1r < t2h1uwt3 && t2w1r < t2h1dwt3
     && t2w1r < t2w1r4 && t2w1r < t2w1l4 && t2w1r < t2h1u4 && t2w1r < t2h1d4 && t2w1r < t2w1rwt4 && t2w1r < t2w1lwt4 && t2w1r < t2h1uwt4 && t2w1r < t2h1dwt4
     && t2w1r < t2w1r5 && t2w1r < t2w1l5 && t2w1r < t2h1u5 && t2w1r < t2h1d5 && t2w1r < t2w1rwt5 && t2w1r < t2w1lwt5 && t2w1r < t2h1uwt5 && t2w1r < t2h1dwt5
     && t2w1r < t2w1r6 && t2w1r < t2w1l6 && t2w1r < t2h1u6 && t2w1r < t2h1d6 && t2w1r < t2w1rwt6 && t2w1r < t2w1lwt6 && t2w1r < t2h1uwt6 && t2w1r < t2h1dwt6
     && t2w1r < t2w1r7 && t2w1r < t2w1l7 && t2w1r < t2h1u7 && t2w1r < t2h1d7 && t2w1r < t2w1rwt7 && t2w1r < t2w1lwt7 && t2w1r < t2h1uwt7 && t2w1r < t2h1dwt7
     && t2w1r < t2w1r8 && t2w1r < t2w1l8 && t2w1r < t2h1u8 && t2w1r < t2h1d8 && t2w1r < t2w1rwt8 && t2w1r < t2w1lwt8 && t2w1r < t2h1uwt8 && t2w1r < t2h1dwt8
     && t2w1r < t2w1r9 && t2w1r < t2w1l9 && t2w1r < t2h1u9 && t2w1r < t2h1d9 && t2w1r < t2w1rwt9 && t2w1r < t2w1lwt9 && t2w1r < t2h1uwt9 && t2w1r < t2h1dwt9
     && t2w1r < t2w1r10 && t2w1r < t2w1l10 && t2w1r < t2h1u10 && t2w1r < t2h1d10 && t2w1r < t2w1rwt10 && t2w1r < t2w1lwt10 && t2w1r < t2h1uwt10 && t2w1r < t2h1dwt10
     && ((loutwr!=0 && linwr==0) || (loutwr==0 && linwr!=0))){
  i=14;
  }

  if (mxr==-1 && t2w1r > 0 && t2w1r < t1 
     && t2w1r < t2w1l && t2w1r < t2h1u && t2w1r < t2h1d && t2w1r < t2w1rwt && t2w1r < t2w1lwt && t2w1r < t2h1uwt && t2w1r < t2h1dwt
     && t2w1r < t2w1r1 && t2w1r < t2w1l1 && t2w1r < t2h1u1 && t2w1r < t2h1d1 && t2w1r < t2w1rwt1 && t2w1r < t2w1lwt1 && t2w1r < t2h1uwt1 && t2w1r < t2h1dwt1
     && t2w1r < t2w1r2 && t2w1r < t2w1l2 && t2w1r < t2h1u2 && t2w1r < t2h1d2 && t2w1r < t2w1rwt2 && t2w1r < t2w1lwt2 && t2w1r < t2h1uwt2 && t2w1r < t2h1dwt2 
     && t2w1r < t2w1r3 && t2w1r < t2w1l3 && t2w1r < t2h1u3 && t2w1r < t2h1d3 && t2w1r < t2w1rwt3 && t2w1r < t2w1lwt3 && t2w1r < t2h1uwt3 && t2w1r < t2h1dwt3
     && t2w1r < t2w1r4 && t2w1r < t2w1l4 && t2w1r < t2h1u4 && t2w1r < t2h1d4 && t2w1r < t2w1rwt4 && t2w1r < t2w1lwt4 && t2w1r < t2h1uwt4 && t2w1r < t2h1dwt4
     && t2w1r < t2w1r5 && t2w1r < t2w1l5 && t2w1r < t2h1u5 && t2w1r < t2h1d5 && t2w1r < t2w1rwt5 && t2w1r < t2w1lwt5 && t2w1r < t2h1uwt5 && t2w1r < t2h1dwt5
     && t2w1r < t2w1r6 && t2w1r < t2w1l6 && t2w1r < t2h1u6 && t2w1r < t2h1d6 && t2w1r < t2w1rwt6 && t2w1r < t2w1lwt6 && t2w1r < t2h1uwt6 && t2w1r < t2h1dwt6
     && t2w1r < t2w1r7 && t2w1r < t2w1l7 && t2w1r < t2h1u7 && t2w1r < t2h1d7 && t2w1r < t2w1rwt7 && t2w1r < t2w1lwt7 && t2w1r < t2h1uwt7 && t2w1r < t2h1dwt7
     && t2w1r < t2w1r8 && t2w1r < t2w1l8 && t2w1r < t2h1u8 && t2w1r < t2h1d8 && t2w1r < t2w1rwt8 && t2w1r < t2w1lwt8 && t2w1r < t2h1uwt8 && t2w1r < t2h1dwt8
     && t2w1r < t2w1r9 && t2w1r < t2w1l9 && t2w1r < t2h1u9 && t2w1r < t2h1d9 && t2w1r < t2w1rwt9 && t2w1r < t2w1lwt9 && t2w1r < t2h1uwt9 && t2w1r < t2h1dwt9
     && t2w1r < t2w1r10 && t2w1r < t2w1l10 && t2w1r < t2h1u10 && t2w1r < t2h1d10 && t2w1r < t2w1rwt10 && t2w1r < t2w1lwt10 && t2w1r < t2h1uwt10 && t2w1r < t2h1dwt10
     && (loutwr==0 && linwr==0)){
  i=14;
  }

  if (mxl==-1 && t2w1l > 0 && t2w1l < t1 
      && t2w1l < t2w1r  && t2w1l < t2h1u && t2w1l < t2h1d && t2w1l < t2w1rwt && t2w1l < t2w1lwt && t2w1l < t2h1uwt && t2w1l < t2h1dwt
      && t2w1l < t2w1r1 && t2w1l < t2w1l1 && t2w1l < t2h1u1 && t2w1l < t2h1d1 && t2w1l < t2w1rwt1 && t2w1l < t2w1lwt1 && t2w1l < t2h1uwt1 && t2w1l < t2h1dwt1
      && t2w1l < t2w1r2 && t2w1l < t2w1l2 && t2w1l < t2h1u2 && t2w1l < t2h1d2 && t2w1l < t2w1rwt2 && t2w1l < t2w1lwt2 && t2w1l < t2h1uwt2 && t2w1l < t2h1dwt2
      && t2w1l < t2w1r3 && t2w1l < t2w1l3 && t2w1l < t2h1u3 && t2w1l < t2h1d3 && t2w1l < t2w1rwt3 && t2w1l < t2w1lwt3 && t2w1l < t2h1uwt3 && t2w1l < t2h1dwt3
      && t2w1l < t2w1r4 && t2w1l < t2w1l4 && t2w1l < t2h1u4 && t2w1l < t2h1d4 && t2w1l < t2w1rwt4 && t2w1l < t2w1lwt4 && t2w1l < t2h1uwt4 && t2w1l < t2h1dwt4
      && t2w1l < t2w1r5 && t2w1l < t2w1l5 && t2w1l < t2h1u5 && t2w1l < t2h1d5 && t2w1l < t2w1rwt5 && t2w1l < t2w1lwt5 && t2w1l < t2h1uwt5 && t2w1l < t2h1dwt5
      && t2w1l < t2w1r6 && t2w1l < t2w1l6 && t2w1l < t2h1u6 && t2w1l < t2h1d6 && t2w1l < t2w1rwt6 && t2w1l < t2w1lwt6 && t2w1l < t2h1uwt6 && t2w1l < t2h1dwt6
      && t2w1l < t2w1r7 && t2w1l < t2w1l7 && t2w1l < t2h1u7 && t2w1l < t2h1d7 && t2w1l < t2w1rwt7 && t2w1l < t2w1lwt7 && t2w1l < t2h1uwt7 && t2w1l < t2h1dwt7
      && t2w1l < t2w1r8 && t2w1l < t2w1l8 && t2w1l < t2h1u8 && t2w1l < t2h1d8 && t2w1l < t2w1rwt8 && t2w1l < t2w1lwt8 && t2w1l < t2h1uwt8 && t2w1l < t2h1dwt8
      && t2w1l < t2w1r9 && t2w1l < t2w1l9 && t2w1l < t2h1u9 && t2w1l < t2h1d9 && t2w1l < t2w1rwt9 && t2w1l < t2w1lwt9 && t2w1l < t2h1uwt9 && t2w1l < t2h1dwt9
      && t2w1l < t2w1r10 && t2w1l < t2w1l10 && t2w1l < t2h1u10 && t2w1l < t2h1d10 && t2w1l < t2w1rwt10 && t2w1l < t2w1lwt10 && t2w1l < t2h1uwt10 && t2w1l < t2h1dwt10
      && ((linwl!=0) && (loutwl!=0) )){
  i=15;
  }

  if (mxl==-1 && t2w1l > 0 && t2w1l < t1 
      && t2w1l < t2w1r  && t2w1l < t2h1u && t2w1l < t2h1d && t2w1l < t2w1rwt && t2w1l < t2w1lwt && t2w1l < t2h1uwt && t2w1l < t2h1dwt
      && t2w1l < t2w1r1 && t2w1l < t2w1l1 && t2w1l < t2h1u1 && t2w1l < t2h1d1 && t2w1l < t2w1rwt1 && t2w1l < t2w1lwt1 && t2w1l < t2h1uwt1 && t2w1l < t2h1dwt1
      && t2w1l < t2w1r2 && t2w1l < t2w1l2 && t2w1l < t2h1u2 && t2w1l < t2h1d2 && t2w1l < t2w1rwt2 && t2w1l < t2w1lwt2 && t2w1l < t2h1uwt2 && t2w1l < t2h1dwt2
      && t2w1l < t2w1r3 && t2w1l < t2w1l3 && t2w1l < t2h1u3 && t2w1l < t2h1d3 && t2w1l < t2w1rwt3 && t2w1l < t2w1lwt3 && t2w1l < t2h1uwt3 && t2w1l < t2h1dwt3
      && t2w1l < t2w1r4 && t2w1l < t2w1l4 && t2w1l < t2h1u4 && t2w1l < t2h1d4 && t2w1l < t2w1rwt4 && t2w1l < t2w1lwt4 && t2w1l < t2h1uwt4 && t2w1l < t2h1dwt4
      && t2w1l < t2w1r5 && t2w1l < t2w1l5 && t2w1l < t2h1u5 && t2w1l < t2h1d5 && t2w1l < t2w1rwt5 && t2w1l < t2w1lwt5 && t2w1l < t2h1uwt5 && t2w1l < t2h1dwt5
      && t2w1l < t2w1r6 && t2w1l < t2w1l6 && t2w1l < t2h1u6 && t2w1l < t2h1d6 && t2w1l < t2w1rwt6 && t2w1l < t2w1lwt6 && t2w1l < t2h1uwt6 && t2w1l < t2h1dwt6
      && t2w1l < t2w1r7 && t2w1l < t2w1l7 && t2w1l < t2h1u7 && t2w1l < t2h1d7 && t2w1l < t2w1rwt7 && t2w1l < t2w1lwt7 && t2w1l < t2h1uwt7 && t2w1l < t2h1dwt7
      && t2w1l < t2w1r8 && t2w1l < t2w1l8 && t2w1l < t2h1u8 && t2w1l < t2h1d8 && t2w1l < t2w1rwt8 && t2w1l < t2w1lwt8 && t2w1l < t2h1uwt8 && t2w1l < t2h1dwt8
      && t2w1l < t2w1r9 && t2w1l < t2w1l9 && t2w1l < t2h1u9 && t2w1l < t2h1d9 && t2w1l < t2w1rwt9 && t2w1l < t2w1lwt9 && t2w1l < t2h1uwt9 && t2w1l < t2h1dwt9
      && t2w1l < t2w1r10 && t2w1l < t2w1l10 && t2w1l < t2h1u10 && t2w1l < t2h1d10 && t2w1l < t2w1rwt10 && t2w1l < t2w1lwt10 && t2w1l < t2h1uwt10 && t2w1l < t2h1dwt10
      && ((loutwl!=0 && linwl==0) || (loutwl==0 && linwl!=0))){
  i=15;
  }

  if (mxl==-1 && t2w1l > 0 && t2w1l < t1 
      && t2w1l < t2w1r  && t2w1l < t2h1u && t2w1l < t2h1d && t2w1l < t2w1rwt && t2w1l < t2w1lwt && t2w1l < t2h1uwt && t2w1l < t2h1dwt
      && t2w1l < t2w1r1 && t2w1l < t2w1l1 && t2w1l < t2h1u1 && t2w1l < t2h1d1 && t2w1l < t2w1rwt1 && t2w1l < t2w1lwt1 && t2w1l < t2h1uwt1 && t2w1l < t2h1dwt1
      && t2w1l < t2w1r2 && t2w1l < t2w1l2 && t2w1l < t2h1u2 && t2w1l < t2h1d2 && t2w1l < t2w1rwt2 && t2w1l < t2w1lwt2 && t2w1l < t2h1uwt2 && t2w1l < t2h1dwt2
      && t2w1l < t2w1r3 && t2w1l < t2w1l3 && t2w1l < t2h1u3 && t2w1l < t2h1d3 && t2w1l < t2w1rwt3 && t2w1l < t2w1lwt3 && t2w1l < t2h1uwt3 && t2w1l < t2h1dwt3
      && t2w1l < t2w1r4 && t2w1l < t2w1l4 && t2w1l < t2h1u4 && t2w1l < t2h1d4 && t2w1l < t2w1rwt4 && t2w1l < t2w1lwt4 && t2w1l < t2h1uwt4 && t2w1l < t2h1dwt4
      && t2w1l < t2w1r5 && t2w1l < t2w1l5 && t2w1l < t2h1u5 && t2w1l < t2h1d5 && t2w1l < t2w1rwt5 && t2w1l < t2w1lwt5 && t2w1l < t2h1uwt5 && t2w1l < t2h1dwt5
      && t2w1l < t2w1r6 && t2w1l < t2w1l6 && t2w1l < t2h1u6 && t2w1l < t2h1d6 && t2w1l < t2w1rwt6 && t2w1l < t2w1lwt6 && t2w1l < t2h1uwt6 && t2w1l < t2h1dwt6
      && t2w1l < t2w1r7 && t2w1l < t2w1l7 && t2w1l < t2h1u7 && t2w1l < t2h1d7 && t2w1l < t2w1rwt7 && t2w1l < t2w1lwt7 && t2w1l < t2h1uwt7 && t2w1l < t2h1dwt7
      && t2w1l < t2w1r8 && t2w1l < t2w1l8 && t2w1l < t2h1u8 && t2w1l < t2h1d8 && t2w1l < t2w1rwt8 && t2w1l < t2w1lwt8 && t2w1l < t2h1uwt8 && t2w1l < t2h1dwt8
      && t2w1l < t2w1r9 && t2w1l < t2w1l9 && t2w1l < t2h1u9 && t2w1l < t2h1d9 && t2w1l < t2w1rwt9 && t2w1l < t2w1lwt9 && t2w1l < t2h1uwt9 && t2w1l < t2h1dwt9
      && t2w1l < t2w1r10 && t2w1l < t2w1l10 && t2w1l < t2h1u10 && t2w1l < t2h1d10 && t2w1l < t2w1rwt10 && t2w1l < t2w1lwt10 && t2w1l < t2h1uwt10 && t2w1l < t2h1dwt10
      && (loutwl==0 && linwl==0)){
  i=15;
  }

  if (myu==-1 && t2h1u > 0 && t2h1u < t1 
  && t2h1u < t2w1r && t2h1u < t2w1l && t2h1u < t2h1d && t2h1u < t2w1rwt && t2h1u < t2w1lwt && t2h1u < t2h1uwt && t2h1u < t2h1dwt
  && t2h1u < t2w1r1 && t2h1u < t2w1l1 && t2h1u < t2h1u1 && t2h1u < t2h1d1 && t2h1u < t2w1rwt1 && t2h1u < t2w1lwt1 && t2h1u < t2h1uwt1 && t2h1u < t2h1dwt1
  && t2h1u < t2w1r2 && t2h1u < t2w1l2 && t2h1u < t2h1u2 && t2h1u < t2h1d2 && t2h1u < t2w1rwt2 && t2h1u < t2w1lwt2 && t2h1u < t2h1uwt2 && t2h1u < t2h1dwt2
  && t2h1u < t2w1r3 && t2h1u < t2w1l3 && t2h1u < t2h1u3 && t2h1u < t2h1d3 && t2h1u < t2w1rwt3 && t2h1u < t2w1lwt3 && t2h1u < t2h1uwt3 && t2h1u < t2h1dwt3
  && t2h1u < t2w1r4 && t2h1u < t2w1l4 && t2h1u < t2h1u4 && t2h1u < t2h1d4 && t2h1u < t2w1rwt4 && t2h1u < t2w1lwt4 && t2h1u < t2h1uwt4 && t2h1u < t2h1dwt4
  && t2h1u < t2w1r5 && t2h1u < t2w1l5 && t2h1u < t2h1u5 && t2h1u < t2h1d5 && t2h1u < t2w1rwt5 && t2h1u < t2w1lwt5 && t2h1u < t2h1uwt5 && t2h1u < t2h1dwt5
  && t2h1u < t2w1r6 && t2h1u < t2w1l6 && t2h1u < t2h1u6 && t2h1u < t2h1d6 && t2h1u < t2w1rwt6 && t2h1u < t2w1lwt6 && t2h1u < t2h1uwt6 && t2h1u < t2h1dwt6
  && t2h1u < t2w1r7 && t2h1u < t2w1l7 && t2h1u < t2h1u7 && t2h1u < t2h1d7 && t2h1u < t2w1rwt7 && t2h1u < t2w1lwt7 && t2h1u < t2h1uwt7 && t2h1u < t2h1dwt7
  && t2h1u < t2w1r8 && t2h1u < t2w1l8 && t2h1u < t2h1u8 && t2h1u < t2h1d8 && t2h1u < t2w1rwt8 && t2h1u < t2w1lwt8 && t2h1u < t2h1uwt8 && t2h1u < t2h1dwt8
  && t2h1u < t2w1r9 && t2h1u < t2w1l9 && t2h1u < t2h1u9 && t2h1u < t2h1d9 && t2h1u < t2w1rwt9 && t2h1u < t2w1lwt9 && t2h1u < t2h1uwt9 && t2h1u < t2h1dwt9
  && t2h1u < t2w1r10 && t2h1u < t2w1l10 && t2h1u < t2h1u10 && t2h1u < t2h1d10 && t2h1u < t2w1rwt10 && t2h1u < t2w1lwt10 && t2h1u < t2h1uwt10 && t2h1u < t2h1dwt10
  && (louthu !=0 && linhu!=0)){
  i=16;
  }

  if (myu==-1 && t2h1u > 0 && t2h1u < t1 
  && t2h1u < t2w1r && t2h1u < t2w1l && t2h1u < t2h1d && t2h1u < t2w1rwt && t2h1u < t2w1lwt && t2h1u < t2h1uwt && t2h1u < t2h1dwt
  && t2h1u < t2w1r1 && t2h1u < t2w1l1 && t2h1u < t2h1u1 && t2h1u < t2h1d1 && t2h1u < t2w1rwt1 && t2h1u < t2w1lwt1 && t2h1u < t2h1uwt1 && t2h1u < t2h1dwt1
  && t2h1u < t2w1r2 && t2h1u < t2w1l2 && t2h1u < t2h1u2 && t2h1u < t2h1d2 && t2h1u < t2w1rwt2 && t2h1u < t2w1lwt2 && t2h1u < t2h1uwt2 && t2h1u < t2h1dwt2
  && t2h1u < t2w1r3 && t2h1u < t2w1l3 && t2h1u < t2h1u3 && t2h1u < t2h1d3 && t2h1u < t2w1rwt3 && t2h1u < t2w1lwt3 && t2h1u < t2h1uwt3 && t2h1u < t2h1dwt3
  && t2h1u < t2w1r4 && t2h1u < t2w1l4 && t2h1u < t2h1u4 && t2h1u < t2h1d4 && t2h1u < t2w1rwt4 && t2h1u < t2w1lwt4 && t2h1u < t2h1uwt4 && t2h1u < t2h1dwt4
  && t2h1u < t2w1r5 && t2h1u < t2w1l5 && t2h1u < t2h1u5 && t2h1u < t2h1d5 && t2h1u < t2w1rwt5 && t2h1u < t2w1lwt5 && t2h1u < t2h1uwt5 && t2h1u < t2h1dwt5
  && t2h1u < t2w1r6 && t2h1u < t2w1l6 && t2h1u < t2h1u6 && t2h1u < t2h1d6 && t2h1u < t2w1rwt6 && t2h1u < t2w1lwt6 && t2h1u < t2h1uwt6 && t2h1u < t2h1dwt6
  && t2h1u < t2w1r7 && t2h1u < t2w1l7 && t2h1u < t2h1u7 && t2h1u < t2h1d7 && t2h1u < t2w1rwt7 && t2h1u < t2w1lwt7 && t2h1u < t2h1uwt7 && t2h1u < t2h1dwt7
  && t2h1u < t2w1r8 && t2h1u < t2w1l8 && t2h1u < t2h1u8 && t2h1u < t2h1d8 && t2h1u < t2w1rwt8 && t2h1u < t2w1lwt8 && t2h1u < t2h1uwt8 && t2h1u < t2h1dwt8
  && t2h1u < t2w1r9 && t2h1u < t2w1l9 && t2h1u < t2h1u9 && t2h1u < t2h1d9 && t2h1u < t2w1rwt9 && t2h1u < t2w1lwt9 && t2h1u < t2h1uwt9 && t2h1u < t2h1dwt9
  && t2h1u < t2w1r10 && t2h1u < t2w1l10 && t2h1u < t2h1u10 && t2h1u < t2h1d10 && t2h1u < t2w1rwt10 && t2h1u < t2w1lwt10 && t2h1u < t2h1uwt10 && t2h1u < t2h1dwt10
  && ((louthu!=0 && linhu==0) || (louthu==0 && linhu!=0))){
  i=16;
  }

  if (myu==-1 && t2h1u > 0 && t2h1u < t1 
  && t2h1u < t2w1r && t2h1u < t2w1l && t2h1u < t2h1d && t2h1u < t2w1rwt && t2h1u < t2w1lwt && t2h1u < t2h1uwt && t2h1u < t2h1dwt
  && t2h1u < t2w1r1 && t2h1u < t2w1l1 && t2h1u < t2h1u1 && t2h1u < t2h1d1 && t2h1u < t2w1rwt1 && t2h1u < t2w1lwt1 && t2h1u < t2h1uwt1 && t2h1u < t2h1dwt1
  && t2h1u < t2w1r2 && t2h1u < t2w1l2 && t2h1u < t2h1u2 && t2h1u < t2h1d2 && t2h1u < t2w1rwt2 && t2h1u < t2w1lwt2 && t2h1u < t2h1uwt2 && t2h1u < t2h1dwt2
  && t2h1u < t2w1r3 && t2h1u < t2w1l3 && t2h1u < t2h1u3 && t2h1u < t2h1d3 && t2h1u < t2w1rwt3 && t2h1u < t2w1lwt3 && t2h1u < t2h1uwt3 && t2h1u < t2h1dwt3
  && t2h1u < t2w1r4 && t2h1u < t2w1l4 && t2h1u < t2h1u4 && t2h1u < t2h1d4 && t2h1u < t2w1rwt4 && t2h1u < t2w1lwt4 && t2h1u < t2h1uwt4 && t2h1u < t2h1dwt4
  && t2h1u < t2w1r5 && t2h1u < t2w1l5 && t2h1u < t2h1u5 && t2h1u < t2h1d5 && t2h1u < t2w1rwt5 && t2h1u < t2w1lwt5 && t2h1u < t2h1uwt5 && t2h1u < t2h1dwt5
  && t2h1u < t2w1r6 && t2h1u < t2w1l6 && t2h1u < t2h1u6 && t2h1u < t2h1d6 && t2h1u < t2w1rwt6 && t2h1u < t2w1lwt6 && t2h1u < t2h1uwt6 && t2h1u < t2h1dwt6
  && t2h1u < t2w1r7 && t2h1u < t2w1l7 && t2h1u < t2h1u7 && t2h1u < t2h1d7 && t2h1u < t2w1rwt7 && t2h1u < t2w1lwt7 && t2h1u < t2h1uwt7 && t2h1u < t2h1dwt7
  && t2h1u < t2w1r8 && t2h1u < t2w1l8 && t2h1u < t2h1u8 && t2h1u < t2h1d8 && t2h1u < t2w1rwt8 && t2h1u < t2w1lwt8 && t2h1u < t2h1uwt8 && t2h1u < t2h1dwt8
  && t2h1u < t2w1r9 && t2h1u < t2w1l9 && t2h1u < t2h1u9 && t2h1u < t2h1d9 && t2h1u < t2w1rwt9 && t2h1u < t2w1lwt9 && t2h1u < t2h1uwt9 && t2h1u < t2h1dwt9
  && t2h1u < t2w1r10 && t2h1u < t2w1l10 && t2h1u < t2h1u10 && t2h1u < t2h1d10 && t2h1u < t2w1rwt10 && t2h1u < t2w1lwt10 && t2h1u < t2h1uwt10 && t2h1u < t2h1dwt10
  && (louthu == 0 && linhu == 0)){
  i=16;
  }

  if (myd==-1 && t2h1d > 0 && t2h1d < t1 
  && t2h1d < t2w1r && t2h1d < t2w1l && t2h1d < t2h1u && t2h1d < t2w1rwt && t2h1d < t2w1lwt && t2h1d < t2h1uwt && t2h1d < t2h1dwt
  && t2h1d < t2w1r1 && t2h1d < t2w1l1 && t2h1d < t2h1u1 && t2h1d < t2h1d1 && t2h1d < t2w1rwt1 && t2h1d < t2w1lwt1 && t2h1d < t2h1uwt1 && t2h1d < t2h1dwt1
  && t2h1d < t2w1r2 && t2h1d < t2w1l2 && t2h1d < t2h1u2 && t2h1d < t2h1d2 && t2h1d < t2w1rwt2 && t2h1d < t2w1lwt2 && t2h1d < t2h1uwt2 && t2h1d < t2h1dwt2
  && t2h1d < t2w1r3 && t2h1d < t2w1l3 && t2h1d < t2h1u3 && t2h1d < t2h1d3 && t2h1d < t2w1rwt3 && t2h1d < t2w1lwt3 && t2h1d < t2h1uwt3 && t2h1d < t2h1dwt3
  && t2h1d < t2w1r4 && t2h1d < t2w1l4 && t2h1d < t2h1u4 && t2h1d < t2h1d4 && t2h1d < t2w1rwt4 && t2h1d < t2w1lwt4 && t2h1d < t2h1uwt4 && t2h1d < t2h1dwt4
  && t2h1d < t2w1r5 && t2h1d < t2w1l5 && t2h1d < t2h1u5 && t2h1d < t2h1d5 && t2h1d < t2w1rwt5 && t2h1d < t2w1lwt5 && t2h1d < t2h1uwt5 && t2h1d < t2h1dwt5
  && t2h1d < t2w1r6 && t2h1d < t2w1l6 && t2h1d < t2h1u6 && t2h1d < t2h1d6 && t2h1d < t2w1rwt6 && t2h1d < t2w1lwt6 && t2h1d < t2h1uwt6 && t2h1d < t2h1dwt6
  && t2h1d < t2w1r7 && t2h1d < t2w1l7 && t2h1d < t2h1u7 && t2h1d < t2h1d7 && t2h1d < t2w1rwt7 && t2h1d < t2w1lwt7 && t2h1d < t2h1uwt7 && t2h1d < t2h1dwt7
  && t2h1d < t2w1r8 && t2h1d < t2w1l8 && t2h1d < t2h1u8 && t2h1d < t2h1d8 && t2h1d < t2w1rwt8 && t2h1d < t2w1lwt8 && t2h1d < t2h1uwt8 && t2h1d < t2h1dwt8
  && t2h1d < t2w1r9 && t2h1d < t2w1l9 && t2h1d < t2h1u9 && t2h1d < t2h1d9 && t2h1d < t2w1rwt9 && t2h1d < t2w1lwt9 && t2h1d < t2h1uwt9 && t2h1d < t2h1dwt9
  && t2h1d < t2w1r10 && t2h1d < t2w1l10 && t2h1d < t2h1u10 && t2h1d < t2h1d10 && t2h1d < t2w1rwt10 && t2h1d < t2w1lwt10 && t2h1d < t2h1uwt10 && t2h1d < t2h1dwt10
  && (louthd !=0 && linhd!=0)){
  i=17;
  }

  if (myd==-1 && t2h1d > 0 && t2h1d < t1 
  && t2h1d < t2w1r && t2h1d < t2w1l && t2h1d < t2h1u && t2h1d < t2w1rwt && t2h1d < t2w1lwt && t2h1d < t2h1uwt && t2h1d < t2h1dwt
  && t2h1d < t2w1r1 && t2h1d < t2w1l1 && t2h1d < t2h1u1 && t2h1d < t2h1d1 && t2h1d < t2w1rwt1 && t2h1d < t2w1lwt1 && t2h1d < t2h1uwt1 && t2h1d < t2h1dwt1
  && t2h1d < t2w1r2 && t2h1d < t2w1l2 && t2h1d < t2h1u2 && t2h1d < t2h1d2 && t2h1d < t2w1rwt2 && t2h1d < t2w1lwt2 && t2h1d < t2h1uwt2 && t2h1d < t2h1dwt2
  && t2h1d < t2w1r3 && t2h1d < t2w1l3 && t2h1d < t2h1u3 && t2h1d < t2h1d3 && t2h1d < t2w1rwt3 && t2h1d < t2w1lwt3 && t2h1d < t2h1uwt3 && t2h1d < t2h1dwt3
  && t2h1d < t2w1r4 && t2h1d < t2w1l4 && t2h1d < t2h1u4 && t2h1d < t2h1d4 && t2h1d < t2w1rwt4 && t2h1d < t2w1lwt4 && t2h1d < t2h1uwt4 && t2h1d < t2h1dwt4
  && t2h1d < t2w1r5 && t2h1d < t2w1l5 && t2h1d < t2h1u5 && t2h1d < t2h1d5 && t2h1d < t2w1rwt5 && t2h1d < t2w1lwt5 && t2h1d < t2h1uwt5 && t2h1d < t2h1dwt5
  && t2h1d < t2w1r6 && t2h1d < t2w1l6 && t2h1d < t2h1u6 && t2h1d < t2h1d6 && t2h1d < t2w1rwt6 && t2h1d < t2w1lwt6 && t2h1d < t2h1uwt6 && t2h1d < t2h1dwt6
  && t2h1d < t2w1r7 && t2h1d < t2w1l7 && t2h1d < t2h1u7 && t2h1d < t2h1d7 && t2h1d < t2w1rwt7 && t2h1d < t2w1lwt7 && t2h1d < t2h1uwt7 && t2h1d < t2h1dwt7
  && t2h1d < t2w1r8 && t2h1d < t2w1l8 && t2h1d < t2h1u8 && t2h1d < t2h1d8 && t2h1d < t2w1rwt8 && t2h1d < t2w1lwt8 && t2h1d < t2h1uwt8 && t2h1d < t2h1dwt8
  && t2h1d < t2w1r9 && t2h1d < t2w1l9 && t2h1d < t2h1u9 && t2h1d < t2h1d9 && t2h1d < t2w1rwt9 && t2h1d < t2w1lwt9 && t2h1d < t2h1uwt9 && t2h1d < t2h1dwt9
  && t2h1d < t2w1r10 && t2h1d < t2w1l10 && t2h1d < t2h1u10 && t2h1d < t2h1d10 && t2h1d < t2w1rwt10 && t2h1d < t2w1lwt10 && t2h1d < t2h1uwt10 && t2h1d < t2h1dwt10
  && ((louthd !=0 && linhd==0) || (louthd ==0 && linhd!=0))){
  i=17;
  }

  if (myd==-1 && t2h1d > 0 && t2h1d < t1 
  && t2h1d < t2w1r && t2h1d < t2w1l && t2h1d < t2h1u && t2h1d < t2w1rwt && t2h1d < t2w1lwt && t2h1d < t2h1uwt && t2h1d < t2h1dwt
  && t2h1d < t2w1r1 && t2h1d < t2w1l1 && t2h1d < t2h1u1 && t2h1d < t2h1d1 && t2h1d < t2w1rwt1 && t2h1d < t2w1lwt1 && t2h1d < t2h1uwt1 && t2h1d < t2h1dwt1
  && t2h1d < t2w1r2 && t2h1d < t2w1l2 && t2h1d < t2h1u2 && t2h1d < t2h1d2 && t2h1d < t2w1rwt2 && t2h1d < t2w1lwt2 && t2h1d < t2h1uwt2 && t2h1d < t2h1dwt2
  && t2h1d < t2w1r3 && t2h1d < t2w1l3 && t2h1d < t2h1u3 && t2h1d < t2h1d3 && t2h1d < t2w1rwt3 && t2h1d < t2w1lwt3 && t2h1d < t2h1uwt3 && t2h1d < t2h1dwt3
  && t2h1d < t2w1r4 && t2h1d < t2w1l4 && t2h1d < t2h1u4 && t2h1d < t2h1d4 && t2h1d < t2w1rwt4 && t2h1d < t2w1lwt4 && t2h1d < t2h1uwt4 && t2h1d < t2h1dwt4
  && t2h1d < t2w1r5 && t2h1d < t2w1l5 && t2h1d < t2h1u5 && t2h1d < t2h1d5 && t2h1d < t2w1rwt5 && t2h1d < t2w1lwt5 && t2h1d < t2h1uwt5 && t2h1d < t2h1dwt5
  && t2h1d < t2w1r6 && t2h1d < t2w1l6 && t2h1d < t2h1u6 && t2h1d < t2h1d6 && t2h1d < t2w1rwt6 && t2h1d < t2w1lwt6 && t2h1d < t2h1uwt6 && t2h1d < t2h1dwt6
  && t2h1d < t2w1r7 && t2h1d < t2w1l7 && t2h1d < t2h1u7 && t2h1d < t2h1d7 && t2h1d < t2w1rwt7 && t2h1d < t2w1lwt7 && t2h1d < t2h1uwt7 && t2h1d < t2h1dwt7
  && t2h1d < t2w1r8 && t2h1d < t2w1l8 && t2h1d < t2h1u8 && t2h1d < t2h1d8 && t2h1d < t2w1rwt8 && t2h1d < t2w1lwt8 && t2h1d < t2h1uwt8 && t2h1d < t2h1dwt8
  && t2h1d < t2w1r9 && t2h1d < t2w1l9 && t2h1d < t2h1u9 && t2h1d < t2h1d9 && t2h1d < t2w1rwt9 && t2h1d < t2w1lwt9 && t2h1d < t2h1uwt9 && t2h1d < t2h1dwt9
  && t2h1d < t2w1r10 && t2h1d < t2w1l10 && t2h1d < t2h1u10 && t2h1d < t2h1d10 && t2h1d < t2w1rwt10 && t2h1d < t2w1lwt10 && t2h1d < t2h1uwt10 && t2h1d < t2h1dwt10
  && (louthd == 0 && linhd == 0)){
  i=17;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW!=-1 && t2w1rwt > 0 && t2w1rwt < t1 
  && t2w1rwt < t2w1r && t2w1rwt < t2w1l && t2w1rwt < t2h1u && t2w1rwt < t2h1d && t2w1rwt <t2w1lwt && t2w1rwt < t2h1uwt && t2w1rwt < t2h1dwt
  && t2w1rwt < t2w1r1 && t2w1rwt < t2w1l1 && t2w1rwt < t2h1u1 && t2w1rwt < t2h1d1 && t2w1rwt <t2w1rwt1 && t2w1rwt <t2w1lwt1 && t2w1rwt < t2h1uwt1 && t2w1rwt < t2h1dwt1
  && t2w1rwt < t2w1r2 && t2w1rwt < t2w1l2 && t2w1rwt < t2h1u2 && t2w1rwt < t2h1d2 && t2w1rwt <t2w1rwt2 && t2w1rwt <t2w1lwt2 && t2w1rwt < t2h1uwt2 && t2w1rwt < t2h1dwt2
  && t2w1rwt < t2w1r3 && t2w1rwt < t2w1l3 && t2w1rwt < t2h1u3 && t2w1rwt < t2h1d3 && t2w1rwt <t2w1rwt3 && t2w1rwt <t2w1lwt3 && t2w1rwt < t2h1uwt3 && t2w1rwt < t2h1dwt3
  && t2w1rwt < t2w1r4 && t2w1rwt < t2w1l4 && t2w1rwt < t2h1u4 && t2w1rwt < t2h1d4 && t2w1rwt <t2w1rwt4 && t2w1rwt <t2w1lwt4 && t2w1rwt < t2h1uwt4 && t2w1rwt < t2h1dwt4
  && t2w1rwt < t2w1r5 && t2w1rwt < t2w1l5 && t2w1rwt < t2h1u5 && t2w1rwt < t2h1d5 && t2w1rwt <t2w1rwt5 && t2w1rwt <t2w1lwt5 && t2w1rwt < t2h1uwt5 && t2w1rwt < t2h1dwt5
  && t2w1rwt < t2w1r6 && t2w1rwt < t2w1l6 && t2w1rwt < t2h1u6 && t2w1rwt < t2h1d6 && t2w1rwt <t2w1rwt6 && t2w1rwt <t2w1lwt6 && t2w1rwt < t2h1uwt6 && t2w1rwt < t2h1dwt6
  && t2w1rwt < t2w1r7 && t2w1rwt < t2w1l7 && t2w1rwt < t2h1u7 && t2w1rwt < t2h1d7 && t2w1rwt <t2w1rwt7 && t2w1rwt <t2w1lwt7 && t2w1rwt < t2h1uwt7 && t2w1rwt < t2h1dwt7
  && t2w1rwt < t2w1r8 && t2w1rwt < t2w1l8 && t2w1rwt < t2h1u8 && t2w1rwt < t2h1d8 && t2w1rwt <t2w1rwt8 && t2w1rwt <t2w1lwt8 && t2w1rwt < t2h1uwt8 && t2w1rwt < t2h1dwt8
  && t2w1rwt < t2w1r9 && t2w1rwt < t2w1l9 && t2w1rwt < t2h1u9 && t2w1rwt < t2h1d9 && t2w1rwt <t2w1rwt9 && t2w1rwt <t2w1lwt9 && t2w1rwt < t2h1uwt9 && t2w1rwt < t2h1dwt9
  && t2w1rwt < t2w1r10 && t2w1rwt < t2w1l10 && t2w1rwt < t2h1u10 && t2w1rwt < t2h1d10 && t2w1rwt <t2w1rwt10 && t2w1rwt <t2w1lwt10 && t2w1rwt < t2h1uwt10 && t2w1rwt < t2h1dwt10
  && ((linwr!=0) && (loutwr!=0) )){	
   if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1rwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1rwt+z))*(z0hd+(vz*t2w1rwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1rwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1rwt+z))*(z0hu+(vz*t2w1rwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1rwt+y;
  xtest=vx*t2w1rwt+x;
  xlimitrwt=-bwrwt*sqrt(1-((vz*t2w1rwt+z)+z0wr)*((vz*t2w1rwt+z)+z0wr)/a2wrwt);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW > 0){
  i=22;
  }
  else{
  i=34;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW!=-1 && t2w1rwt > 0 && t2w1rwt < t1 
  && t2w1rwt < t2w1r && t2w1rwt < t2w1l && t2w1rwt < t2h1u && t2w1rwt < t2h1d && t2w1rwt <t2w1lwt && t2w1rwt < t2h1uwt && t2w1rwt < t2h1dwt
  && t2w1rwt < t2w1r1 && t2w1rwt < t2w1l1 && t2w1rwt < t2h1u1 && t2w1rwt < t2h1d1 && t2w1rwt <t2w1rwt1 && t2w1rwt <t2w1lwt1 && t2w1rwt < t2h1uwt1 && t2w1rwt < t2h1dwt1
  && t2w1rwt < t2w1r2 && t2w1rwt < t2w1l2 && t2w1rwt < t2h1u2 && t2w1rwt < t2h1d2 && t2w1rwt <t2w1rwt2 && t2w1rwt <t2w1lwt2 && t2w1rwt < t2h1uwt2 && t2w1rwt < t2h1dwt2
  && t2w1rwt < t2w1r3 && t2w1rwt < t2w1l3 && t2w1rwt < t2h1u3 && t2w1rwt < t2h1d3 && t2w1rwt <t2w1rwt3 && t2w1rwt <t2w1lwt3 && t2w1rwt < t2h1uwt3 && t2w1rwt < t2h1dwt3
  && t2w1rwt < t2w1r4 && t2w1rwt < t2w1l4 && t2w1rwt < t2h1u4 && t2w1rwt < t2h1d4 && t2w1rwt <t2w1rwt4 && t2w1rwt <t2w1lwt4 && t2w1rwt < t2h1uwt4 && t2w1rwt < t2h1dwt4
  && t2w1rwt < t2w1r5 && t2w1rwt < t2w1l5 && t2w1rwt < t2h1u5 && t2w1rwt < t2h1d5 && t2w1rwt <t2w1rwt5 && t2w1rwt <t2w1lwt5 && t2w1rwt < t2h1uwt5 && t2w1rwt < t2h1dwt5
  && t2w1rwt < t2w1r6 && t2w1rwt < t2w1l6 && t2w1rwt < t2h1u6 && t2w1rwt < t2h1d6 && t2w1rwt <t2w1rwt6 && t2w1rwt <t2w1lwt6 && t2w1rwt < t2h1uwt6 && t2w1rwt < t2h1dwt6
  && t2w1rwt < t2w1r7 && t2w1rwt < t2w1l7 && t2w1rwt < t2h1u7 && t2w1rwt < t2h1d7 && t2w1rwt <t2w1rwt7 && t2w1rwt <t2w1lwt7 && t2w1rwt < t2h1uwt7 && t2w1rwt < t2h1dwt7
  && t2w1rwt < t2w1r8 && t2w1rwt < t2w1l8 && t2w1rwt < t2h1u8 && t2w1rwt < t2h1d8 && t2w1rwt <t2w1rwt8 && t2w1rwt <t2w1lwt8 && t2w1rwt < t2h1uwt8 && t2w1rwt < t2h1dwt8
  && t2w1rwt < t2w1r9 && t2w1rwt < t2w1l9 && t2w1rwt < t2h1u9 && t2w1rwt < t2h1d9 && t2w1rwt <t2w1rwt9 && t2w1rwt <t2w1lwt9 && t2w1rwt < t2h1uwt9 && t2w1rwt < t2h1dwt9
  && t2w1rwt < t2w1r10 && t2w1rwt < t2w1l10 && t2w1rwt < t2h1u10 && t2w1rwt < t2h1d10 && t2w1rwt <t2w1rwt10 && t2w1rwt <t2w1lwt10 && t2w1rwt < t2h1uwt10 && t2w1rwt < t2h1dwt10
  && ((loutwr!=0 && linwr==0) || (loutwr==0 && linwr!=0))){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1rwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1rwt+z))*(z0hd+(vz*t2w1rwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1rwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1rwt+z))*(z0hu+(vz*t2w1rwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1rwt+y;
  xtest=vx*t2w1rwt+x;
  xlimitr=-sqrt((pbwrwt-(vz*t2w1rwt+z))/pawrwt);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW > 0){
  i=23; 
  }else{
  i=34;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW!=-1 && t2w1rwt > 0 && t2w1rwt < t1 
  && t2w1rwt < t2w1r && t2w1rwt < t2w1l && t2w1rwt < t2h1u && t2w1rwt < t2h1d && t2w1rwt <t2w1lwt && t2w1rwt < t2h1uwt && t2w1rwt < t2h1dwt
  && t2w1rwt < t2w1r1 && t2w1rwt < t2w1l1 && t2w1rwt < t2h1u1 && t2w1rwt < t2h1d1 && t2w1rwt <t2w1rwt1 && t2w1rwt <t2w1lwt1 && t2w1rwt < t2h1uwt1 && t2w1rwt < t2h1dwt1
  && t2w1rwt < t2w1r2 && t2w1rwt < t2w1l2 && t2w1rwt < t2h1u2 && t2w1rwt < t2h1d2 && t2w1rwt <t2w1rwt2 && t2w1rwt <t2w1lwt2 && t2w1rwt < t2h1uwt2 && t2w1rwt < t2h1dwt2
  && t2w1rwt < t2w1r3 && t2w1rwt < t2w1l3 && t2w1rwt < t2h1u3 && t2w1rwt < t2h1d3 && t2w1rwt <t2w1rwt3 && t2w1rwt <t2w1lwt3 && t2w1rwt < t2h1uwt3 && t2w1rwt < t2h1dwt3
  && t2w1rwt < t2w1r4 && t2w1rwt < t2w1l4 && t2w1rwt < t2h1u4 && t2w1rwt < t2h1d4 && t2w1rwt <t2w1rwt4 && t2w1rwt <t2w1lwt4 && t2w1rwt < t2h1uwt4 && t2w1rwt < t2h1dwt4
  && t2w1rwt < t2w1r5 && t2w1rwt < t2w1l5 && t2w1rwt < t2h1u5 && t2w1rwt < t2h1d5 && t2w1rwt <t2w1rwt5 && t2w1rwt <t2w1lwt5 && t2w1rwt < t2h1uwt5 && t2w1rwt < t2h1dwt5
  && t2w1rwt < t2w1r6 && t2w1rwt < t2w1l6 && t2w1rwt < t2h1u6 && t2w1rwt < t2h1d6 && t2w1rwt <t2w1rwt6 && t2w1rwt <t2w1lwt6 && t2w1rwt < t2h1uwt6 && t2w1rwt < t2h1dwt6
  && t2w1rwt < t2w1r7 && t2w1rwt < t2w1l7 && t2w1rwt < t2h1u7 && t2w1rwt < t2h1d7 && t2w1rwt <t2w1rwt7 && t2w1rwt <t2w1lwt7 && t2w1rwt < t2h1uwt7 && t2w1rwt < t2h1dwt7
  && t2w1rwt < t2w1r8 && t2w1rwt < t2w1l8 && t2w1rwt < t2h1u8 && t2w1rwt < t2h1d8 && t2w1rwt <t2w1rwt8 && t2w1rwt <t2w1lwt8 && t2w1rwt < t2h1uwt8 && t2w1rwt < t2h1dwt8
  && t2w1rwt < t2w1r9 && t2w1rwt < t2w1l9 && t2w1rwt < t2h1u9 && t2w1rwt < t2h1d9 && t2w1rwt <t2w1rwt9 && t2w1rwt <t2w1lwt9 && t2w1rwt < t2h1uwt9 && t2w1rwt < t2h1dwt9
  && t2w1rwt < t2w1r10 && t2w1rwt < t2w1l10 && t2w1rwt < t2h1u10 && t2w1rwt < t2h1d10 && t2w1rwt <t2w1rwt10 && t2w1rwt <t2w1lwt10 && t2w1rwt < t2h1uwt10 && t2w1rwt < t2h1dwt10
  && (loutwr==0 && linwr==0)){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1rwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1rwt+z))*(z0hd+(vz*t2w1rwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1rwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1rwt+z))*(z0hu+(vz*t2w1rwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1rwt+y; 
  xtest=vx*t2w1rwt+x;
  xlimitr=-(-w2r+w1r)*(vz*t2w1rwt+z)/l-w1rwt;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW>0){
  i=24;
  }else{
  i=34;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW!=-1 && t2w1lwt > 0 && t2w1lwt < t1 
  && t2w1lwt < t2w1r && t2w1lwt < t2w1l && t2w1lwt < t2h1u && t2w1lwt < t2h1d && t2w1lwt <t2w1rwt && t2w1lwt < t2h1uwt && t2w1lwt < t2h1dwt
  && t2w1lwt < t2w1r1 && t2w1lwt < t2w1l1 && t2w1lwt < t2h1u1 && t2w1lwt < t2h1d1 && t2w1lwt <t2w1rwt1 && t2w1lwt <t2w1lwt1 && t2w1lwt < t2h1uwt1 && t2w1lwt < t2h1dwt1
  && t2w1lwt < t2w1r2 && t2w1lwt < t2w1l2 && t2w1lwt < t2h1u2 && t2w1lwt < t2h1d2 && t2w1lwt <t2w1rwt2 && t2w1lwt <t2w1lwt2 && t2w1lwt < t2h1uwt2 && t2w1lwt < t2h1dwt2
  && t2w1lwt < t2w1r3 && t2w1lwt < t2w1l3 && t2w1lwt < t2h1u3 && t2w1lwt < t2h1d3 && t2w1lwt <t2w1rwt3 && t2w1lwt <t2w1lwt3 && t2w1lwt < t2h1uwt3 && t2w1lwt < t2h1dwt3
  && t2w1lwt < t2w1r4 && t2w1lwt < t2w1l4 && t2w1lwt < t2h1u4 && t2w1lwt < t2h1d4 && t2w1lwt <t2w1rwt4 && t2w1lwt <t2w1lwt4 && t2w1lwt < t2h1uwt4 && t2w1lwt < t2h1dwt4
  && t2w1lwt < t2w1r5 && t2w1lwt < t2w1l5 && t2w1lwt < t2h1u5 && t2w1lwt < t2h1d5 && t2w1lwt <t2w1rwt5 && t2w1lwt <t2w1lwt5 && t2w1lwt < t2h1uwt5 && t2w1lwt < t2h1dwt5
  && t2w1lwt < t2w1r6 && t2w1lwt < t2w1l6 && t2w1lwt < t2h1u6 && t2w1lwt < t2h1d6 && t2w1lwt <t2w1rwt6 && t2w1lwt <t2w1lwt6 && t2w1lwt < t2h1uwt6 && t2w1lwt < t2h1dwt6
  && t2w1lwt < t2w1r7 && t2w1lwt < t2w1l7 && t2w1lwt < t2h1u7 && t2w1lwt < t2h1d7 && t2w1lwt <t2w1rwt7 && t2w1lwt <t2w1lwt7 && t2w1lwt < t2h1uwt7 && t2w1lwt < t2h1dwt7
  && t2w1lwt < t2w1r8 && t2w1lwt < t2w1l8 && t2w1lwt < t2h1u8 && t2w1lwt < t2h1d8 && t2w1lwt <t2w1rwt8 && t2w1lwt <t2w1lwt8 && t2w1lwt < t2h1uwt8 && t2w1lwt < t2h1dwt8
  && t2w1lwt < t2w1r9 && t2w1lwt < t2w1l9 && t2w1lwt < t2h1u9 && t2w1lwt < t2h1d9 && t2w1lwt <t2w1rwt9 && t2w1lwt <t2w1lwt9 && t2w1lwt < t2h1uwt9 && t2w1lwt < t2h1dwt9
  && t2w1lwt < t2w1r10 && t2w1lwt < t2w1l10 && t2w1lwt < t2h1u10 && t2w1lwt < t2h1d10 && t2w1lwt <t2w1rwt10 && t2w1lwt <t2w1lwt10 && t2w1lwt < t2h1uwt10 && t2w1lwt < t2h1dwt10
  && ((linwl!=0) && (loutwl!=0) )){
  if(linhd==0 && louthd==0)
   if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1lwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1lwt+z))*(z0hd+(vz*t2w1lwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1lwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1lwt+z))*(z0hu+(vz*t2w1lwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1lwt+y;
  xtest=vx*t2w1lwt+x;
  xlimitlwt=-bwlwt*sqrt(1-((vz*t2w1lwt+z)+z0wl)*((vz*t2w1lwt+z)+z0wl)/a2wlwt);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW>0){
  i=25;
  }else{
  i=35;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW!=-1 && t2w1lwt > 0 && t2w1lwt < t1 
  && t2w1lwt < t2w1r && t2w1lwt < t2w1l && t2w1lwt < t2h1u && t2w1lwt < t2h1d && t2w1lwt <t2w1rwt && t2w1lwt < t2h1uwt && t2w1lwt < t2h1dwt
  && t2w1lwt < t2w1r1 && t2w1lwt < t2w1l1 && t2w1lwt < t2h1u1 && t2w1lwt < t2h1d1 && t2w1lwt <t2w1rwt1 && t2w1lwt <t2w1lwt1 && t2w1lwt < t2h1uwt1 && t2w1lwt < t2h1dwt1
  && t2w1lwt < t2w1r2 && t2w1lwt < t2w1l2 && t2w1lwt < t2h1u2 && t2w1lwt < t2h1d2 && t2w1lwt <t2w1rwt2 && t2w1lwt <t2w1lwt2 && t2w1lwt < t2h1uwt2 && t2w1lwt < t2h1dwt2
  && t2w1lwt < t2w1r3 && t2w1lwt < t2w1l3 && t2w1lwt < t2h1u3 && t2w1lwt < t2h1d3 && t2w1lwt <t2w1rwt3 && t2w1lwt <t2w1lwt3 && t2w1lwt < t2h1uwt3 && t2w1lwt < t2h1dwt3
  && t2w1lwt < t2w1r4 && t2w1lwt < t2w1l4 && t2w1lwt < t2h1u4 && t2w1lwt < t2h1d4 && t2w1lwt <t2w1rwt4 && t2w1lwt <t2w1lwt4 && t2w1lwt < t2h1uwt4 && t2w1lwt < t2h1dwt4
  && t2w1lwt < t2w1r5 && t2w1lwt < t2w1l5 && t2w1lwt < t2h1u5 && t2w1lwt < t2h1d5 && t2w1lwt <t2w1rwt5 && t2w1lwt <t2w1lwt5 && t2w1lwt < t2h1uwt5 && t2w1lwt < t2h1dwt5
  && t2w1lwt < t2w1r6 && t2w1lwt < t2w1l6 && t2w1lwt < t2h1u6 && t2w1lwt < t2h1d6 && t2w1lwt <t2w1rwt6 && t2w1lwt <t2w1lwt6 && t2w1lwt < t2h1uwt6 && t2w1lwt < t2h1dwt6
  && t2w1lwt < t2w1r7 && t2w1lwt < t2w1l7 && t2w1lwt < t2h1u7 && t2w1lwt < t2h1d7 && t2w1lwt <t2w1rwt7 && t2w1lwt <t2w1lwt7 && t2w1lwt < t2h1uwt7 && t2w1lwt < t2h1dwt7
  && t2w1lwt < t2w1r8 && t2w1lwt < t2w1l8 && t2w1lwt < t2h1u8 && t2w1lwt < t2h1d8 && t2w1lwt <t2w1rwt8 && t2w1lwt <t2w1lwt8 && t2w1lwt < t2h1uwt8 && t2w1lwt < t2h1dwt8
  && t2w1lwt < t2w1r9 && t2w1lwt < t2w1l9 && t2w1lwt < t2h1u9 && t2w1lwt < t2h1d9 && t2w1lwt <t2w1rwt9 && t2w1lwt <t2w1lwt9 && t2w1lwt < t2h1uwt9 && t2w1lwt < t2h1dwt9
  && t2w1lwt < t2w1r10 && t2w1lwt < t2w1l10 && t2w1lwt < t2h1u10 && t2w1lwt < t2h1d10 && t2w1lwt <t2w1rwt10 && t2w1lwt <t2w1lwt10 && t2w1lwt < t2h1uwt10 && t2w1lwt < t2h1dwt10
  && ((loutwl!=0 && linwl==0) || (loutwl==0 && linwl!=0))){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1lwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1lwt+z))*(z0hd+(vz*t2w1lwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1lwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1lwt+z))*(z0hu+(vz*t2w1lwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1lwt+y;
  xtest=vx*t2w1lwt+x;
  xlimitl=-sqrt((pbwlwt-(vz*t2w1lwt+z))/pawlwt);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW>0){
  i=26;
  }else{
  i=35;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW!=-1 && t2w1lwt > 0 && t2w1lwt < t1 
  && t2w1lwt < t2w1r && t2w1lwt < t2w1l && t2w1lwt < t2h1u && t2w1lwt < t2h1d && t2w1lwt <t2w1rwt && t2w1lwt < t2h1uwt && t2w1lwt < t2h1dwt
  && t2w1lwt < t2w1r1 && t2w1lwt < t2w1l1 && t2w1lwt < t2h1u1 && t2w1lwt < t2h1d1 && t2w1lwt <t2w1rwt1 && t2w1lwt <t2w1lwt1 && t2w1lwt < t2h1uwt1 && t2w1lwt < t2h1dwt1
  && t2w1lwt < t2w1r2 && t2w1lwt < t2w1l2 && t2w1lwt < t2h1u2 && t2w1lwt < t2h1d2 && t2w1lwt <t2w1rwt2 && t2w1lwt <t2w1lwt2 && t2w1lwt < t2h1uwt2 && t2w1lwt < t2h1dwt2
  && t2w1lwt < t2w1r3 && t2w1lwt < t2w1l3 && t2w1lwt < t2h1u3 && t2w1lwt < t2h1d3 && t2w1lwt <t2w1rwt3 && t2w1lwt <t2w1lwt3 && t2w1lwt < t2h1uwt3 && t2w1lwt < t2h1dwt3
  && t2w1lwt < t2w1r4 && t2w1lwt < t2w1l4 && t2w1lwt < t2h1u4 && t2w1lwt < t2h1d4 && t2w1lwt <t2w1rwt4 && t2w1lwt <t2w1lwt4 && t2w1lwt < t2h1uwt4 && t2w1lwt < t2h1dwt4
  && t2w1lwt < t2w1r5 && t2w1lwt < t2w1l5 && t2w1lwt < t2h1u5 && t2w1lwt < t2h1d5 && t2w1lwt <t2w1rwt5 && t2w1lwt <t2w1lwt5 && t2w1lwt < t2h1uwt5 && t2w1lwt < t2h1dwt5
  && t2w1lwt < t2w1r6 && t2w1lwt < t2w1l6 && t2w1lwt < t2h1u6 && t2w1lwt < t2h1d6 && t2w1lwt <t2w1rwt6 && t2w1lwt <t2w1lwt6 && t2w1lwt < t2h1uwt6 && t2w1lwt < t2h1dwt6
  && t2w1lwt < t2w1r7 && t2w1lwt < t2w1l7 && t2w1lwt < t2h1u7 && t2w1lwt < t2h1d7 && t2w1lwt <t2w1rwt7 && t2w1lwt <t2w1lwt7 && t2w1lwt < t2h1uwt7 && t2w1lwt < t2h1dwt7
  && t2w1lwt < t2w1r8 && t2w1lwt < t2w1l8 && t2w1lwt < t2h1u8 && t2w1lwt < t2h1d8 && t2w1lwt <t2w1rwt8 && t2w1lwt <t2w1lwt8 && t2w1lwt < t2h1uwt8 && t2w1lwt < t2h1dwt8
  && t2w1lwt < t2w1r9 && t2w1lwt < t2w1l9 && t2w1lwt < t2h1u9 && t2w1lwt < t2h1d9 && t2w1lwt <t2w1rwt9 && t2w1lwt <t2w1lwt9 && t2w1lwt < t2h1uwt9 && t2w1lwt < t2h1dwt9
  && t2w1lwt < t2w1r10 && t2w1lwt < t2w1l10 && t2w1lwt < t2h1u10 && t2w1lwt < t2h1d10 && t2w1lwt <t2w1rwt10 && t2w1lwt <t2w1lwt10 && t2w1lwt < t2h1uwt10 && t2w1lwt < t2h1dwt10
  && (loutwl==0 && linwl==0)){
  if(linhd==0 && louthd==0)
   {
      ylimitd=(-h2d+h1d)/l*(vz*t2w1lwt+z)-h1dwt;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ylimitd=-bhdwt*sqrt(1-((z0hd+(vz*t2w1lwt+z))*(z0hd+(vz*t2w1lwt+z)))/a2hdwt);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt+z)-pbhdwt)/-pahdwt);
      }
   }
   if(linhu==0 && louthu==0)
    {
     ylimitu=(h2u-h1u)/l*(vz*t2w1lwt+z)+h1uwt;
    }else{
     if(linhu!=0 && louthu!=0)
     {
     ylimitu=bhuwt*sqrt(1-((z0hu+(vz*t2w1lwt+z))*(z0hu+(vz*t2w1lwt+z)))/a2huwt);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt+z)-pbhuwt)/-pahuwt);
    }
    }
  ytest=vy*t2w1lwt+y; 
  xtest=vx*t2w1lwt+x;
  xlimitl=(w2l-w1l)*(vz*t2w1lwt+z)/l+w1lwt;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW>0){
  i=27;
  }else{
  i=35;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW!=-1 && t2h1uwt > 0 && t2h1uwt < t1 
  && t2h1uwt < t2w1r && t2h1uwt < t2w1l && t2h1uwt < t2h1u && t2h1uwt < t2h1d && t2h1uwt < t2w1rwt && t2h1uwt < t2w1lwt && t2h1uwt < t2h1dwt 
  && t2h1uwt < t2w1r1 && t2h1uwt < t2w1l1 && t2h1uwt < t2h1u1 && t2h1uwt < t2h1d1 && t2h1uwt < t2w1rwt1 && t2h1uwt < t2w1lwt1 && t2h1uwt < t2h1uwt1 && t2h1uwt < t2h1dwt1
  && t2h1uwt < t2w1r2 && t2h1uwt < t2w1l2 && t2h1uwt < t2h1u2 && t2h1uwt < t2h1d2 && t2h1uwt < t2w1rwt2 && t2h1uwt < t2w1lwt2 && t2h1uwt < t2h1uwt2 && t2h1uwt < t2h1dwt2
  && t2h1uwt < t2w1r3 && t2h1uwt < t2w1l3 && t2h1uwt < t2h1u3 && t2h1uwt < t2h1d3 && t2h1uwt < t2w1rwt3 && t2h1uwt < t2w1lwt3 && t2h1uwt < t2h1uwt3 && t2h1uwt < t2h1dwt3
  && t2h1uwt < t2w1r4 && t2h1uwt < t2w1l4 && t2h1uwt < t2h1u4 && t2h1uwt < t2h1d4 && t2h1uwt < t2w1rwt4 && t2h1uwt < t2w1lwt4 && t2h1uwt < t2h1uwt4 && t2h1uwt < t2h1dwt4
  && t2h1uwt < t2w1r5 && t2h1uwt < t2w1l5 && t2h1uwt < t2h1u5 && t2h1uwt < t2h1d5 && t2h1uwt < t2w1rwt5 && t2h1uwt < t2w1lwt5 && t2h1uwt < t2h1uwt5 && t2h1uwt < t2h1dwt5
  && t2h1uwt < t2w1r6 && t2h1uwt < t2w1l6 && t2h1uwt < t2h1u6 && t2h1uwt < t2h1d6 && t2h1uwt < t2w1rwt6 && t2h1uwt < t2w1lwt6 && t2h1uwt < t2h1uwt6 && t2h1uwt < t2h1dwt6
  && t2h1uwt < t2w1r7 && t2h1uwt < t2w1l7 && t2h1uwt < t2h1u7 && t2h1uwt < t2h1d7 && t2h1uwt < t2w1rwt7 && t2h1uwt < t2w1lwt7 && t2h1uwt < t2h1uwt7 && t2h1uwt < t2h1dwt7
  && t2h1uwt < t2w1r8 && t2h1uwt < t2w1l8 && t2h1uwt < t2h1u8 && t2h1uwt < t2h1d8 && t2h1uwt < t2w1rwt8 && t2h1uwt < t2w1lwt8 && t2h1uwt < t2h1uwt8 && t2h1uwt < t2h1dwt8
  && t2h1uwt < t2w1r9 && t2h1uwt < t2w1l9 && t2h1uwt < t2h1u9 && t2h1uwt < t2h1d9 && t2h1uwt < t2w1rwt9 && t2h1uwt < t2w1lwt9 && t2h1uwt < t2h1uwt9 && t2h1uwt < t2h1dwt9
  && t2h1uwt < t2w1r10 && t2h1uwt < t2w1l10 && t2h1uwt < t2h1u10 && t2h1uwt < t2h1d10 && t2h1uwt < t2w1rwt10 && t2h1uwt < t2w1lwt10 && t2h1uwt < t2h1uwt10 && t2h1uwt < t2h1dwt10
  && (louthu !=0 && linhu!=0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1uwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1uwt+z))*(z0wr+(vz*t2h1uwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1uwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1uwt+z))*(z0wl+(vz*t2h1uwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1uwt+x;
  ytest=vy*t2w1lwt+y;
  ylimitu=bhuwt*sqrt(1-((vz*t2h1uwt+z)+z0hu)*((vz*t2h1uwt+z)+z0hu)/a2huwt);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW>0 ){
  i=28;
  }else{
  i=36;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW!=-1 && t2h1uwt > 0 && t2h1uwt < t1 
  && t2h1uwt < t2w1r && t2h1uwt < t2w1l && t2h1uwt < t2h1u && t2h1uwt < t2h1d && t2h1uwt < t2w1rwt && t2h1uwt < t2w1lwt && t2h1uwt < t2h1dwt 
  && t2h1uwt < t2w1r1 && t2h1uwt < t2w1l1 && t2h1uwt < t2h1u1 && t2h1uwt < t2h1d1 && t2h1uwt < t2w1rwt1 && t2h1uwt < t2w1lwt1 && t2h1uwt < t2h1uwt1 && t2h1uwt < t2h1dwt1
  && t2h1uwt < t2w1r2 && t2h1uwt < t2w1l2 && t2h1uwt < t2h1u2 && t2h1uwt < t2h1d2 && t2h1uwt < t2w1rwt2 && t2h1uwt < t2w1lwt2 && t2h1uwt < t2h1uwt2 && t2h1uwt < t2h1dwt2
  && t2h1uwt < t2w1r3 && t2h1uwt < t2w1l3 && t2h1uwt < t2h1u3 && t2h1uwt < t2h1d3 && t2h1uwt < t2w1rwt3 && t2h1uwt < t2w1lwt3 && t2h1uwt < t2h1uwt3 && t2h1uwt < t2h1dwt3
  && t2h1uwt < t2w1r4 && t2h1uwt < t2w1l4 && t2h1uwt < t2h1u4 && t2h1uwt < t2h1d4 && t2h1uwt < t2w1rwt4 && t2h1uwt < t2w1lwt4 && t2h1uwt < t2h1uwt4 && t2h1uwt < t2h1dwt4
  && t2h1uwt < t2w1r5 && t2h1uwt < t2w1l5 && t2h1uwt < t2h1u5 && t2h1uwt < t2h1d5 && t2h1uwt < t2w1rwt5 && t2h1uwt < t2w1lwt5 && t2h1uwt < t2h1uwt5 && t2h1uwt < t2h1dwt5
  && t2h1uwt < t2w1r6 && t2h1uwt < t2w1l6 && t2h1uwt < t2h1u6 && t2h1uwt < t2h1d6 && t2h1uwt < t2w1rwt6 && t2h1uwt < t2w1lwt6 && t2h1uwt < t2h1uwt6 && t2h1uwt < t2h1dwt6
  && t2h1uwt < t2w1r7 && t2h1uwt < t2w1l7 && t2h1uwt < t2h1u7 && t2h1uwt < t2h1d7 && t2h1uwt < t2w1rwt7 && t2h1uwt < t2w1lwt7 && t2h1uwt < t2h1uwt7 && t2h1uwt < t2h1dwt7
  && t2h1uwt < t2w1r8 && t2h1uwt < t2w1l8 && t2h1uwt < t2h1u8 && t2h1uwt < t2h1d8 && t2h1uwt < t2w1rwt8 && t2h1uwt < t2w1lwt8 && t2h1uwt < t2h1uwt8 && t2h1uwt < t2h1dwt8
  && t2h1uwt < t2w1r9 && t2h1uwt < t2w1l9 && t2h1uwt < t2h1u9 && t2h1uwt < t2h1d9 && t2h1uwt < t2w1rwt9 && t2h1uwt < t2w1lwt9 && t2h1uwt < t2h1uwt9 && t2h1uwt < t2h1dwt9
  && t2h1uwt < t2w1r10 && t2h1uwt < t2w1l10 && t2h1uwt < t2h1u10 && t2h1uwt < t2h1d10 && t2h1uwt < t2w1rwt10 && t2h1uwt < t2w1lwt10 && t2h1uwt < t2h1uwt10 && t2h1uwt < t2h1dwt10
  && ((louthu!=0 && linhu==0) || (louthu==0 && linhu!=0))){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1uwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1uwt+z))*(z0wr+(vz*t2h1uwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1uwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1uwt+z))*(z0wl+(vz*t2h1uwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1uwt+x;
  ytest=vy*t2w1lwt+y;
  ylimitu=sqrt((pbhuwt-(vz*t2h1uwt+z))/pahuwt);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW>0){
  i=29;
  }else{
  i=36;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW!=-1 && t2h1uwt > 0 && t2h1uwt < t1 
  && t2h1uwt < t2w1r && t2h1uwt < t2w1l && t2h1uwt < t2h1u && t2h1uwt < t2h1d && t2h1uwt < t2w1rwt && t2h1uwt < t2w1lwt && t2h1uwt < t2h1dwt 
  && t2h1uwt < t2w1r1 && t2h1uwt < t2w1l1 && t2h1uwt < t2h1u1 && t2h1uwt < t2h1d1 && t2h1uwt < t2w1rwt1 && t2h1uwt < t2w1lwt1 && t2h1uwt < t2h1uwt1 && t2h1uwt < t2h1dwt1
  && t2h1uwt < t2w1r2 && t2h1uwt < t2w1l2 && t2h1uwt < t2h1u2 && t2h1uwt < t2h1d2 && t2h1uwt < t2w1rwt2 && t2h1uwt < t2w1lwt2 && t2h1uwt < t2h1uwt2 && t2h1uwt < t2h1dwt2
  && t2h1uwt < t2w1r3 && t2h1uwt < t2w1l3 && t2h1uwt < t2h1u3 && t2h1uwt < t2h1d3 && t2h1uwt < t2w1rwt3 && t2h1uwt < t2w1lwt3 && t2h1uwt < t2h1uwt3 && t2h1uwt < t2h1dwt3
  && t2h1uwt < t2w1r4 && t2h1uwt < t2w1l4 && t2h1uwt < t2h1u4 && t2h1uwt < t2h1d4 && t2h1uwt < t2w1rwt4 && t2h1uwt < t2w1lwt4 && t2h1uwt < t2h1uwt4 && t2h1uwt < t2h1dwt4
  && t2h1uwt < t2w1r5 && t2h1uwt < t2w1l5 && t2h1uwt < t2h1u5 && t2h1uwt < t2h1d5 && t2h1uwt < t2w1rwt5 && t2h1uwt < t2w1lwt5 && t2h1uwt < t2h1uwt5 && t2h1uwt < t2h1dwt5
  && t2h1uwt < t2w1r6 && t2h1uwt < t2w1l6 && t2h1uwt < t2h1u6 && t2h1uwt < t2h1d6 && t2h1uwt < t2w1rwt6 && t2h1uwt < t2w1lwt6 && t2h1uwt < t2h1uwt6 && t2h1uwt < t2h1dwt6
  && t2h1uwt < t2w1r7 && t2h1uwt < t2w1l7 && t2h1uwt < t2h1u7 && t2h1uwt < t2h1d7 && t2h1uwt < t2w1rwt7 && t2h1uwt < t2w1lwt7 && t2h1uwt < t2h1uwt7 && t2h1uwt < t2h1dwt7
  && t2h1uwt < t2w1r8 && t2h1uwt < t2w1l8 && t2h1uwt < t2h1u8 && t2h1uwt < t2h1d8 && t2h1uwt < t2w1rwt8 && t2h1uwt < t2w1lwt8 && t2h1uwt < t2h1uwt8 && t2h1uwt < t2h1dwt8
  && t2h1uwt < t2w1r9 && t2h1uwt < t2w1l9 && t2h1uwt < t2h1u9 && t2h1uwt < t2h1d9 && t2h1uwt < t2w1rwt9 && t2h1uwt < t2w1lwt9 && t2h1uwt < t2h1uwt9 && t2h1uwt < t2h1dwt9
  && t2h1uwt < t2w1r10 && t2h1uwt < t2w1l10 && t2h1uwt < t2h1u10 && t2h1uwt < t2h1d10 && t2h1uwt < t2w1rwt10 && t2h1uwt < t2w1lwt10 && t2h1uwt < t2h1uwt10 && t2h1uwt < t2h1dwt10
  && (louthu == 0 && linhu == 0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1uwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1uwt+z))*(z0wr+(vz*t2h1uwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1uwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1uwt+z))*(z0wl+(vz*t2h1uwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1uwt+x;
  ytest=vy*t2w1lwt+y;
  ylimitu=(h2u-h1u)*(vz*t2h1uwt+z)/l+h1uwt;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW>0 ){
  i=30;
  }else{
  i=36;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW!=-1 && t2h1dwt > 0 && t2h1dwt < t1 
  && t2h1dwt < t2w1r && t2h1dwt < t2w1l && t2h1dwt < t2h1u && t2h1dwt < t2h1d && t2h1dwt < t2w1rwt && t2h1dwt < t2w1lwt && t2h1dwt < t2h1uwt 
  && t2h1dwt < t2w1r1 && t2h1dwt < t2w1l1 && t2h1dwt < t2h1u1 && t2h1dwt < t2h1d1 && t2h1dwt < t2w1rwt1 && t2h1dwt < t2w1lwt1 && t2h1dwt < t2h1uwt1 && t2h1dwt < t2h1dwt1
  && t2h1dwt < t2w1r2 && t2h1dwt < t2w1l2 && t2h1dwt < t2h1u2 && t2h1dwt < t2h1d2 && t2h1dwt < t2w1rwt2 && t2h1dwt < t2w1lwt2 && t2h1dwt < t2h1uwt2 && t2h1dwt < t2h1dwt2 
  && t2h1dwt < t2w1r3 && t2h1dwt < t2w1l3 && t2h1dwt < t2h1u3 && t2h1dwt < t2h1d3 && t2h1dwt < t2w1rwt3 && t2h1dwt < t2w1lwt3 && t2h1dwt < t2h1uwt3 && t2h1dwt < t2h1dwt3
  && t2h1dwt < t2w1r4 && t2h1dwt < t2w1l4 && t2h1dwt < t2h1u4 && t2h1dwt < t2h1d4 && t2h1dwt < t2w1rwt4 && t2h1dwt < t2w1lwt4 && t2h1dwt < t2h1uwt4 && t2h1dwt < t2h1dwt4
  && t2h1dwt < t2w1r5 && t2h1dwt < t2w1l5 && t2h1dwt < t2h1u5 && t2h1dwt < t2h1d5 && t2h1dwt < t2w1rwt5 && t2h1dwt < t2w1lwt5 && t2h1dwt < t2h1uwt5 && t2h1dwt < t2h1dwt5
  && t2h1dwt < t2w1r6 && t2h1dwt < t2w1l6 && t2h1dwt < t2h1u6 && t2h1dwt < t2h1d6 && t2h1dwt < t2w1rwt6 && t2h1dwt < t2w1lwt6 && t2h1dwt < t2h1uwt6 && t2h1dwt < t2h1dwt6
  && t2h1dwt < t2w1r7 && t2h1dwt < t2w1l7 && t2h1dwt < t2h1u7 && t2h1dwt < t2h1d7 && t2h1dwt < t2w1rwt7 && t2h1dwt < t2w1lwt7 && t2h1dwt < t2h1uwt7 && t2h1dwt < t2h1dwt7 
  && t2h1dwt < t2w1r8 && t2h1dwt < t2w1l8 && t2h1dwt < t2h1u8 && t2h1dwt < t2h1d8 && t2h1dwt < t2w1rwt8 && t2h1dwt < t2w1lwt8 && t2h1dwt < t2h1uwt8 && t2h1dwt < t2h1dwt8
  && t2h1dwt < t2w1r9 && t2h1dwt < t2w1l9 && t2h1dwt < t2h1u9 && t2h1dwt < t2h1d9 && t2h1dwt < t2w1rwt9 && t2h1dwt < t2w1lwt9 && t2h1dwt < t2h1uwt9 && t2h1dwt < t2h1dwt9 
  && t2h1dwt < t2w1r10 && t2h1dwt < t2w1l10 && t2h1dwt < t2h1u10 && t2h1dwt < t2h1d10 && t2h1dwt < t2w1rwt10 && t2h1dwt < t2w1lwt10 && t2h1dwt < t2h1uwt10 && t2h1dwt < t2h1dwt10
  && (louthd !=0 && linhd!=0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1dwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1dwt+z))*(z0wr+(vz*t2h1dwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1dwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1dwt+z))*(z0wl+(vz*t2h1dwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1dwt+x;
  ytest=vy*t2w1lwt+y;
  ylimitd=-bhdwt*sqrt(1-((vz*t2h1dwt+z)+z0hd)*((vz*t2h1dwt+z)+z0hd)/a2hdwt);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW>0){
  i=31;
  }else{
  i=37;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW!=-1 && t2h1dwt > 0 && t2h1dwt < t1 
  && t2h1dwt < t2w1r && t2h1dwt < t2w1l && t2h1dwt < t2h1u && t2h1dwt < t2h1d && t2h1dwt < t2w1rwt && t2h1dwt < t2w1lwt && t2h1dwt < t2h1uwt 
  && t2h1dwt < t2w1r1 && t2h1dwt < t2w1l1 && t2h1dwt < t2h1u1 && t2h1dwt < t2h1d1 && t2h1dwt < t2w1rwt1 && t2h1dwt < t2w1lwt1 && t2h1dwt < t2h1uwt1 && t2h1dwt < t2h1dwt1
  && t2h1dwt < t2w1r2 && t2h1dwt < t2w1l2 && t2h1dwt < t2h1u2 && t2h1dwt < t2h1d2 && t2h1dwt < t2w1rwt2 && t2h1dwt < t2w1lwt2 && t2h1dwt < t2h1uwt2 && t2h1dwt < t2h1dwt2 
  && t2h1dwt < t2w1r3 && t2h1dwt < t2w1l3 && t2h1dwt < t2h1u3 && t2h1dwt < t2h1d3 && t2h1dwt < t2w1rwt3 && t2h1dwt < t2w1lwt3 && t2h1dwt < t2h1uwt3 && t2h1dwt < t2h1dwt3
  && t2h1dwt < t2w1r4 && t2h1dwt < t2w1l4 && t2h1dwt < t2h1u4 && t2h1dwt < t2h1d4 && t2h1dwt < t2w1rwt4 && t2h1dwt < t2w1lwt4 && t2h1dwt < t2h1uwt4 && t2h1dwt < t2h1dwt4
  && t2h1dwt < t2w1r5 && t2h1dwt < t2w1l5 && t2h1dwt < t2h1u5 && t2h1dwt < t2h1d5 && t2h1dwt < t2w1rwt5 && t2h1dwt < t2w1lwt5 && t2h1dwt < t2h1uwt5 && t2h1dwt < t2h1dwt5
  && t2h1dwt < t2w1r6 && t2h1dwt < t2w1l6 && t2h1dwt < t2h1u6 && t2h1dwt < t2h1d6 && t2h1dwt < t2w1rwt6 && t2h1dwt < t2w1lwt6 && t2h1dwt < t2h1uwt6 && t2h1dwt < t2h1dwt6
  && t2h1dwt < t2w1r7 && t2h1dwt < t2w1l7 && t2h1dwt < t2h1u7 && t2h1dwt < t2h1d7 && t2h1dwt < t2w1rwt7 && t2h1dwt < t2w1lwt7 && t2h1dwt < t2h1uwt7 && t2h1dwt < t2h1dwt7 
  && t2h1dwt < t2w1r8 && t2h1dwt < t2w1l8 && t2h1dwt < t2h1u8 && t2h1dwt < t2h1d8 && t2h1dwt < t2w1rwt8 && t2h1dwt < t2w1lwt8 && t2h1dwt < t2h1uwt8 && t2h1dwt < t2h1dwt8
  && t2h1dwt < t2w1r9 && t2h1dwt < t2w1l9 && t2h1dwt < t2h1u9 && t2h1dwt < t2h1d9 && t2h1dwt < t2w1rwt9 && t2h1dwt < t2w1lwt9 && t2h1dwt < t2h1uwt9 && t2h1dwt < t2h1dwt9 
  && t2h1dwt < t2w1r10 && t2h1dwt < t2w1l10 && t2h1dwt < t2h1u10 && t2h1dwt < t2h1d10 && t2h1dwt < t2w1rwt10 && t2h1dwt < t2w1lwt10 && t2h1dwt < t2h1uwt10 && t2h1dwt < t2h1dwt10
  && ((louthd !=0 && linhd==0) || (louthd ==0 && linhd!=0))){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1dwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1dwt+z))*(z0wr+(vz*t2h1dwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
     xlimitl=(w2l-w1l)/l*(vz*t2h1dwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1dwt+z))*(z0wl+(vz*t2h1dwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1dwt+x;
  ytest=vy*t2w1lwt+y;
  ylimitd=-sqrt((pbhdwt-(vz*t2h1dwt+z))/pahdwt);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW>0 ){
  i=32;
  }else{
  i=37;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW!=-1 && t2h1dwt > 0 && t2h1dwt < t1 
  && t2h1dwt < t2w1r && t2h1dwt < t2w1l && t2h1dwt < t2h1u && t2h1dwt < t2h1d && t2h1dwt < t2w1rwt && t2h1dwt < t2w1lwt && t2h1dwt < t2h1uwt 
  && t2h1dwt < t2w1r1 && t2h1dwt < t2w1l1 && t2h1dwt < t2h1u1 && t2h1dwt < t2h1d1 && t2h1dwt < t2w1rwt1 && t2h1dwt < t2w1lwt1 && t2h1dwt < t2h1uwt1 && t2h1dwt < t2h1dwt1
  && t2h1dwt < t2w1r2 && t2h1dwt < t2w1l2 && t2h1dwt < t2h1u2 && t2h1dwt < t2h1d2 && t2h1dwt < t2w1rwt2 && t2h1dwt < t2w1lwt2 && t2h1dwt < t2h1uwt2 && t2h1dwt < t2h1dwt2 
  && t2h1dwt < t2w1r3 && t2h1dwt < t2w1l3 && t2h1dwt < t2h1u3 && t2h1dwt < t2h1d3 && t2h1dwt < t2w1rwt3 && t2h1dwt < t2w1lwt3 && t2h1dwt < t2h1uwt3 && t2h1dwt < t2h1dwt3
  && t2h1dwt < t2w1r4 && t2h1dwt < t2w1l4 && t2h1dwt < t2h1u4 && t2h1dwt < t2h1d4 && t2h1dwt < t2w1rwt4 && t2h1dwt < t2w1lwt4 && t2h1dwt < t2h1uwt4 && t2h1dwt < t2h1dwt4
  && t2h1dwt < t2w1r5 && t2h1dwt < t2w1l5 && t2h1dwt < t2h1u5 && t2h1dwt < t2h1d5 && t2h1dwt < t2w1rwt5 && t2h1dwt < t2w1lwt5 && t2h1dwt < t2h1uwt5 && t2h1dwt < t2h1dwt5
  && t2h1dwt < t2w1r6 && t2h1dwt < t2w1l6 && t2h1dwt < t2h1u6 && t2h1dwt < t2h1d6 && t2h1dwt < t2w1rwt6 && t2h1dwt < t2w1lwt6 && t2h1dwt < t2h1uwt6 && t2h1dwt < t2h1dwt6
  && t2h1dwt < t2w1r7 && t2h1dwt < t2w1l7 && t2h1dwt < t2h1u7 && t2h1dwt < t2h1d7 && t2h1dwt < t2w1rwt7 && t2h1dwt < t2w1lwt7 && t2h1dwt < t2h1uwt7 && t2h1dwt < t2h1dwt7 
  && t2h1dwt < t2w1r8 && t2h1dwt < t2w1l8 && t2h1dwt < t2h1u8 && t2h1dwt < t2h1d8 && t2h1dwt < t2w1rwt8 && t2h1dwt < t2w1lwt8 && t2h1dwt < t2h1uwt8 && t2h1dwt < t2h1dwt8
  && t2h1dwt < t2w1r9 && t2h1dwt < t2w1l9 && t2h1dwt < t2h1u9 && t2h1dwt < t2h1d9 && t2h1dwt < t2w1rwt9 && t2h1dwt < t2w1lwt9 && t2h1dwt < t2h1uwt9 && t2h1dwt < t2h1dwt9 
  && t2h1dwt < t2w1r10 && t2h1dwt < t2w1l10 && t2h1dwt < t2h1u10 && t2h1dwt < t2h1d10 && t2h1dwt < t2w1rwt10 && t2h1dwt < t2w1lwt10 && t2h1dwt < t2h1uwt10 && t2h1dwt < t2h1dwt10
  && (louthd == 0 && linhd == 0)){
  if(linwr==0 && loutwr==0)
  {
    xlimitr=(-w2r+w1r)/l*(vz*t2h1dwt+z)-w1rwt;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xlimitr=-bwrwt*sqrt(1-((z0wr+(vz*t2h1dwt+z))*(z0wr+(vz*t2h1dwt+z)))/a2wrwt);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt+z)-pbwrwt)/-pawrwt);
    }
  }
  if(linwl==0 && loutwl == 0)
   {
      xlimitl=(w2l-w1l)/l*(vz*t2h1dwt+z)+w1lwt;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xlimitl=bwlwt*sqrt(1-((z0wl+(vz*t2h1dwt+z))*(z0wl+(vz*t2h1dwt+z)))/a2wlwt);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt+z)-pbwlwt)/-pawlwt);
      }
   }
  xtest=vx*t2h1dwt+x;
  ytest=vy*t2w1lwt+y;
  ylimitd=(-h2d+h1d)*(vz*t2h1dwt+z)/l-h1dwt;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW>0 ){
  i=33;
  }else{
  i=37;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT OUTER WALLS */

  if (mxrOW==-1 && t2w1rwt > 0 && t2w1rwt < t1 
  && t2w1rwt < t2w1r && t2w1rwt < t2w1l && t2w1rwt < t2h1u && t2w1rwt < t2h1d && t2w1rwt <t2w1lwt && t2w1rwt < t2h1uwt && t2w1rwt < t2h1dwt
  && t2w1rwt < t2w1r1 && t2w1rwt < t2w1l1 && t2w1rwt < t2h1u1 && t2w1rwt < t2h1d1 && t2w1rwt <t2w1rwt1 && t2w1rwt <t2w1lwt1 && t2w1rwt < t2h1uwt1 && t2w1rwt < t2h1dwt1
  && t2w1rwt < t2w1r2 && t2w1rwt < t2w1l2 && t2w1rwt < t2h1u2 && t2w1rwt < t2h1d2 && t2w1rwt <t2w1rwt2 && t2w1rwt <t2w1lwt2 && t2w1rwt < t2h1uwt2 && t2w1rwt < t2h1dwt2
  && t2w1rwt < t2w1r3 && t2w1rwt < t2w1l3 && t2w1rwt < t2h1u3 && t2w1rwt < t2h1d3 && t2w1rwt <t2w1rwt3 && t2w1rwt <t2w1lwt3 && t2w1rwt < t2h1uwt3 && t2w1rwt < t2h1dwt3
  && t2w1rwt < t2w1r4 && t2w1rwt < t2w1l4 && t2w1rwt < t2h1u4 && t2w1rwt < t2h1d4 && t2w1rwt <t2w1rwt4 && t2w1rwt <t2w1lwt4 && t2w1rwt < t2h1uwt4 && t2w1rwt < t2h1dwt4
  && t2w1rwt < t2w1r5 && t2w1rwt < t2w1l5 && t2w1rwt < t2h1u5 && t2w1rwt < t2h1d5 && t2w1rwt <t2w1rwt5 && t2w1rwt <t2w1lwt5 && t2w1rwt < t2h1uwt5 && t2w1rwt < t2h1dwt5
  && t2w1rwt < t2w1r6 && t2w1rwt < t2w1l6 && t2w1rwt < t2h1u6 && t2w1rwt < t2h1d6 && t2w1rwt <t2w1rwt6 && t2w1rwt <t2w1lwt6 && t2w1rwt < t2h1uwt6 && t2w1rwt < t2h1dwt6
  && t2w1rwt < t2w1r7 && t2w1rwt < t2w1l7 && t2w1rwt < t2h1u7 && t2w1rwt < t2h1d7 && t2w1rwt <t2w1rwt7 && t2w1rwt <t2w1lwt7 && t2w1rwt < t2h1uwt7 && t2w1rwt < t2h1dwt7
  && t2w1rwt < t2w1r8 && t2w1rwt < t2w1l8 && t2w1rwt < t2h1u8 && t2w1rwt < t2h1d8 && t2w1rwt <t2w1rwt8 && t2w1rwt <t2w1lwt8 && t2w1rwt < t2h1uwt8 && t2w1rwt < t2h1dwt8
  && t2w1rwt < t2w1r9 && t2w1rwt < t2w1l9 && t2w1rwt < t2h1u9 && t2w1rwt < t2h1d9 && t2w1rwt <t2w1rwt9 && t2w1rwt <t2w1lwt9 && t2w1rwt < t2h1uwt9 && t2w1rwt < t2h1dwt9
  && t2w1rwt < t2w1r10 && t2w1rwt < t2w1l10 && t2w1rwt < t2h1u10 && t2w1rwt < t2h1d10 && t2w1rwt <t2w1rwt10 && t2w1rwt <t2w1lwt10 && t2w1rwt < t2h1uwt10 && t2w1rwt < t2h1dwt10
  && ((linwr!=0) && (loutwr!=0) )) {
  i=38;
  }

  if (mxrOW==-1 && t2w1rwt > 0 && t2w1rwt < t1 
  && t2w1rwt < t2w1r && t2w1rwt < t2w1l && t2w1rwt < t2h1u && t2w1rwt < t2h1d && t2w1rwt <t2w1lwt && t2w1rwt < t2h1uwt && t2w1rwt < t2h1dwt
  && t2w1rwt < t2w1r1 && t2w1rwt < t2w1l1 && t2w1rwt < t2h1u1 && t2w1rwt < t2h1d1 && t2w1rwt <t2w1rwt1 && t2w1rwt <t2w1lwt1 && t2w1rwt < t2h1uwt1 && t2w1rwt < t2h1dwt1
  && t2w1rwt < t2w1r2 && t2w1rwt < t2w1l2 && t2w1rwt < t2h1u2 && t2w1rwt < t2h1d2 && t2w1rwt <t2w1rwt2 && t2w1rwt <t2w1lwt2 && t2w1rwt < t2h1uwt2 && t2w1rwt < t2h1dwt2
  && t2w1rwt < t2w1r3 && t2w1rwt < t2w1l3 && t2w1rwt < t2h1u3 && t2w1rwt < t2h1d3 && t2w1rwt <t2w1rwt3 && t2w1rwt <t2w1lwt3 && t2w1rwt < t2h1uwt3 && t2w1rwt < t2h1dwt3
  && t2w1rwt < t2w1r4 && t2w1rwt < t2w1l4 && t2w1rwt < t2h1u4 && t2w1rwt < t2h1d4 && t2w1rwt <t2w1rwt4 && t2w1rwt <t2w1lwt4 && t2w1rwt < t2h1uwt4 && t2w1rwt < t2h1dwt4
  && t2w1rwt < t2w1r5 && t2w1rwt < t2w1l5 && t2w1rwt < t2h1u5 && t2w1rwt < t2h1d5 && t2w1rwt <t2w1rwt5 && t2w1rwt <t2w1lwt5 && t2w1rwt < t2h1uwt5 && t2w1rwt < t2h1dwt5
  && t2w1rwt < t2w1r6 && t2w1rwt < t2w1l6 && t2w1rwt < t2h1u6 && t2w1rwt < t2h1d6 && t2w1rwt <t2w1rwt6 && t2w1rwt <t2w1lwt6 && t2w1rwt < t2h1uwt6 && t2w1rwt < t2h1dwt6
  && t2w1rwt < t2w1r7 && t2w1rwt < t2w1l7 && t2w1rwt < t2h1u7 && t2w1rwt < t2h1d7 && t2w1rwt <t2w1rwt7 && t2w1rwt <t2w1lwt7 && t2w1rwt < t2h1uwt7 && t2w1rwt < t2h1dwt7
  && t2w1rwt < t2w1r8 && t2w1rwt < t2w1l8 && t2w1rwt < t2h1u8 && t2w1rwt < t2h1d8 && t2w1rwt <t2w1rwt8 && t2w1rwt <t2w1lwt8 && t2w1rwt < t2h1uwt8 && t2w1rwt < t2h1dwt8
  && t2w1rwt < t2w1r9 && t2w1rwt < t2w1l9 && t2w1rwt < t2h1u9 && t2w1rwt < t2h1d9 && t2w1rwt <t2w1rwt9 && t2w1rwt <t2w1lwt9 && t2w1rwt < t2h1uwt9 && t2w1rwt < t2h1dwt9
  && t2w1rwt < t2w1r10 && t2w1rwt < t2w1l10 && t2w1rwt < t2h1u10 && t2w1rwt < t2h1d10 && t2w1rwt <t2w1rwt10 && t2w1rwt <t2w1lwt10 && t2w1rwt < t2h1uwt10 && t2w1rwt < t2h1dwt10
  && ((loutwr!=0 && linwr==0) || (loutwr==0 && linwr!=0))){
  i=38;
  }

  if (mxrOW==-1 && t2w1rwt > 0 && t2w1rwt < t1 
  && t2w1rwt < t2w1r && t2w1rwt < t2w1l && t2w1rwt < t2h1u && t2w1rwt < t2h1d && t2w1rwt <t2w1lwt && t2w1rwt < t2h1uwt && t2w1rwt < t2h1dwt
  && t2w1rwt < t2w1r1 && t2w1rwt < t2w1l1 && t2w1rwt < t2h1u1 && t2w1rwt < t2h1d1 && t2w1rwt <t2w1rwt1 && t2w1rwt <t2w1lwt1 && t2w1rwt < t2h1uwt1 && t2w1rwt < t2h1dwt1
  && t2w1rwt < t2w1r2 && t2w1rwt < t2w1l2 && t2w1rwt < t2h1u2 && t2w1rwt < t2h1d2 && t2w1rwt <t2w1rwt2 && t2w1rwt <t2w1lwt2 && t2w1rwt < t2h1uwt2 && t2w1rwt < t2h1dwt2
  && t2w1rwt < t2w1r3 && t2w1rwt < t2w1l3 && t2w1rwt < t2h1u3 && t2w1rwt < t2h1d3 && t2w1rwt <t2w1rwt3 && t2w1rwt <t2w1lwt3 && t2w1rwt < t2h1uwt3 && t2w1rwt < t2h1dwt3
  && t2w1rwt < t2w1r4 && t2w1rwt < t2w1l4 && t2w1rwt < t2h1u4 && t2w1rwt < t2h1d4 && t2w1rwt <t2w1rwt4 && t2w1rwt <t2w1lwt4 && t2w1rwt < t2h1uwt4 && t2w1rwt < t2h1dwt4
  && t2w1rwt < t2w1r5 && t2w1rwt < t2w1l5 && t2w1rwt < t2h1u5 && t2w1rwt < t2h1d5 && t2w1rwt <t2w1rwt5 && t2w1rwt <t2w1lwt5 && t2w1rwt < t2h1uwt5 && t2w1rwt < t2h1dwt5
  && t2w1rwt < t2w1r6 && t2w1rwt < t2w1l6 && t2w1rwt < t2h1u6 && t2w1rwt < t2h1d6 && t2w1rwt <t2w1rwt6 && t2w1rwt <t2w1lwt6 && t2w1rwt < t2h1uwt6 && t2w1rwt < t2h1dwt6
  && t2w1rwt < t2w1r7 && t2w1rwt < t2w1l7 && t2w1rwt < t2h1u7 && t2w1rwt < t2h1d7 && t2w1rwt <t2w1rwt7 && t2w1rwt <t2w1lwt7 && t2w1rwt < t2h1uwt7 && t2w1rwt < t2h1dwt7
  && t2w1rwt < t2w1r8 && t2w1rwt < t2w1l8 && t2w1rwt < t2h1u8 && t2w1rwt < t2h1d8 && t2w1rwt <t2w1rwt8 && t2w1rwt <t2w1lwt8 && t2w1rwt < t2h1uwt8 && t2w1rwt < t2h1dwt8
  && t2w1rwt < t2w1r9 && t2w1rwt < t2w1l9 && t2w1rwt < t2h1u9 && t2w1rwt < t2h1d9 && t2w1rwt <t2w1rwt9 && t2w1rwt <t2w1lwt9 && t2w1rwt < t2h1uwt9 && t2w1rwt < t2h1dwt9
  && t2w1rwt < t2w1r10 && t2w1rwt < t2w1l10 && t2w1rwt < t2h1u10 && t2w1rwt < t2h1d10 && t2w1rwt <t2w1rwt10 && t2w1rwt <t2w1lwt10 && t2w1rwt < t2h1uwt10 && t2w1rwt < t2h1dwt10
  && (loutwr==0 && linwr==0)){
  i=38;
  }

  if (mxlOW==-1 && t2w1lwt > 0 && t2w1lwt < t1 
  && t2w1lwt < t2w1r && t2w1lwt < t2w1l && t2w1lwt < t2h1u && t2w1lwt < t2h1d && t2w1lwt <t2w1rwt && t2w1lwt < t2h1uwt && t2w1lwt < t2h1dwt
  && t2w1lwt < t2w1r1 && t2w1lwt < t2w1l1 && t2w1lwt < t2h1u1 && t2w1lwt < t2h1d1 && t2w1lwt <t2w1rwt1 && t2w1lwt <t2w1lwt1 && t2w1lwt < t2h1uwt1 && t2w1lwt < t2h1dwt1
  && t2w1lwt < t2w1r2 && t2w1lwt < t2w1l2 && t2w1lwt < t2h1u2 && t2w1lwt < t2h1d2 && t2w1lwt <t2w1rwt2 && t2w1lwt <t2w1lwt2 && t2w1lwt < t2h1uwt2 && t2w1lwt < t2h1dwt2
  && t2w1lwt < t2w1r3 && t2w1lwt < t2w1l3 && t2w1lwt < t2h1u3 && t2w1lwt < t2h1d3 && t2w1lwt <t2w1rwt3 && t2w1lwt <t2w1lwt3 && t2w1lwt < t2h1uwt3 && t2w1lwt < t2h1dwt3
  && t2w1lwt < t2w1r4 && t2w1lwt < t2w1l4 && t2w1lwt < t2h1u4 && t2w1lwt < t2h1d4 && t2w1lwt <t2w1rwt4 && t2w1lwt <t2w1lwt4 && t2w1lwt < t2h1uwt4 && t2w1lwt < t2h1dwt4
  && t2w1lwt < t2w1r5 && t2w1lwt < t2w1l5 && t2w1lwt < t2h1u5 && t2w1lwt < t2h1d5 && t2w1lwt <t2w1rwt5 && t2w1lwt <t2w1lwt5 && t2w1lwt < t2h1uwt5 && t2w1lwt < t2h1dwt5
  && t2w1lwt < t2w1r6 && t2w1lwt < t2w1l6 && t2w1lwt < t2h1u6 && t2w1lwt < t2h1d6 && t2w1lwt <t2w1rwt6 && t2w1lwt <t2w1lwt6 && t2w1lwt < t2h1uwt6 && t2w1lwt < t2h1dwt6
  && t2w1lwt < t2w1r7 && t2w1lwt < t2w1l7 && t2w1lwt < t2h1u7 && t2w1lwt < t2h1d7 && t2w1lwt <t2w1rwt7 && t2w1lwt <t2w1lwt7 && t2w1lwt < t2h1uwt7 && t2w1lwt < t2h1dwt7
  && t2w1lwt < t2w1r8 && t2w1lwt < t2w1l8 && t2w1lwt < t2h1u8 && t2w1lwt < t2h1d8 && t2w1lwt <t2w1rwt8 && t2w1lwt <t2w1lwt8 && t2w1lwt < t2h1uwt8 && t2w1lwt < t2h1dwt8
  && t2w1lwt < t2w1r9 && t2w1lwt < t2w1l9 && t2w1lwt < t2h1u9 && t2w1lwt < t2h1d9 && t2w1lwt <t2w1rwt9 && t2w1lwt <t2w1lwt9 && t2w1lwt < t2h1uwt9 && t2w1lwt < t2h1dwt9
  && t2w1lwt < t2w1r10 && t2w1lwt < t2w1l10 && t2w1lwt < t2h1u10 && t2w1lwt < t2h1d10 && t2w1lwt <t2w1rwt10 && t2w1lwt <t2w1lwt10 && t2w1lwt < t2h1uwt10 && t2w1lwt < t2h1dwt10
  && ((linwl!=0) && (loutwl!=0) )){
  i=39;
  }

  if (mxlOW==-1 && t2w1lwt > 0 && t2w1lwt < t1 
  && t2w1lwt < t2w1r && t2w1lwt < t2w1l && t2w1lwt < t2h1u && t2w1lwt < t2h1d && t2w1lwt <t2w1rwt && t2w1lwt < t2h1uwt && t2w1lwt < t2h1dwt
  && t2w1lwt < t2w1r1 && t2w1lwt < t2w1l1 && t2w1lwt < t2h1u1 && t2w1lwt < t2h1d1 && t2w1lwt <t2w1rwt1 && t2w1lwt <t2w1lwt1 && t2w1lwt < t2h1uwt1 && t2w1lwt < t2h1dwt1
  && t2w1lwt < t2w1r2 && t2w1lwt < t2w1l2 && t2w1lwt < t2h1u2 && t2w1lwt < t2h1d2 && t2w1lwt <t2w1rwt2 && t2w1lwt <t2w1lwt2 && t2w1lwt < t2h1uwt2 && t2w1lwt < t2h1dwt2
  && t2w1lwt < t2w1r3 && t2w1lwt < t2w1l3 && t2w1lwt < t2h1u3 && t2w1lwt < t2h1d3 && t2w1lwt <t2w1rwt3 && t2w1lwt <t2w1lwt3 && t2w1lwt < t2h1uwt3 && t2w1lwt < t2h1dwt3
  && t2w1lwt < t2w1r4 && t2w1lwt < t2w1l4 && t2w1lwt < t2h1u4 && t2w1lwt < t2h1d4 && t2w1lwt <t2w1rwt4 && t2w1lwt <t2w1lwt4 && t2w1lwt < t2h1uwt4 && t2w1lwt < t2h1dwt4
  && t2w1lwt < t2w1r5 && t2w1lwt < t2w1l5 && t2w1lwt < t2h1u5 && t2w1lwt < t2h1d5 && t2w1lwt <t2w1rwt5 && t2w1lwt <t2w1lwt5 && t2w1lwt < t2h1uwt5 && t2w1lwt < t2h1dwt5
  && t2w1lwt < t2w1r6 && t2w1lwt < t2w1l6 && t2w1lwt < t2h1u6 && t2w1lwt < t2h1d6 && t2w1lwt <t2w1rwt6 && t2w1lwt <t2w1lwt6 && t2w1lwt < t2h1uwt6 && t2w1lwt < t2h1dwt6
  && t2w1lwt < t2w1r7 && t2w1lwt < t2w1l7 && t2w1lwt < t2h1u7 && t2w1lwt < t2h1d7 && t2w1lwt <t2w1rwt7 && t2w1lwt <t2w1lwt7 && t2w1lwt < t2h1uwt7 && t2w1lwt < t2h1dwt7
  && t2w1lwt < t2w1r8 && t2w1lwt < t2w1l8 && t2w1lwt < t2h1u8 && t2w1lwt < t2h1d8 && t2w1lwt <t2w1rwt8 && t2w1lwt <t2w1lwt8 && t2w1lwt < t2h1uwt8 && t2w1lwt < t2h1dwt8
  && t2w1lwt < t2w1r9 && t2w1lwt < t2w1l9 && t2w1lwt < t2h1u9 && t2w1lwt < t2h1d9 && t2w1lwt <t2w1rwt9 && t2w1lwt <t2w1lwt9 && t2w1lwt < t2h1uwt9 && t2w1lwt < t2h1dwt9
  && t2w1lwt < t2w1r10 && t2w1lwt < t2w1l10 && t2w1lwt < t2h1u10 && t2w1lwt < t2h1d10 && t2w1lwt <t2w1rwt10 && t2w1lwt <t2w1lwt10 && t2w1lwt < t2h1uwt10 && t2w1lwt < t2h1dwt10
  && ((loutwl!=0 && linwl==0) || (loutwl==0 && linwl!=0))){
  i=39;
  }

  if (mxlOW==-1 && t2w1lwt > 0 && t2w1lwt < t1 
  && t2w1lwt < t2w1r && t2w1lwt < t2w1l && t2w1lwt < t2h1u && t2w1lwt < t2h1d && t2w1lwt <t2w1rwt && t2w1lwt < t2h1uwt && t2w1lwt < t2h1dwt
  && t2w1lwt < t2w1r1 && t2w1lwt < t2w1l1 && t2w1lwt < t2h1u1 && t2w1lwt < t2h1d1 && t2w1lwt <t2w1rwt1 && t2w1lwt <t2w1lwt1 && t2w1lwt < t2h1uwt1 && t2w1lwt < t2h1dwt1
  && t2w1lwt < t2w1r2 && t2w1lwt < t2w1l2 && t2w1lwt < t2h1u2 && t2w1lwt < t2h1d2 && t2w1lwt <t2w1rwt2 && t2w1lwt <t2w1lwt2 && t2w1lwt < t2h1uwt2 && t2w1lwt < t2h1dwt2
  && t2w1lwt < t2w1r3 && t2w1lwt < t2w1l3 && t2w1lwt < t2h1u3 && t2w1lwt < t2h1d3 && t2w1lwt <t2w1rwt3 && t2w1lwt <t2w1lwt3 && t2w1lwt < t2h1uwt3 && t2w1lwt < t2h1dwt3
  && t2w1lwt < t2w1r4 && t2w1lwt < t2w1l4 && t2w1lwt < t2h1u4 && t2w1lwt < t2h1d4 && t2w1lwt <t2w1rwt4 && t2w1lwt <t2w1lwt4 && t2w1lwt < t2h1uwt4 && t2w1lwt < t2h1dwt4
  && t2w1lwt < t2w1r5 && t2w1lwt < t2w1l5 && t2w1lwt < t2h1u5 && t2w1lwt < t2h1d5 && t2w1lwt <t2w1rwt5 && t2w1lwt <t2w1lwt5 && t2w1lwt < t2h1uwt5 && t2w1lwt < t2h1dwt5
  && t2w1lwt < t2w1r6 && t2w1lwt < t2w1l6 && t2w1lwt < t2h1u6 && t2w1lwt < t2h1d6 && t2w1lwt <t2w1rwt6 && t2w1lwt <t2w1lwt6 && t2w1lwt < t2h1uwt6 && t2w1lwt < t2h1dwt6
  && t2w1lwt < t2w1r7 && t2w1lwt < t2w1l7 && t2w1lwt < t2h1u7 && t2w1lwt < t2h1d7 && t2w1lwt <t2w1rwt7 && t2w1lwt <t2w1lwt7 && t2w1lwt < t2h1uwt7 && t2w1lwt < t2h1dwt7
  && t2w1lwt < t2w1r8 && t2w1lwt < t2w1l8 && t2w1lwt < t2h1u8 && t2w1lwt < t2h1d8 && t2w1lwt <t2w1rwt8 && t2w1lwt <t2w1lwt8 && t2w1lwt < t2h1uwt8 && t2w1lwt < t2h1dwt8
  && t2w1lwt < t2w1r9 && t2w1lwt < t2w1l9 && t2w1lwt < t2h1u9 && t2w1lwt < t2h1d9 && t2w1lwt <t2w1rwt9 && t2w1lwt <t2w1lwt9 && t2w1lwt < t2h1uwt9 && t2w1lwt < t2h1dwt9
  && t2w1lwt < t2w1r10 && t2w1lwt < t2w1l10 && t2w1lwt < t2h1u10 && t2w1lwt < t2h1d10 && t2w1lwt <t2w1rwt10 && t2w1lwt <t2w1lwt10 && t2w1lwt < t2h1uwt10 && t2w1lwt < t2h1dwt10
  && (loutwl==0 && linwl==0)){
  i=39;
  }

  if (myuOW==-1 && t2h1uwt > 0 && t2h1uwt < t1 
  && t2h1uwt < t2w1r && t2h1uwt < t2w1l && t2h1uwt < t2h1u && t2h1uwt < t2h1d && t2h1uwt < t2w1rwt && t2h1uwt < t2w1lwt && t2h1uwt < t2h1dwt 
  && t2h1uwt < t2w1r1 && t2h1uwt < t2w1l1 && t2h1uwt < t2h1u1 && t2h1uwt < t2h1d1 && t2h1uwt < t2w1rwt1 && t2h1uwt < t2w1lwt1 && t2h1uwt < t2h1uwt1 && t2h1uwt < t2h1dwt1
  && t2h1uwt < t2w1r2 && t2h1uwt < t2w1l2 && t2h1uwt < t2h1u2 && t2h1uwt < t2h1d2 && t2h1uwt < t2w1rwt2 && t2h1uwt < t2w1lwt2 && t2h1uwt < t2h1uwt2 && t2h1uwt < t2h1dwt2
  && t2h1uwt < t2w1r3 && t2h1uwt < t2w1l3 && t2h1uwt < t2h1u3 && t2h1uwt < t2h1d3 && t2h1uwt < t2w1rwt3 && t2h1uwt < t2w1lwt3 && t2h1uwt < t2h1uwt3 && t2h1uwt < t2h1dwt3
  && t2h1uwt < t2w1r4 && t2h1uwt < t2w1l4 && t2h1uwt < t2h1u4 && t2h1uwt < t2h1d4 && t2h1uwt < t2w1rwt4 && t2h1uwt < t2w1lwt4 && t2h1uwt < t2h1uwt4 && t2h1uwt < t2h1dwt4
  && t2h1uwt < t2w1r5 && t2h1uwt < t2w1l5 && t2h1uwt < t2h1u5 && t2h1uwt < t2h1d5 && t2h1uwt < t2w1rwt5 && t2h1uwt < t2w1lwt5 && t2h1uwt < t2h1uwt5 && t2h1uwt < t2h1dwt5
  && t2h1uwt < t2w1r6 && t2h1uwt < t2w1l6 && t2h1uwt < t2h1u6 && t2h1uwt < t2h1d6 && t2h1uwt < t2w1rwt6 && t2h1uwt < t2w1lwt6 && t2h1uwt < t2h1uwt6 && t2h1uwt < t2h1dwt6
  && t2h1uwt < t2w1r7 && t2h1uwt < t2w1l7 && t2h1uwt < t2h1u7 && t2h1uwt < t2h1d7 && t2h1uwt < t2w1rwt7 && t2h1uwt < t2w1lwt7 && t2h1uwt < t2h1uwt7 && t2h1uwt < t2h1dwt7
  && t2h1uwt < t2w1r8 && t2h1uwt < t2w1l8 && t2h1uwt < t2h1u8 && t2h1uwt < t2h1d8 && t2h1uwt < t2w1rwt8 && t2h1uwt < t2w1lwt8 && t2h1uwt < t2h1uwt8 && t2h1uwt < t2h1dwt8
  && t2h1uwt < t2w1r9 && t2h1uwt < t2w1l9 && t2h1uwt < t2h1u9 && t2h1uwt < t2h1d9 && t2h1uwt < t2w1rwt9 && t2h1uwt < t2w1lwt9 && t2h1uwt < t2h1uwt9 && t2h1uwt < t2h1dwt9
  && t2h1uwt < t2w1r10 && t2h1uwt < t2w1l10 && t2h1uwt < t2h1u10 && t2h1uwt < t2h1d10 && t2h1uwt < t2w1rwt10 && t2h1uwt < t2w1lwt10 && t2h1uwt < t2h1uwt10 && t2h1uwt < t2h1dwt10
  && (louthu !=0 && linhu!=0)){
  i=40;
  }

  if (myuOW==-1 && t2h1uwt > 0 && t2h1uwt < t1 
  && t2h1uwt < t2w1r && t2h1uwt < t2w1l && t2h1uwt < t2h1u && t2h1uwt < t2h1d && t2h1uwt < t2w1rwt && t2h1uwt < t2w1lwt && t2h1uwt < t2h1dwt 
  && t2h1uwt < t2w1r1 && t2h1uwt < t2w1l1 && t2h1uwt < t2h1u1 && t2h1uwt < t2h1d1 && t2h1uwt < t2w1rwt1 && t2h1uwt < t2w1lwt1 && t2h1uwt < t2h1uwt1 && t2h1uwt < t2h1dwt1
  && t2h1uwt < t2w1r2 && t2h1uwt < t2w1l2 && t2h1uwt < t2h1u2 && t2h1uwt < t2h1d2 && t2h1uwt < t2w1rwt2 && t2h1uwt < t2w1lwt2 && t2h1uwt < t2h1uwt2 && t2h1uwt < t2h1dwt2
  && t2h1uwt < t2w1r3 && t2h1uwt < t2w1l3 && t2h1uwt < t2h1u3 && t2h1uwt < t2h1d3 && t2h1uwt < t2w1rwt3 && t2h1uwt < t2w1lwt3 && t2h1uwt < t2h1uwt3 && t2h1uwt < t2h1dwt3
  && t2h1uwt < t2w1r4 && t2h1uwt < t2w1l4 && t2h1uwt < t2h1u4 && t2h1uwt < t2h1d4 && t2h1uwt < t2w1rwt4 && t2h1uwt < t2w1lwt4 && t2h1uwt < t2h1uwt4 && t2h1uwt < t2h1dwt4
  && t2h1uwt < t2w1r5 && t2h1uwt < t2w1l5 && t2h1uwt < t2h1u5 && t2h1uwt < t2h1d5 && t2h1uwt < t2w1rwt5 && t2h1uwt < t2w1lwt5 && t2h1uwt < t2h1uwt5 && t2h1uwt < t2h1dwt5
  && t2h1uwt < t2w1r6 && t2h1uwt < t2w1l6 && t2h1uwt < t2h1u6 && t2h1uwt < t2h1d6 && t2h1uwt < t2w1rwt6 && t2h1uwt < t2w1lwt6 && t2h1uwt < t2h1uwt6 && t2h1uwt < t2h1dwt6
  && t2h1uwt < t2w1r7 && t2h1uwt < t2w1l7 && t2h1uwt < t2h1u7 && t2h1uwt < t2h1d7 && t2h1uwt < t2w1rwt7 && t2h1uwt < t2w1lwt7 && t2h1uwt < t2h1uwt7 && t2h1uwt < t2h1dwt7
  && t2h1uwt < t2w1r8 && t2h1uwt < t2w1l8 && t2h1uwt < t2h1u8 && t2h1uwt < t2h1d8 && t2h1uwt < t2w1rwt8 && t2h1uwt < t2w1lwt8 && t2h1uwt < t2h1uwt8 && t2h1uwt < t2h1dwt8
  && t2h1uwt < t2w1r9 && t2h1uwt < t2w1l9 && t2h1uwt < t2h1u9 && t2h1uwt < t2h1d9 && t2h1uwt < t2w1rwt9 && t2h1uwt < t2w1lwt9 && t2h1uwt < t2h1uwt9 && t2h1uwt < t2h1dwt9
  && t2h1uwt < t2w1r10 && t2h1uwt < t2w1l10 && t2h1uwt < t2h1u10 && t2h1uwt < t2h1d10 && t2h1uwt < t2w1rwt10 && t2h1uwt < t2w1lwt10 && t2h1uwt < t2h1uwt10 && t2h1uwt < t2h1dwt10
  && ((louthu!=0 && linhu==0) || (louthu==0 && linhu!=0))){
  i=40;
  }

  if (myuOW==-1 && t2h1uwt > 0 && t2h1uwt < t1 
  && t2h1uwt < t2w1r && t2h1uwt < t2w1l && t2h1uwt < t2h1u && t2h1uwt < t2h1d && t2h1uwt < t2w1rwt && t2h1uwt < t2w1lwt && t2h1uwt < t2h1dwt 
  && t2h1uwt < t2w1r1 && t2h1uwt < t2w1l1 && t2h1uwt < t2h1u1 && t2h1uwt < t2h1d1 && t2h1uwt < t2w1rwt1 && t2h1uwt < t2w1lwt1 && t2h1uwt < t2h1uwt1 && t2h1uwt < t2h1dwt1
  && t2h1uwt < t2w1r2 && t2h1uwt < t2w1l2 && t2h1uwt < t2h1u2 && t2h1uwt < t2h1d2 && t2h1uwt < t2w1rwt2 && t2h1uwt < t2w1lwt2 && t2h1uwt < t2h1uwt2 && t2h1uwt < t2h1dwt2
  && t2h1uwt < t2w1r3 && t2h1uwt < t2w1l3 && t2h1uwt < t2h1u3 && t2h1uwt < t2h1d3 && t2h1uwt < t2w1rwt3 && t2h1uwt < t2w1lwt3 && t2h1uwt < t2h1uwt3 && t2h1uwt < t2h1dwt3
  && t2h1uwt < t2w1r4 && t2h1uwt < t2w1l4 && t2h1uwt < t2h1u4 && t2h1uwt < t2h1d4 && t2h1uwt < t2w1rwt4 && t2h1uwt < t2w1lwt4 && t2h1uwt < t2h1uwt4 && t2h1uwt < t2h1dwt4
  && t2h1uwt < t2w1r5 && t2h1uwt < t2w1l5 && t2h1uwt < t2h1u5 && t2h1uwt < t2h1d5 && t2h1uwt < t2w1rwt5 && t2h1uwt < t2w1lwt5 && t2h1uwt < t2h1uwt5 && t2h1uwt < t2h1dwt5
  && t2h1uwt < t2w1r6 && t2h1uwt < t2w1l6 && t2h1uwt < t2h1u6 && t2h1uwt < t2h1d6 && t2h1uwt < t2w1rwt6 && t2h1uwt < t2w1lwt6 && t2h1uwt < t2h1uwt6 && t2h1uwt < t2h1dwt6
  && t2h1uwt < t2w1r7 && t2h1uwt < t2w1l7 && t2h1uwt < t2h1u7 && t2h1uwt < t2h1d7 && t2h1uwt < t2w1rwt7 && t2h1uwt < t2w1lwt7 && t2h1uwt < t2h1uwt7 && t2h1uwt < t2h1dwt7
  && t2h1uwt < t2w1r8 && t2h1uwt < t2w1l8 && t2h1uwt < t2h1u8 && t2h1uwt < t2h1d8 && t2h1uwt < t2w1rwt8 && t2h1uwt < t2w1lwt8 && t2h1uwt < t2h1uwt8 && t2h1uwt < t2h1dwt8
  && t2h1uwt < t2w1r9 && t2h1uwt < t2w1l9 && t2h1uwt < t2h1u9 && t2h1uwt < t2h1d9 && t2h1uwt < t2w1rwt9 && t2h1uwt < t2w1lwt9 && t2h1uwt < t2h1uwt9 && t2h1uwt < t2h1dwt9
  && t2h1uwt < t2w1r10 && t2h1uwt < t2w1l10 && t2h1uwt < t2h1u10 && t2h1uwt < t2h1d10 && t2h1uwt < t2w1rwt10 && t2h1uwt < t2w1lwt10 && t2h1uwt < t2h1uwt10 && t2h1uwt < t2h1dwt10
  && (louthu == 0 && linhu == 0)){
  i=40;
  }

  if (mydOW==-1 && t2h1dwt > 0 && t2h1dwt < t1
  && t2h1dwt < t2w1r && t2h1dwt < t2w1l && t2h1dwt < t2h1u && t2h1dwt < t2h1d && t2h1dwt < t2w1rwt && t2h1dwt < t2w1lwt && t2h1dwt < t2h1uwt 
  && t2h1dwt < t2w1r1 && t2h1dwt < t2w1l1 && t2h1dwt < t2h1u1 && t2h1dwt < t2h1d1 && t2h1dwt < t2w1rwt1 && t2h1dwt < t2w1lwt1 && t2h1dwt < t2h1uwt1 && t2h1dwt < t2h1dwt1
  && t2h1dwt < t2w1r2 && t2h1dwt < t2w1l2 && t2h1dwt < t2h1u2 && t2h1dwt < t2h1d2 && t2h1dwt < t2w1rwt2 && t2h1dwt < t2w1lwt2 && t2h1dwt < t2h1uwt2 && t2h1dwt < t2h1dwt2 
  && t2h1dwt < t2w1r3 && t2h1dwt < t2w1l3 && t2h1dwt < t2h1u3 && t2h1dwt < t2h1d3 && t2h1dwt < t2w1rwt3 && t2h1dwt < t2w1lwt3 && t2h1dwt < t2h1uwt3 && t2h1dwt < t2h1dwt3
  && t2h1dwt < t2w1r4 && t2h1dwt < t2w1l4 && t2h1dwt < t2h1u4 && t2h1dwt < t2h1d4 && t2h1dwt < t2w1rwt4 && t2h1dwt < t2w1lwt4 && t2h1dwt < t2h1uwt4 && t2h1dwt < t2h1dwt4
  && t2h1dwt < t2w1r5 && t2h1dwt < t2w1l5 && t2h1dwt < t2h1u5 && t2h1dwt < t2h1d5 && t2h1dwt < t2w1rwt5 && t2h1dwt < t2w1lwt5 && t2h1dwt < t2h1uwt5 && t2h1dwt < t2h1dwt5
  && t2h1dwt < t2w1r6 && t2h1dwt < t2w1l6 && t2h1dwt < t2h1u6 && t2h1dwt < t2h1d6 && t2h1dwt < t2w1rwt6 && t2h1dwt < t2w1lwt6 && t2h1dwt < t2h1uwt6 && t2h1dwt < t2h1dwt6
  && t2h1dwt < t2w1r7 && t2h1dwt < t2w1l7 && t2h1dwt < t2h1u7 && t2h1dwt < t2h1d7 && t2h1dwt < t2w1rwt7 && t2h1dwt < t2w1lwt7 && t2h1dwt < t2h1uwt7 && t2h1dwt < t2h1dwt7 
  && t2h1dwt < t2w1r8 && t2h1dwt < t2w1l8 && t2h1dwt < t2h1u8 && t2h1dwt < t2h1d8 && t2h1dwt < t2w1rwt8 && t2h1dwt < t2w1lwt8 && t2h1dwt < t2h1uwt8 && t2h1dwt < t2h1dwt8
  && t2h1dwt < t2w1r9 && t2h1dwt < t2w1l9 && t2h1dwt < t2h1u9 && t2h1dwt < t2h1d9 && t2h1dwt < t2w1rwt9 && t2h1dwt < t2w1lwt9 && t2h1dwt < t2h1uwt9 && t2h1dwt < t2h1dwt9 
  && t2h1dwt < t2w1r10 && t2h1dwt < t2w1l10 && t2h1dwt < t2h1u10 && t2h1dwt < t2h1d10 && t2h1dwt < t2w1rwt10 && t2h1dwt < t2w1lwt10 && t2h1dwt < t2h1uwt10 && t2h1dwt < t2h1dwt10
  && (louthd !=0 && linhd!=0)){
  i=41;
  }

  if (mydOW==-1 && t2h1dwt > 0 && t2h1dwt < t1 
  && t2h1dwt < t2w1r && t2h1dwt < t2w1l && t2h1dwt < t2h1u && t2h1dwt < t2h1d && t2h1dwt < t2w1rwt && t2h1dwt < t2w1lwt && t2h1dwt < t2h1uwt 
  && t2h1dwt < t2w1r1 && t2h1dwt < t2w1l1 && t2h1dwt < t2h1u1 && t2h1dwt < t2h1d1 && t2h1dwt < t2w1rwt1 && t2h1dwt < t2w1lwt1 && t2h1dwt < t2h1uwt1 && t2h1dwt < t2h1dwt1
  && t2h1dwt < t2w1r2 && t2h1dwt < t2w1l2 && t2h1dwt < t2h1u2 && t2h1dwt < t2h1d2 && t2h1dwt < t2w1rwt2 && t2h1dwt < t2w1lwt2 && t2h1dwt < t2h1uwt2 && t2h1dwt < t2h1dwt2 
  && t2h1dwt < t2w1r3 && t2h1dwt < t2w1l3 && t2h1dwt < t2h1u3 && t2h1dwt < t2h1d3 && t2h1dwt < t2w1rwt3 && t2h1dwt < t2w1lwt3 && t2h1dwt < t2h1uwt3 && t2h1dwt < t2h1dwt3
  && t2h1dwt < t2w1r4 && t2h1dwt < t2w1l4 && t2h1dwt < t2h1u4 && t2h1dwt < t2h1d4 && t2h1dwt < t2w1rwt4 && t2h1dwt < t2w1lwt4 && t2h1dwt < t2h1uwt4 && t2h1dwt < t2h1dwt4
  && t2h1dwt < t2w1r5 && t2h1dwt < t2w1l5 && t2h1dwt < t2h1u5 && t2h1dwt < t2h1d5 && t2h1dwt < t2w1rwt5 && t2h1dwt < t2w1lwt5 && t2h1dwt < t2h1uwt5 && t2h1dwt < t2h1dwt5
  && t2h1dwt < t2w1r6 && t2h1dwt < t2w1l6 && t2h1dwt < t2h1u6 && t2h1dwt < t2h1d6 && t2h1dwt < t2w1rwt6 && t2h1dwt < t2w1lwt6 && t2h1dwt < t2h1uwt6 && t2h1dwt < t2h1dwt6
  && t2h1dwt < t2w1r7 && t2h1dwt < t2w1l7 && t2h1dwt < t2h1u7 && t2h1dwt < t2h1d7 && t2h1dwt < t2w1rwt7 && t2h1dwt < t2w1lwt7 && t2h1dwt < t2h1uwt7 && t2h1dwt < t2h1dwt7 
  && t2h1dwt < t2w1r8 && t2h1dwt < t2w1l8 && t2h1dwt < t2h1u8 && t2h1dwt < t2h1d8 && t2h1dwt < t2w1rwt8 && t2h1dwt < t2w1lwt8 && t2h1dwt < t2h1uwt8 && t2h1dwt < t2h1dwt8
  && t2h1dwt < t2w1r9 && t2h1dwt < t2w1l9 && t2h1dwt < t2h1u9 && t2h1dwt < t2h1d9 && t2h1dwt < t2w1rwt9 && t2h1dwt < t2w1lwt9 && t2h1dwt < t2h1uwt9 && t2h1dwt < t2h1dwt9 
  && t2h1dwt < t2w1r10 && t2h1dwt < t2w1l10 && t2h1dwt < t2h1u10 && t2h1dwt < t2h1d10 && t2h1dwt < t2w1rwt10 && t2h1dwt < t2w1lwt10 && t2h1dwt < t2h1uwt10 && t2h1dwt < t2h1dwt10
  &&  ((louthd !=0 && linhd==0) || (louthd ==0 && linhd!=0))){
  i=41;
  }

  if (mydOW==-1 && t2h1dwt > 0 && t2h1dwt < t1 
  && t2h1dwt < t2w1r && t2h1dwt < t2w1l && t2h1dwt < t2h1u && t2h1dwt < t2h1d && t2h1dwt < t2w1rwt && t2h1dwt < t2w1lwt && t2h1dwt < t2h1uwt 
  && t2h1dwt < t2w1r1 && t2h1dwt < t2w1l1 && t2h1dwt < t2h1u1 && t2h1dwt < t2h1d1 && t2h1dwt < t2w1rwt1 && t2h1dwt < t2w1lwt1 && t2h1dwt < t2h1uwt1 && t2h1dwt < t2h1dwt1
  && t2h1dwt < t2w1r2 && t2h1dwt < t2w1l2 && t2h1dwt < t2h1u2 && t2h1dwt < t2h1d2 && t2h1dwt < t2w1rwt2 && t2h1dwt < t2w1lwt2 && t2h1dwt < t2h1uwt2 && t2h1dwt < t2h1dwt2 
  && t2h1dwt < t2w1r3 && t2h1dwt < t2w1l3 && t2h1dwt < t2h1u3 && t2h1dwt < t2h1d3 && t2h1dwt < t2w1rwt3 && t2h1dwt < t2w1lwt3 && t2h1dwt < t2h1uwt3 && t2h1dwt < t2h1dwt3
  && t2h1dwt < t2w1r4 && t2h1dwt < t2w1l4 && t2h1dwt < t2h1u4 && t2h1dwt < t2h1d4 && t2h1dwt < t2w1rwt4 && t2h1dwt < t2w1lwt4 && t2h1dwt < t2h1uwt4 && t2h1dwt < t2h1dwt4
  && t2h1dwt < t2w1r5 && t2h1dwt < t2w1l5 && t2h1dwt < t2h1u5 && t2h1dwt < t2h1d5 && t2h1dwt < t2w1rwt5 && t2h1dwt < t2w1lwt5 && t2h1dwt < t2h1uwt5 && t2h1dwt < t2h1dwt5
  && t2h1dwt < t2w1r6 && t2h1dwt < t2w1l6 && t2h1dwt < t2h1u6 && t2h1dwt < t2h1d6 && t2h1dwt < t2w1rwt6 && t2h1dwt < t2w1lwt6 && t2h1dwt < t2h1uwt6 && t2h1dwt < t2h1dwt6
  && t2h1dwt < t2w1r7 && t2h1dwt < t2w1l7 && t2h1dwt < t2h1u7 && t2h1dwt < t2h1d7 && t2h1dwt < t2w1rwt7 && t2h1dwt < t2w1lwt7 && t2h1dwt < t2h1uwt7 && t2h1dwt < t2h1dwt7 
  && t2h1dwt < t2w1r8 && t2h1dwt < t2w1l8 && t2h1dwt < t2h1u8 && t2h1dwt < t2h1d8 && t2h1dwt < t2w1rwt8 && t2h1dwt < t2w1lwt8 && t2h1dwt < t2h1uwt8 && t2h1dwt < t2h1dwt8
  && t2h1dwt < t2w1r9 && t2h1dwt < t2w1l9 && t2h1dwt < t2h1u9 && t2h1dwt < t2h1d9 && t2h1dwt < t2w1rwt9 && t2h1dwt < t2w1lwt9 && t2h1dwt < t2h1uwt9 && t2h1dwt < t2h1dwt9 
  && t2h1dwt < t2w1r10 && t2h1dwt < t2w1l10 && t2h1dwt < t2h1u10 && t2h1dwt < t2h1d10 && t2h1dwt < t2w1rwt10 && t2h1dwt < t2w1lwt10 && t2h1dwt < t2h1uwt10 && t2h1dwt < t2h1dwt10
  &&  (louthd == 0 && linhd == 0)){
  i=41;
  }


													/* FIRST SHELL */



if (mxr1!=-1 && t2w1r1 > 0 && t2w1r1 < t1 
     && t2w1r1 < t2w1r && t2w1r1 < t2w1l && t2w1r1 < t2h1u && t2w1r1 < t2h1d && t2w1r1 < t2w1rwt && t2w1r1 < t2w1lwt && t2w1r1 < t2h1uwt && t2w1r1 < t2h1dwt
     && t2w1r1 < t2w1l1 && t2w1r1 < t2h1u1 && t2w1r1 < t2h1d1 && t2w1r1 < t2w1rwt1 && t2w1r1 < t2w1lwt1 && t2w1r1 < t2h1uwt1 && t2w1r1 < t2h1dwt1
     && t2w1r1 < t2w1r2 && t2w1r1 < t2w1l2 && t2w1r1 < t2h1u2 && t2w1r1 < t2h1d2 && t2w1r1 < t2w1rwt2 && t2w1r1 < t2w1lwt2 && t2w1r1 < t2h1uwt2 && t2w1r1 < t2h1dwt2 
     && t2w1r1 < t2w1r3 && t2w1r1 < t2w1l3 && t2w1r1 < t2h1u3 && t2w1r1 < t2h1d3 && t2w1r1 < t2w1rwt3 && t2w1r1 < t2w1lwt3 && t2w1r1 < t2h1uwt3 && t2w1r1 < t2h1dwt3
     && t2w1r1 < t2w1r4 && t2w1r1 < t2w1l4 && t2w1r1 < t2h1u4 && t2w1r1 < t2h1d4 && t2w1r1 < t2w1rwt4 && t2w1r1 < t2w1lwt4 && t2w1r1 < t2h1uwt4 && t2w1r1 < t2h1dwt4
     && t2w1r1 < t2w1r5 && t2w1r1 < t2w1l5 && t2w1r1 < t2h1u5 && t2w1r1 < t2h1d5 && t2w1r1 < t2w1rwt5 && t2w1r1 < t2w1lwt5 && t2w1r1 < t2h1uwt5 && t2w1r1 < t2h1dwt5
     && t2w1r1 < t2w1r6 && t2w1r1 < t2w1l6 && t2w1r1 < t2h1u6 && t2w1r1 < t2h1d6 && t2w1r1 < t2w1rwt6 && t2w1r1 < t2w1lwt6 && t2w1r1 < t2h1uwt6 && t2w1r1 < t2h1dwt6
     && t2w1r1 < t2w1r7 && t2w1r1 < t2w1l7 && t2w1r1 < t2h1u7 && t2w1r1 < t2h1d7 && t2w1r1 < t2w1rwt7 && t2w1r1 < t2w1lwt7 && t2w1r1 < t2h1uwt7 && t2w1r1 < t2h1dwt7
     && t2w1r1 < t2w1r8 && t2w1r1 < t2w1l8 && t2w1r1 < t2h1u8 && t2w1r1 < t2h1d8 && t2w1r1 < t2w1rwt8 && t2w1r1 < t2w1lwt8 && t2w1r1 < t2h1uwt8 && t2w1r1 < t2h1dwt8
     && t2w1r1 < t2w1r9 && t2w1r1 < t2w1l9 && t2w1r1 < t2h1u9 && t2w1r1 < t2h1d9 && t2w1r1 < t2w1rwt9 && t2w1r1 < t2w1lwt9 && t2w1r1 < t2h1uwt9 && t2w1r1 < t2h1dwt9
     && t2w1r1 < t2w1r10 && t2w1r1 < t2w1l10 && t2w1r1 < t2h1u10 && t2w1r1 < t2h1d10 && t2w1r1 < t2w1rwt10 && t2w1r1 < t2w1lwt10 && t2w1r1 < t2h1uwt10 && t2w1r1 < t2h1dwt10
     && ((linwr1!=0) && (loutwr1!=0) )) {
   if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1r1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1r1+z))*(z0hd1+(vz*t2w1r1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1r1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1r1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1r1+z))*(z0hu1+(vz*t2w1r1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1r1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1r1+y;
  xlimitr=bwr1*sqrt(1-((vz*t2w1r1+z)+z0wr1)*((vz*t2w1r1+z)+z0wr1)/a2wr1);
  xtest=vx*t2w1r1+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr1 > 0){
  i=42;
  }else{
  i=54;
  }
  }

  if (mxr1!=-1 && t2w1r1 > 0 && t2w1r1 < t1 
     && t2w1r1 < t2w1r && t2w1r1 < t2w1l && t2w1r1 < t2h1u && t2w1r1 < t2h1d && t2w1r1 < t2w1rwt && t2w1r1 < t2w1lwt && t2w1r1 < t2h1uwt && t2w1r1 < t2h1dwt
     && t2w1r1 < t2w1l1 && t2w1r1 < t2h1u1 && t2w1r1 < t2h1d1 && t2w1r1 < t2w1rwt1 && t2w1r1 < t2w1lwt1 && t2w1r1 < t2h1uwt1 && t2w1r1 < t2h1dwt1
     && t2w1r1 < t2w1r2 && t2w1r1 < t2w1l2 && t2w1r1 < t2h1u2 && t2w1r1 < t2h1d2 && t2w1r1 < t2w1rwt2 && t2w1r1 < t2w1lwt2 && t2w1r1 < t2h1uwt2 && t2w1r1 < t2h1dwt2 
     && t2w1r1 < t2w1r3 && t2w1r1 < t2w1l3 && t2w1r1 < t2h1u3 && t2w1r1 < t2h1d3 && t2w1r1 < t2w1rwt3 && t2w1r1 < t2w1lwt3 && t2w1r1 < t2h1uwt3 && t2w1r1 < t2h1dwt3
     && t2w1r1 < t2w1r4 && t2w1r1 < t2w1l4 && t2w1r1 < t2h1u4 && t2w1r1 < t2h1d4 && t2w1r1 < t2w1rwt4 && t2w1r1 < t2w1lwt4 && t2w1r1 < t2h1uwt4 && t2w1r1 < t2h1dwt4
     && t2w1r1 < t2w1r5 && t2w1r1 < t2w1l5 && t2w1r1 < t2h1u5 && t2w1r1 < t2h1d5 && t2w1r1 < t2w1rwt5 && t2w1r1 < t2w1lwt5 && t2w1r1 < t2h1uwt5 && t2w1r1 < t2h1dwt5
     && t2w1r1 < t2w1r6 && t2w1r1 < t2w1l6 && t2w1r1 < t2h1u6 && t2w1r1 < t2h1d6 && t2w1r1 < t2w1rwt6 && t2w1r1 < t2w1lwt6 && t2w1r1 < t2h1uwt6 && t2w1r1 < t2h1dwt6
     && t2w1r1 < t2w1r7 && t2w1r1 < t2w1l7 && t2w1r1 < t2h1u7 && t2w1r1 < t2h1d7 && t2w1r1 < t2w1rwt7 && t2w1r1 < t2w1lwt7 && t2w1r1 < t2h1uwt7 && t2w1r1 < t2h1dwt7
     && t2w1r1 < t2w1r8 && t2w1r1 < t2w1l8 && t2w1r1 < t2h1u8 && t2w1r1 < t2h1d8 && t2w1r1 < t2w1rwt8 && t2w1r1 < t2w1lwt8 && t2w1r1 < t2h1uwt8 && t2w1r1 < t2h1dwt8
     && t2w1r1 < t2w1r9 && t2w1r1 < t2w1l9 && t2w1r1 < t2h1u9 && t2w1r1 < t2h1d9 && t2w1r1 < t2w1rwt9 && t2w1r1 < t2w1lwt9 && t2w1r1 < t2h1uwt9 && t2w1r1 < t2h1dwt9
     && t2w1r1 < t2w1r10 && t2w1r1 < t2w1l10 && t2w1r1 < t2h1u10 && t2w1r1 < t2h1d10 && t2w1r1 < t2w1rwt10 && t2w1r1 < t2w1lwt10 && t2w1r1 < t2h1uwt10 && t2w1r1 < t2h1dwt10
     && ((loutwr1!=0 && linwr1==0) || (loutwr1==0 && linwr1!=0))){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1r1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1r1+z))*(z0hd1+(vz*t2w1r1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1r1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1r1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1r1+z))*(z0hu1+(vz*t2w1r1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1r1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1r1+y;
  xtest=vx*t2w1r1+x;
  xlimitr=-sqrt(pbwr1-(vz*t2w1r1+z)/pawr1);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr1 > 0){
  i=43;
  }else{
  i=54;}
  }

  if (mxr1!=-1 && t2w1r1 > 0 && t2w1r1 < t1 
     && t2w1r1 < t2w1r && t2w1r1 < t2w1l && t2w1r1 < t2h1u && t2w1r1 < t2h1d && t2w1r1 < t2w1rwt && t2w1r1 < t2w1lwt && t2w1r1 < t2h1uwt && t2w1r1 < t2h1dwt
     && t2w1r1 < t2w1l1 && t2w1r1 < t2h1u1 && t2w1r1 < t2h1d1 && t2w1r1 < t2w1rwt1 && t2w1r1 < t2w1lwt1 && t2w1r1 < t2h1uwt1 && t2w1r1 < t2h1dwt1
     && t2w1r1 < t2w1r2 && t2w1r1 < t2w1l2 && t2w1r1 < t2h1u2 && t2w1r1 < t2h1d2 && t2w1r1 < t2w1rwt2 && t2w1r1 < t2w1lwt2 && t2w1r1 < t2h1uwt2 && t2w1r1 < t2h1dwt2 
     && t2w1r1 < t2w1r3 && t2w1r1 < t2w1l3 && t2w1r1 < t2h1u3 && t2w1r1 < t2h1d3 && t2w1r1 < t2w1rwt3 && t2w1r1 < t2w1lwt3 && t2w1r1 < t2h1uwt3 && t2w1r1 < t2h1dwt3
     && t2w1r1 < t2w1r4 && t2w1r1 < t2w1l4 && t2w1r1 < t2h1u4 && t2w1r1 < t2h1d4 && t2w1r1 < t2w1rwt4 && t2w1r1 < t2w1lwt4 && t2w1r1 < t2h1uwt4 && t2w1r1 < t2h1dwt4
     && t2w1r1 < t2w1r5 && t2w1r1 < t2w1l5 && t2w1r1 < t2h1u5 && t2w1r1 < t2h1d5 && t2w1r1 < t2w1rwt5 && t2w1r1 < t2w1lwt5 && t2w1r1 < t2h1uwt5 && t2w1r1 < t2h1dwt5
     && t2w1r1 < t2w1r6 && t2w1r1 < t2w1l6 && t2w1r1 < t2h1u6 && t2w1r1 < t2h1d6 && t2w1r1 < t2w1rwt6 && t2w1r1 < t2w1lwt6 && t2w1r1 < t2h1uwt6 && t2w1r1 < t2h1dwt6
     && t2w1r1 < t2w1r7 && t2w1r1 < t2w1l7 && t2w1r1 < t2h1u7 && t2w1r1 < t2h1d7 && t2w1r1 < t2w1rwt7 && t2w1r1 < t2w1lwt7 && t2w1r1 < t2h1uwt7 && t2w1r1 < t2h1dwt7
     && t2w1r1 < t2w1r8 && t2w1r1 < t2w1l8 && t2w1r1 < t2h1u8 && t2w1r1 < t2h1d8 && t2w1r1 < t2w1rwt8 && t2w1r1 < t2w1lwt8 && t2w1r1 < t2h1uwt8 && t2w1r1 < t2h1dwt8
     && t2w1r1 < t2w1r9 && t2w1r1 < t2w1l9 && t2w1r1 < t2h1u9 && t2w1r1 < t2h1d9 && t2w1r1 < t2w1rwt9 && t2w1r1 < t2w1lwt9 && t2w1r1 < t2h1uwt9 && t2w1r1 < t2h1dwt9
     && t2w1r1 < t2w1r10 && t2w1r1 < t2w1l10 && t2w1r1 < t2h1u10 && t2w1r1 < t2h1d10 && t2w1r1 < t2w1rwt10 && t2w1r1 < t2w1lwt10 && t2w1r1 < t2h1uwt10 && t2w1r1 < t2h1dwt10
     && (loutwr1==0 && linwr1==0)){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1r1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1r1+z))*(z0hd1+(vz*t2w1r1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1r1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1r1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1r1+z))*(z0hu1+(vz*t2w1r1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1r1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1r1+y;
  xtest=vx*t2w1r1+x;
  xlimitr=-(w2r1+w1r1)*(vz*t2w1r1+z)/l-w1r1;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr1>0){
  i=44;
  }else{
  i=54;
  }
  }

  if (mxl1!=-1 && t2w1l1 > 0 && t2w1l1 < t1 
      && t2w1l1 < t2w1r && t2w1l1 < t2w1l && t2w1l1 < t2h1u && t2w1l1 < t2h1d && t2w1l1 < t2w1rwt && t2w1l1 < t2w1lwt && t2w1l1 < t2h1uwt && t2w1l1 < t2h1dwt
      && t2w1l1 < t2w1r1 && t2w1l1 < t2h1u1 && t2w1l1 < t2h1d1 && t2w1l1 < t2w1rwt1 && t2w1l1 < t2w1lwt1 && t2w1l1 < t2h1uwt1 && t2w1l1 < t2h1dwt1
      && t2w1l1 < t2w1r2 && t2w1l1 < t2w1l2 && t2w1l1 < t2h1u2 && t2w1l1 < t2h1d2 && t2w1l1 < t2w1rwt2 && t2w1l1 < t2w1lwt2 && t2w1l1 < t2h1uwt2 && t2w1l1 < t2h1dwt2
      && t2w1l1 < t2w1r3 && t2w1l1 < t2w1l3 && t2w1l1 < t2h1u3 && t2w1l1 < t2h1d3 && t2w1l1 < t2w1rwt3 && t2w1l1 < t2w1lwt3 && t2w1l1 < t2h1uwt3 && t2w1l1 < t2h1dwt3
      && t2w1l1 < t2w1r4 && t2w1l1 < t2w1l4 && t2w1l1 < t2h1u4 && t2w1l1 < t2h1d4 && t2w1l1 < t2w1rwt4 && t2w1l1 < t2w1lwt4 && t2w1l1 < t2h1uwt4 && t2w1l1 < t2h1dwt4
      && t2w1l1 < t2w1r5 && t2w1l1 < t2w1l5 && t2w1l1 < t2h1u5 && t2w1l1 < t2h1d5 && t2w1l1 < t2w1rwt5 && t2w1l1 < t2w1lwt5 && t2w1l1 < t2h1uwt5 && t2w1l1 < t2h1dwt5
      && t2w1l1 < t2w1r6 && t2w1l1 < t2w1l6 && t2w1l1 < t2h1u6 && t2w1l1 < t2h1d6 && t2w1l1 < t2w1rwt6 && t2w1l1 < t2w1lwt6 && t2w1l1 < t2h1uwt6 && t2w1l1 < t2h1dwt6
      && t2w1l1 < t2w1r7 && t2w1l1 < t2w1l7 && t2w1l1 < t2h1u7 && t2w1l1 < t2h1d7 && t2w1l1 < t2w1rwt7 && t2w1l1 < t2w1lwt7 && t2w1l1 < t2h1uwt7 && t2w1l1 < t2h1dwt7
      && t2w1l1 < t2w1r8 && t2w1l1 < t2w1l8 && t2w1l1 < t2h1u8 && t2w1l1 < t2h1d8 && t2w1l1 < t2w1rwt8 && t2w1l1 < t2w1lwt8 && t2w1l1 < t2h1uwt8 && t2w1l1 < t2h1dwt8
      && t2w1l1 < t2w1r9 && t2w1l1 < t2w1l9 && t2w1l1 < t2h1u9 && t2w1l1 < t2h1d9 && t2w1l1 < t2w1rwt9 && t2w1l1 < t2w1lwt9 && t2w1l1 < t2h1uwt9 && t2w1l1 < t2h1dwt9
      && t2w1l1 < t2w1r10 && t2w1l1 < t2w1l10 && t2w1l1 < t2h1u10 && t2w1l1 < t2h1d10 && t2w1l1 < t2w1rwt10 && t2w1l1 < t2w1lwt10 && t2w1l1 < t2h1uwt10 && t2w1l1 < t2h1dwt10
      && ((linwl1!=0) && (loutwl1!=0) )){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1l1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1l1+z))*(z0hd1+(vz*t2w1l1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1l1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1l1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1l1+z))*(z0hu1+(vz*t2w1l1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1l1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1l1+y;
  xlimitl=bwl1*sqrt(1-((vz*t2w1l1+z)+z0wl1)*((vz*t2w1l1+z)+z0wl1)/a2wl1);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl1>0){
  i=45;
  }else{
  i=55;
  }
  }

  if (mxl1!=-1 && t2w1l1 > 0 && t2w1l1 < t1 
      && t2w1l1 < t2w1r && t2w1l1 < t2w1l && t2w1l1 < t2h1u && t2w1l1 < t2h1d && t2w1l1 < t2w1rwt && t2w1l1 < t2w1lwt && t2w1l1 < t2h1uwt && t2w1l1 < t2h1dwt
      && t2w1l1 < t2w1r1 && t2w1l1 < t2h1u1 && t2w1l1 < t2h1d1 && t2w1l1 < t2w1rwt1 && t2w1l1 < t2w1lwt1 && t2w1l1 < t2h1uwt1 && t2w1l1 < t2h1dwt1
      && t2w1l1 < t2w1r2 && t2w1l1 < t2w1l2 && t2w1l1 < t2h1u2 && t2w1l1 < t2h1d2 && t2w1l1 < t2w1rwt2 && t2w1l1 < t2w1lwt2 && t2w1l1 < t2h1uwt2 && t2w1l1 < t2h1dwt2
      && t2w1l1 < t2w1r3 && t2w1l1 < t2w1l3 && t2w1l1 < t2h1u3 && t2w1l1 < t2h1d3 && t2w1l1 < t2w1rwt3 && t2w1l1 < t2w1lwt3 && t2w1l1 < t2h1uwt3 && t2w1l1 < t2h1dwt3
      && t2w1l1 < t2w1r4 && t2w1l1 < t2w1l4 && t2w1l1 < t2h1u4 && t2w1l1 < t2h1d4 && t2w1l1 < t2w1rwt4 && t2w1l1 < t2w1lwt4 && t2w1l1 < t2h1uwt4 && t2w1l1 < t2h1dwt4
      && t2w1l1 < t2w1r5 && t2w1l1 < t2w1l5 && t2w1l1 < t2h1u5 && t2w1l1 < t2h1d5 && t2w1l1 < t2w1rwt5 && t2w1l1 < t2w1lwt5 && t2w1l1 < t2h1uwt5 && t2w1l1 < t2h1dwt5
      && t2w1l1 < t2w1r6 && t2w1l1 < t2w1l6 && t2w1l1 < t2h1u6 && t2w1l1 < t2h1d6 && t2w1l1 < t2w1rwt6 && t2w1l1 < t2w1lwt6 && t2w1l1 < t2h1uwt6 && t2w1l1 < t2h1dwt6
      && t2w1l1 < t2w1r7 && t2w1l1 < t2w1l7 && t2w1l1 < t2h1u7 && t2w1l1 < t2h1d7 && t2w1l1 < t2w1rwt7 && t2w1l1 < t2w1lwt7 && t2w1l1 < t2h1uwt7 && t2w1l1 < t2h1dwt7
      && t2w1l1 < t2w1r8 && t2w1l1 < t2w1l8 && t2w1l1 < t2h1u8 && t2w1l1 < t2h1d8 && t2w1l1 < t2w1rwt8 && t2w1l1 < t2w1lwt8 && t2w1l1 < t2h1uwt8 && t2w1l1 < t2h1dwt8
      && t2w1l1 < t2w1r9 && t2w1l1 < t2w1l9 && t2w1l1 < t2h1u9 && t2w1l1 < t2h1d9 && t2w1l1 < t2w1rwt9 && t2w1l1 < t2w1lwt9 && t2w1l1 < t2h1uwt9 && t2w1l1 < t2h1dwt9
      && t2w1l1 < t2w1r10 && t2w1l1 < t2w1l10 && t2w1l1 < t2h1u10 && t2w1l1 < t2h1d10 && t2w1l1 < t2w1rwt10 && t2w1l1 < t2w1lwt10 && t2w1l1 < t2h1uwt10 && t2w1l1 < t2h1dwt10
      && ((loutwl1!=0 && linwl1==0) || (loutwl1==0 && linwl1!=0))){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1l1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1l1+z))*(z0hd1+(vz*t2w1l1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1l1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1l1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1l1+z))*(z0hu1+(vz*t2w1l1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1l1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1l1+y;
  xlimitl=sqrt(pbwl1-(vz*t2w1l1+z)/pawl1);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl1>0){
  i=46;
  }else{
  i=55;
  }
  }

  if (mxl1!=-1 && t2w1l1 > 0 && t2w1l1 < t1 
      && t2w1l1 < t2w1r && t2w1l1 < t2w1l && t2w1l1 < t2h1u && t2w1l1 < t2h1d && t2w1l1 < t2w1rwt && t2w1l1 < t2w1lwt && t2w1l1 < t2h1uwt && t2w1l1 < t2h1dwt
      && t2w1l1 < t2w1r1 && t2w1l1 < t2h1u1 && t2w1l1 < t2h1d1 && t2w1l1 < t2w1rwt1 && t2w1l1 < t2w1lwt1 && t2w1l1 < t2h1uwt1 && t2w1l1 < t2h1dwt1
      && t2w1l1 < t2w1r2 && t2w1l1 < t2w1l2 && t2w1l1 < t2h1u2 && t2w1l1 < t2h1d2 && t2w1l1 < t2w1rwt2 && t2w1l1 < t2w1lwt2 && t2w1l1 < t2h1uwt2 && t2w1l1 < t2h1dwt2
      && t2w1l1 < t2w1r3 && t2w1l1 < t2w1l3 && t2w1l1 < t2h1u3 && t2w1l1 < t2h1d3 && t2w1l1 < t2w1rwt3 && t2w1l1 < t2w1lwt3 && t2w1l1 < t2h1uwt3 && t2w1l1 < t2h1dwt3
      && t2w1l1 < t2w1r4 && t2w1l1 < t2w1l4 && t2w1l1 < t2h1u4 && t2w1l1 < t2h1d4 && t2w1l1 < t2w1rwt4 && t2w1l1 < t2w1lwt4 && t2w1l1 < t2h1uwt4 && t2w1l1 < t2h1dwt4
      && t2w1l1 < t2w1r5 && t2w1l1 < t2w1l5 && t2w1l1 < t2h1u5 && t2w1l1 < t2h1d5 && t2w1l1 < t2w1rwt5 && t2w1l1 < t2w1lwt5 && t2w1l1 < t2h1uwt5 && t2w1l1 < t2h1dwt5
      && t2w1l1 < t2w1r6 && t2w1l1 < t2w1l6 && t2w1l1 < t2h1u6 && t2w1l1 < t2h1d6 && t2w1l1 < t2w1rwt6 && t2w1l1 < t2w1lwt6 && t2w1l1 < t2h1uwt6 && t2w1l1 < t2h1dwt6
      && t2w1l1 < t2w1r7 && t2w1l1 < t2w1l7 && t2w1l1 < t2h1u7 && t2w1l1 < t2h1d7 && t2w1l1 < t2w1rwt7 && t2w1l1 < t2w1lwt7 && t2w1l1 < t2h1uwt7 && t2w1l1 < t2h1dwt7
      && t2w1l1 < t2w1r8 && t2w1l1 < t2w1l8 && t2w1l1 < t2h1u8 && t2w1l1 < t2h1d8 && t2w1l1 < t2w1rwt8 && t2w1l1 < t2w1lwt8 && t2w1l1 < t2h1uwt8 && t2w1l1 < t2h1dwt8
      && t2w1l1 < t2w1r9 && t2w1l1 < t2w1l9 && t2w1l1 < t2h1u9 && t2w1l1 < t2h1d9 && t2w1l1 < t2w1rwt9 && t2w1l1 < t2w1lwt9 && t2w1l1 < t2h1uwt9 && t2w1l1 < t2h1dwt9
      && t2w1l1 < t2w1r10 && t2w1l1 < t2w1l10 && t2w1l1 < t2h1u10 && t2w1l1 < t2h1d10 && t2w1l1 < t2w1rwt10 && t2w1l1 < t2w1lwt10 && t2w1l1 < t2h1uwt10 && t2w1l1 < t2h1dwt10
      && (loutwl1==0 && linwl1==0)){
   if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1l1+z)-h1d1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhd1*sqrt(1-((z0hd1+(vz*t2w1l1+z))*(z0hd1+(vz*t2w1l1+z)))/a2hd1);
      }else{
      ylimitd=-sqrt(((vz*t2w1l1+z)-pbhd1)/-pahd1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1l1+z)+h1u1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhu1*sqrt(1-((z0hu1+(vz*t2w1l1+z))*(z0hu1+(vz*t2w1l1+z)))/a2hu1);
     }else{
     ylimitu=sqrt(((vz*t2w1l1+z)-pbhu1)/-pahu1);
    }
    }
  ytest=vy*t2w1l1+y;
  xlimitl=(w2l1-w1l1)*(vz*t2w1l1+z)/l+w1l1;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl1>0){
  i=47;
  }else{
  i=55;
  }
  }

  if (myu1!=-1 && t2h1u1 > 0 && t2h1u1 < t1 
  && t2h1u1 < t2w1r && t2h1u1 < t2w1l && t2h1u1 < t2h1u && t2h1u1 < t2h1d && t2h1u1 < t2w1rwt && t2h1u1 < t2w1lwt && t2h1u1 < t2h1uwt && t2h1u1 < t2h1dwt
  && t2h1u1 < t2w1r1 && t2h1u1 < t2w1l1 && t2h1u1 < t2h1d1 && t2h1u1 < t2w1rwt1 && t2h1u1 < t2w1lwt1 && t2h1u1 < t2h1uwt1 && t2h1u1 < t2h1dwt1
  && t2h1u1 < t2w1r2 && t2h1u1 < t2w1l2 && t2h1u1 < t2h1u2 && t2h1u1 < t2h1d2 && t2h1u1 < t2w1rwt2 && t2h1u1 < t2w1lwt2 && t2h1u1 < t2h1uwt2 && t2h1u1 < t2h1dwt2
  && t2h1u1 < t2w1r3 && t2h1u1 < t2w1l3 && t2h1u1 < t2h1u3 && t2h1u1 < t2h1d3 && t2h1u1 < t2w1rwt3 && t2h1u1 < t2w1lwt3 && t2h1u1 < t2h1uwt3 && t2h1u1 < t2h1dwt3
  && t2h1u1 < t2w1r4 && t2h1u1 < t2w1l4 && t2h1u1 < t2h1u4 && t2h1u1 < t2h1d4 && t2h1u1 < t2w1rwt4 && t2h1u1 < t2w1lwt4 && t2h1u1 < t2h1uwt4 && t2h1u1 < t2h1dwt4
  && t2h1u1 < t2w1r5 && t2h1u1 < t2w1l5 && t2h1u1 < t2h1u5 && t2h1u1 < t2h1d5 && t2h1u1 < t2w1rwt5 && t2h1u1 < t2w1lwt5 && t2h1u1 < t2h1uwt5 && t2h1u1 < t2h1dwt5
  && t2h1u1 < t2w1r6 && t2h1u1 < t2w1l6 && t2h1u1 < t2h1u6 && t2h1u1 < t2h1d6 && t2h1u1 < t2w1rwt6 && t2h1u1 < t2w1lwt6 && t2h1u1 < t2h1uwt6 && t2h1u1 < t2h1dwt6
  && t2h1u1 < t2w1r7 && t2h1u1 < t2w1l7 && t2h1u1 < t2h1u7 && t2h1u1 < t2h1d7 && t2h1u1 < t2w1rwt7 && t2h1u1 < t2w1lwt7 && t2h1u1 < t2h1uwt7 && t2h1u1 < t2h1dwt7
  && t2h1u1 < t2w1r8 && t2h1u1 < t2w1l8 && t2h1u1 < t2h1u8 && t2h1u1 < t2h1d8 && t2h1u1 < t2w1rwt8 && t2h1u1 < t2w1lwt8 && t2h1u1 < t2h1uwt8 && t2h1u1 < t2h1dwt8
  && t2h1u1 < t2w1r9 && t2h1u1 < t2w1l9 && t2h1u1 < t2h1u9 && t2h1u1 < t2h1d9 && t2h1u1 < t2w1rwt9 && t2h1u1 < t2w1lwt9 && t2h1u1 < t2h1uwt9 && t2h1u1 < t2h1dwt9
  && t2h1u1 < t2w1r10 && t2h1u1 < t2w1l10 && t2h1u1 < t2h1u10 && t2h1u1 < t2h1d10 && t2h1u1 < t2w1rwt10 && t2h1u1 < t2w1lwt10 && t2h1u1 < t2h1uwt10 && t2h1u1 < t2h1dwt10
  && (louthu1 !=0 && linhu1!=0)){
 if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1u1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1u1+z))*(z0wr1+(vz*t2h1u1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1u1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1u1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1u1+z))*(z0wl1+(vz*t2h1u1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1u1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1u1+x;
  ylimitu=bhu1*sqrt(1-((vz*t2h1u1+z)+z0hu1)*((vz*t2h1u1+z)+z0hu1)/a2hu1);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu1>0 ){
  i=48;
  }else{
  i=56;
  }
  }


  if (myu1!=-1 && t2h1u1 > 0 && t2h1u1 < t1 
  && t2h1u1 < t2w1r && t2h1u1 < t2w1l && t2h1u1 < t2h1u && t2h1u1 < t2h1d && t2h1u1 < t2w1rwt && t2h1u1 < t2w1lwt && t2h1u1 < t2h1uwt && t2h1u1 < t2h1dwt
  && t2h1u1 < t2w1r1 && t2h1u1 < t2w1l1 && t2h1u1 < t2h1d1 && t2h1u1 < t2w1rwt1 && t2h1u1 < t2w1lwt1 && t2h1u1 < t2h1uwt1 && t2h1u1 < t2h1dwt1
  && t2h1u1 < t2w1r2 && t2h1u1 < t2w1l2 && t2h1u1 < t2h1u2 && t2h1u1 < t2h1d2 && t2h1u1 < t2w1rwt2 && t2h1u1 < t2w1lwt2 && t2h1u1 < t2h1uwt2 && t2h1u1 < t2h1dwt2
  && t2h1u1 < t2w1r3 && t2h1u1 < t2w1l3 && t2h1u1 < t2h1u3 && t2h1u1 < t2h1d3 && t2h1u1 < t2w1rwt3 && t2h1u1 < t2w1lwt3 && t2h1u1 < t2h1uwt3 && t2h1u1 < t2h1dwt3
  && t2h1u1 < t2w1r4 && t2h1u1 < t2w1l4 && t2h1u1 < t2h1u4 && t2h1u1 < t2h1d4 && t2h1u1 < t2w1rwt4 && t2h1u1 < t2w1lwt4 && t2h1u1 < t2h1uwt4 && t2h1u1 < t2h1dwt4
  && t2h1u1 < t2w1r5 && t2h1u1 < t2w1l5 && t2h1u1 < t2h1u5 && t2h1u1 < t2h1d5 && t2h1u1 < t2w1rwt5 && t2h1u1 < t2w1lwt5 && t2h1u1 < t2h1uwt5 && t2h1u1 < t2h1dwt5
  && t2h1u1 < t2w1r6 && t2h1u1 < t2w1l6 && t2h1u1 < t2h1u6 && t2h1u1 < t2h1d6 && t2h1u1 < t2w1rwt6 && t2h1u1 < t2w1lwt6 && t2h1u1 < t2h1uwt6 && t2h1u1 < t2h1dwt6
  && t2h1u1 < t2w1r7 && t2h1u1 < t2w1l7 && t2h1u1 < t2h1u7 && t2h1u1 < t2h1d7 && t2h1u1 < t2w1rwt7 && t2h1u1 < t2w1lwt7 && t2h1u1 < t2h1uwt7 && t2h1u1 < t2h1dwt7
  && t2h1u1 < t2w1r8 && t2h1u1 < t2w1l8 && t2h1u1 < t2h1u8 && t2h1u1 < t2h1d8 && t2h1u1 < t2w1rwt8 && t2h1u1 < t2w1lwt8 && t2h1u1 < t2h1uwt8 && t2h1u1 < t2h1dwt8
  && t2h1u1 < t2w1r9 && t2h1u1 < t2w1l9 && t2h1u1 < t2h1u9 && t2h1u1 < t2h1d9 && t2h1u1 < t2w1rwt9 && t2h1u1 < t2w1lwt9 && t2h1u1 < t2h1uwt9 && t2h1u1 < t2h1dwt9
  && t2h1u1 < t2w1r10 && t2h1u1 < t2w1l10 && t2h1u1 < t2h1u10 && t2h1u1 < t2h1d10 && t2h1u1 < t2w1rwt10 && t2h1u1 < t2w1lwt10 && t2h1u1 < t2h1uwt10 && t2h1u1 < t2h1dwt10
  && ((louthu1!=0 && linhu1==0) || (louthu1==0 && linhu1!=0))){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1u1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1u1+z))*(z0wr1+(vz*t2h1u1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1u1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1u1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1u1+z))*(z0wl1+(vz*t2h1u1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1u1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1u1+x;
  ylimitu=sqrt(pbhu1-(vz*t2h1u1+z)/pahu1);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu1>0){
  i=49;
  }else{
  i=56;
  }
  }

  if (myu1!=-1 && t2h1u1 > 0 && t2h1u1 < t1 
  && t2h1u1 < t2w1r && t2h1u1 < t2w1l && t2h1u1 < t2h1u && t2h1u1 < t2h1d && t2h1u1 < t2w1rwt && t2h1u1 < t2w1lwt && t2h1u1 < t2h1uwt && t2h1u1 < t2h1dwt
  && t2h1u1 < t2w1r1 && t2h1u1 < t2w1l1 && t2h1u1 < t2h1d1 && t2h1u1 < t2w1rwt1 && t2h1u1 < t2w1lwt1 && t2h1u1 < t2h1uwt1 && t2h1u1 < t2h1dwt1
  && t2h1u1 < t2w1r2 && t2h1u1 < t2w1l2 && t2h1u1 < t2h1u2 && t2h1u1 < t2h1d2 && t2h1u1 < t2w1rwt2 && t2h1u1 < t2w1lwt2 && t2h1u1 < t2h1uwt2 && t2h1u1 < t2h1dwt2
  && t2h1u1 < t2w1r3 && t2h1u1 < t2w1l3 && t2h1u1 < t2h1u3 && t2h1u1 < t2h1d3 && t2h1u1 < t2w1rwt3 && t2h1u1 < t2w1lwt3 && t2h1u1 < t2h1uwt3 && t2h1u1 < t2h1dwt3
  && t2h1u1 < t2w1r4 && t2h1u1 < t2w1l4 && t2h1u1 < t2h1u4 && t2h1u1 < t2h1d4 && t2h1u1 < t2w1rwt4 && t2h1u1 < t2w1lwt4 && t2h1u1 < t2h1uwt4 && t2h1u1 < t2h1dwt4
  && t2h1u1 < t2w1r5 && t2h1u1 < t2w1l5 && t2h1u1 < t2h1u5 && t2h1u1 < t2h1d5 && t2h1u1 < t2w1rwt5 && t2h1u1 < t2w1lwt5 && t2h1u1 < t2h1uwt5 && t2h1u1 < t2h1dwt5
  && t2h1u1 < t2w1r6 && t2h1u1 < t2w1l6 && t2h1u1 < t2h1u6 && t2h1u1 < t2h1d6 && t2h1u1 < t2w1rwt6 && t2h1u1 < t2w1lwt6 && t2h1u1 < t2h1uwt6 && t2h1u1 < t2h1dwt6
  && t2h1u1 < t2w1r7 && t2h1u1 < t2w1l7 && t2h1u1 < t2h1u7 && t2h1u1 < t2h1d7 && t2h1u1 < t2w1rwt7 && t2h1u1 < t2w1lwt7 && t2h1u1 < t2h1uwt7 && t2h1u1 < t2h1dwt7
  && t2h1u1 < t2w1r8 && t2h1u1 < t2w1l8 && t2h1u1 < t2h1u8 && t2h1u1 < t2h1d8 && t2h1u1 < t2w1rwt8 && t2h1u1 < t2w1lwt8 && t2h1u1 < t2h1uwt8 && t2h1u1 < t2h1dwt8
  && t2h1u1 < t2w1r9 && t2h1u1 < t2w1l9 && t2h1u1 < t2h1u9 && t2h1u1 < t2h1d9 && t2h1u1 < t2w1rwt9 && t2h1u1 < t2w1lwt9 && t2h1u1 < t2h1uwt9 && t2h1u1 < t2h1dwt9
  && t2h1u1 < t2w1r10 && t2h1u1 < t2w1l10 && t2h1u1 < t2h1u10 && t2h1u1 < t2h1d10 && t2h1u1 < t2w1rwt10 && t2h1u1 < t2w1lwt10 && t2h1u1 < t2h1uwt10 && t2h1u1 < t2h1dwt10
  && (louthu1 == 0 && linhu1 == 0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1u1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1u1+z))*(z0wr1+(vz*t2h1u1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1u1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1u1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1u1+z))*(z0wl1+(vz*t2h1u1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1u1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1u1+x;
  ylimitu=(h2u1-h1u1)*(vz*t2h1u1+z)/l+h1u1;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu1>0 ){
  i=50;
  }else{
  i=56;
  }
  }

  if (myd1!=-1 && t2h1d1 > 0 && t2h1d1 < t1 
  && t2h1d1 < t2w1r && t2h1d1 < t2w1l && t2h1d1 < t2h1u && t2h1d1 < t2h1d && t2h1d1 < t2w1rwt && t2h1d1 < t2w1lwt && t2h1d1 < t2h1uwt && t2h1d1 < t2h1dwt
  && t2h1d1 < t2w1r1 && t2h1d1 < t2w1l1 && t2h1d1 < t2h1u1 && t2h1d1 < t2w1rwt1 && t2h1d1 < t2w1lwt1 && t2h1d1 < t2h1uwt1 && t2h1d1 < t2h1dwt1
  && t2h1d1 < t2w1r2 && t2h1d1 < t2w1l2 && t2h1d1 < t2h1u2 && t2h1d1 < t2h1d2 && t2h1d1 < t2w1rwt2 && t2h1d1 < t2w1lwt2 && t2h1d1 < t2h1uwt2 && t2h1d1 < t2h1dwt2
  && t2h1d1 < t2w1r3 && t2h1d1 < t2w1l3 && t2h1d1 < t2h1u3 && t2h1d1 < t2h1d3 && t2h1d1 < t2w1rwt3 && t2h1d1 < t2w1lwt3 && t2h1d1 < t2h1uwt3 && t2h1d1 < t2h1dwt3
  && t2h1d1 < t2w1r4 && t2h1d1 < t2w1l4 && t2h1d1 < t2h1u4 && t2h1d1 < t2h1d4 && t2h1d1 < t2w1rwt4 && t2h1d1 < t2w1lwt4 && t2h1d1 < t2h1uwt4 && t2h1d1 < t2h1dwt4
  && t2h1d1 < t2w1r5 && t2h1d1 < t2w1l5 && t2h1d1 < t2h1u5 && t2h1d1 < t2h1d5 && t2h1d1 < t2w1rwt5 && t2h1d1 < t2w1lwt5 && t2h1d1 < t2h1uwt5 && t2h1d1 < t2h1dwt5
  && t2h1d1 < t2w1r6 && t2h1d1 < t2w1l6 && t2h1d1 < t2h1u6 && t2h1d1 < t2h1d6 && t2h1d1 < t2w1rwt6 && t2h1d1 < t2w1lwt6 && t2h1d1 < t2h1uwt6 && t2h1d1 < t2h1dwt6
  && t2h1d1 < t2w1r7 && t2h1d1 < t2w1l7 && t2h1d1 < t2h1u7 && t2h1d1 < t2h1d7 && t2h1d1 < t2w1rwt7 && t2h1d1 < t2w1lwt7 && t2h1d1 < t2h1uwt7 && t2h1d1 < t2h1dwt7
  && t2h1d1 < t2w1r8 && t2h1d1 < t2w1l8 && t2h1d1 < t2h1u8 && t2h1d1 < t2h1d8 && t2h1d1 < t2w1rwt8 && t2h1d1 < t2w1lwt8 && t2h1d1 < t2h1uwt8 && t2h1d1 < t2h1dwt8
  && t2h1d1 < t2w1r9 && t2h1d1 < t2w1l9 && t2h1d1 < t2h1u9 && t2h1d1 < t2h1d9 && t2h1d1 < t2w1rwt9 && t2h1d1 < t2w1lwt9 && t2h1d1 < t2h1uwt9 && t2h1d1 < t2h1dwt9
  && t2h1d1 < t2w1r10 && t2h1d1 < t2w1l10 && t2h1d1 < t2h1u10 && t2h1d1 < t2h1d10 && t2h1d1 < t2w1rwt10 && t2h1d1 < t2w1lwt10 && t2h1d1 < t2h1uwt10 && t2h1d1 < t2h1dwt10
  && (louthd1 !=0 && linhd1!=0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1d1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1d1+z))*(z0wr1+(vz*t2h1d1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1d1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1d1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1d1+z))*(z0wl1+(vz*t2h1d1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1d1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1d1+x;
  ylimitd=-bhd1*sqrt(1-((vz*t2h1d1+z)+z0hd1)*((vz*t2h1d1+z)+z0hd1)/a2hd1);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd1>0){
  i=51;
  }else{
  i=57;
  }
  }

  if (myd1!=-1 && t2h1d1 > 0 && t2h1d1 < t1 
  && t2h1d1 < t2w1r && t2h1d1 < t2w1l && t2h1d1 < t2h1u && t2h1d1 < t2h1d && t2h1d1 < t2w1rwt && t2h1d1 < t2w1lwt && t2h1d1 < t2h1uwt && t2h1d1 < t2h1dwt
  && t2h1d1 < t2w1r1 && t2h1d1 < t2w1l1 && t2h1d1 < t2h1u1 && t2h1d1 < t2w1rwt1 && t2h1d1 < t2w1lwt1 && t2h1d1 < t2h1uwt1 && t2h1d1 < t2h1dwt1
  && t2h1d1 < t2w1r2 && t2h1d1 < t2w1l2 && t2h1d1 < t2h1u2 && t2h1d1 < t2h1d2 && t2h1d1 < t2w1rwt2 && t2h1d1 < t2w1lwt2 && t2h1d1 < t2h1uwt2 && t2h1d1 < t2h1dwt2
  && t2h1d1 < t2w1r3 && t2h1d1 < t2w1l3 && t2h1d1 < t2h1u3 && t2h1d1 < t2h1d3 && t2h1d1 < t2w1rwt3 && t2h1d1 < t2w1lwt3 && t2h1d1 < t2h1uwt3 && t2h1d1 < t2h1dwt3
  && t2h1d1 < t2w1r4 && t2h1d1 < t2w1l4 && t2h1d1 < t2h1u4 && t2h1d1 < t2h1d4 && t2h1d1 < t2w1rwt4 && t2h1d1 < t2w1lwt4 && t2h1d1 < t2h1uwt4 && t2h1d1 < t2h1dwt4
  && t2h1d1 < t2w1r5 && t2h1d1 < t2w1l5 && t2h1d1 < t2h1u5 && t2h1d1 < t2h1d5 && t2h1d1 < t2w1rwt5 && t2h1d1 < t2w1lwt5 && t2h1d1 < t2h1uwt5 && t2h1d1 < t2h1dwt5
  && t2h1d1 < t2w1r6 && t2h1d1 < t2w1l6 && t2h1d1 < t2h1u6 && t2h1d1 < t2h1d6 && t2h1d1 < t2w1rwt6 && t2h1d1 < t2w1lwt6 && t2h1d1 < t2h1uwt6 && t2h1d1 < t2h1dwt6
  && t2h1d1 < t2w1r7 && t2h1d1 < t2w1l7 && t2h1d1 < t2h1u7 && t2h1d1 < t2h1d7 && t2h1d1 < t2w1rwt7 && t2h1d1 < t2w1lwt7 && t2h1d1 < t2h1uwt7 && t2h1d1 < t2h1dwt7
  && t2h1d1 < t2w1r8 && t2h1d1 < t2w1l8 && t2h1d1 < t2h1u8 && t2h1d1 < t2h1d8 && t2h1d1 < t2w1rwt8 && t2h1d1 < t2w1lwt8 && t2h1d1 < t2h1uwt8 && t2h1d1 < t2h1dwt8
  && t2h1d1 < t2w1r9 && t2h1d1 < t2w1l9 && t2h1d1 < t2h1u9 && t2h1d1 < t2h1d9 && t2h1d1 < t2w1rwt9 && t2h1d1 < t2w1lwt9 && t2h1d1 < t2h1uwt9 && t2h1d1 < t2h1dwt9
  && t2h1d1 < t2w1r10 && t2h1d1 < t2w1l10 && t2h1d1 < t2h1u10 && t2h1d1 < t2h1d10 && t2h1d1 < t2w1rwt10 && t2h1d1 < t2w1lwt10 && t2h1d1 < t2h1uwt10 && t2h1d1 < t2h1dwt10
  && ((louthd1 !=0 && linhd1==0) || (louthd1 ==0 && linhd1!=0))){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1d1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1d1+z))*(z0wr1+(vz*t2h1d1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1d1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1d1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1d1+z))*(z0wl1+(vz*t2h1d1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1d1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1d1+x;
  ylimitd=-sqrt(pbhd1-(vz*t2h1d1+z)/pahd1);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd1>0 ){
  i=52;
  }else{
  i=57;
  }
  }

  if (myd1!=-1 && t2h1d1 > 0 && t2h1d1 < t1 
  && t2h1d1 < t2w1r && t2h1d1 < t2w1l && t2h1d1 < t2h1u && t2h1d1 < t2h1d && t2h1d1 < t2w1rwt && t2h1d1 < t2w1lwt && t2h1d1 < t2h1uwt && t2h1d1 < t2h1dwt
  && t2h1d1 < t2w1r1 && t2h1d1 < t2w1l1 && t2h1d1 < t2h1u1 && t2h1d1 < t2w1rwt1 && t2h1d1 < t2w1lwt1 && t2h1d1 < t2h1uwt1 && t2h1d1 < t2h1dwt1
  && t2h1d1 < t2w1r2 && t2h1d1 < t2w1l2 && t2h1d1 < t2h1u2 && t2h1d1 < t2h1d2 && t2h1d1 < t2w1rwt2 && t2h1d1 < t2w1lwt2 && t2h1d1 < t2h1uwt2 && t2h1d1 < t2h1dwt2
  && t2h1d1 < t2w1r3 && t2h1d1 < t2w1l3 && t2h1d1 < t2h1u3 && t2h1d1 < t2h1d3 && t2h1d1 < t2w1rwt3 && t2h1d1 < t2w1lwt3 && t2h1d1 < t2h1uwt3 && t2h1d1 < t2h1dwt3
  && t2h1d1 < t2w1r4 && t2h1d1 < t2w1l4 && t2h1d1 < t2h1u4 && t2h1d1 < t2h1d4 && t2h1d1 < t2w1rwt4 && t2h1d1 < t2w1lwt4 && t2h1d1 < t2h1uwt4 && t2h1d1 < t2h1dwt4
  && t2h1d1 < t2w1r5 && t2h1d1 < t2w1l5 && t2h1d1 < t2h1u5 && t2h1d1 < t2h1d5 && t2h1d1 < t2w1rwt5 && t2h1d1 < t2w1lwt5 && t2h1d1 < t2h1uwt5 && t2h1d1 < t2h1dwt5
  && t2h1d1 < t2w1r6 && t2h1d1 < t2w1l6 && t2h1d1 < t2h1u6 && t2h1d1 < t2h1d6 && t2h1d1 < t2w1rwt6 && t2h1d1 < t2w1lwt6 && t2h1d1 < t2h1uwt6 && t2h1d1 < t2h1dwt6
  && t2h1d1 < t2w1r7 && t2h1d1 < t2w1l7 && t2h1d1 < t2h1u7 && t2h1d1 < t2h1d7 && t2h1d1 < t2w1rwt7 && t2h1d1 < t2w1lwt7 && t2h1d1 < t2h1uwt7 && t2h1d1 < t2h1dwt7
  && t2h1d1 < t2w1r8 && t2h1d1 < t2w1l8 && t2h1d1 < t2h1u8 && t2h1d1 < t2h1d8 && t2h1d1 < t2w1rwt8 && t2h1d1 < t2w1lwt8 && t2h1d1 < t2h1uwt8 && t2h1d1 < t2h1dwt8
  && t2h1d1 < t2w1r9 && t2h1d1 < t2w1l9 && t2h1d1 < t2h1u9 && t2h1d1 < t2h1d9 && t2h1d1 < t2w1rwt9 && t2h1d1 < t2w1lwt9 && t2h1d1 < t2h1uwt9 && t2h1d1 < t2h1dwt9
  && t2h1d1 < t2w1r10 && t2h1d1 < t2w1l10 && t2h1d1 < t2h1u10 && t2h1d1 < t2h1d10 && t2h1d1 < t2w1rwt10 && t2h1d1 < t2w1lwt10 && t2h1d1 < t2h1uwt10 && t2h1d1 < t2h1dwt10
  && (louthd1 == 0 && linhd1 == 0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1d1+z)-w1r1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwr1*sqrt(1-((z0wr1+(vz*t2h1d1+z))*(z0wr1+(vz*t2h1d1+z)))/a2wr1);
    }else{
    xlimitr=-sqrt(((vz*t2h1d1+z)-pbwr1)/-pawr1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1d1+z)+w1l1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwl1*sqrt(1-((z0wl1+(vz*t2h1d1+z))*(z0wl1+(vz*t2h1d1+z)))/a2wl1);
      }else{
      xlimitl=sqrt(((vz*t2h1d1+z)-pbwl1)/-pawl1);
      }
   }
  xtest=vx*t2h1d1+x;
  ylimitd=(-h2d1+h1d1)*(vz*t2h1d1+z)/l-h1d1;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd1>0 ){
  i=53;
  }else{
  i=57;
  }
  }

if (mxr1==-1 && t2w1r1 > 0 && t2w1r1 < t1 
     && t2w1r1 < t2w1r && t2w1r1 < t2w1l && t2w1r1 < t2h1u && t2w1r1 < t2h1d && t2w1r1 < t2w1rwt && t2w1r1 < t2w1lwt && t2w1r1 < t2h1uwt && t2w1r1 < t2h1dwt
     && t2w1r1 < t2w1l1 && t2w1r1 < t2h1u1 && t2w1r1 < t2h1d1 && t2w1r1 < t2w1rwt1 && t2w1r1 < t2w1lwt1 && t2w1r1 < t2h1uwt1 && t2w1r1 < t2h1dwt1
     && t2w1r1 < t2w1r2 && t2w1r1 < t2w1l2 && t2w1r1 < t2h1u2 && t2w1r1 < t2h1d2 && t2w1r1 < t2w1rwt2 && t2w1r1 < t2w1lwt2 && t2w1r1 < t2h1uwt2 && t2w1r1 < t2h1dwt2 
     && t2w1r1 < t2w1r3 && t2w1r1 < t2w1l3 && t2w1r1 < t2h1u3 && t2w1r1 < t2h1d3 && t2w1r1 < t2w1rwt3 && t2w1r1 < t2w1lwt3 && t2w1r1 < t2h1uwt3 && t2w1r1 < t2h1dwt3
     && t2w1r1 < t2w1r4 && t2w1r1 < t2w1l4 && t2w1r1 < t2h1u4 && t2w1r1 < t2h1d4 && t2w1r1 < t2w1rwt4 && t2w1r1 < t2w1lwt4 && t2w1r1 < t2h1uwt4 && t2w1r1 < t2h1dwt4
     && t2w1r1 < t2w1r5 && t2w1r1 < t2w1l5 && t2w1r1 < t2h1u5 && t2w1r1 < t2h1d5 && t2w1r1 < t2w1rwt5 && t2w1r1 < t2w1lwt5 && t2w1r1 < t2h1uwt5 && t2w1r1 < t2h1dwt5
     && t2w1r1 < t2w1r6 && t2w1r1 < t2w1l6 && t2w1r1 < t2h1u6 && t2w1r1 < t2h1d6 && t2w1r1 < t2w1rwt6 && t2w1r1 < t2w1lwt6 && t2w1r1 < t2h1uwt6 && t2w1r1 < t2h1dwt6
     && t2w1r1 < t2w1r7 && t2w1r1 < t2w1l7 && t2w1r1 < t2h1u7 && t2w1r1 < t2h1d7 && t2w1r1 < t2w1rwt7 && t2w1r1 < t2w1lwt7 && t2w1r1 < t2h1uwt7 && t2w1r1 < t2h1dwt7
     && t2w1r1 < t2w1r8 && t2w1r1 < t2w1l8 && t2w1r1 < t2h1u8 && t2w1r1 < t2h1d8 && t2w1r1 < t2w1rwt8 && t2w1r1 < t2w1lwt8 && t2w1r1 < t2h1uwt8 && t2w1r1 < t2h1dwt8
     && t2w1r1 < t2w1r9 && t2w1r1 < t2w1l9 && t2w1r1 < t2h1u9 && t2w1r1 < t2h1d9 && t2w1r1 < t2w1rwt9 && t2w1r1 < t2w1lwt9 && t2w1r1 < t2h1uwt9 && t2w1r1 < t2h1dwt9
     && t2w1r1 < t2w1r10 && t2w1r1 < t2w1l10 && t2w1r1 < t2h1u10 && t2w1r1 < t2h1d10 && t2w1r1 < t2w1rwt10 && t2w1r1 < t2w1lwt10 && t2w1r1 < t2h1uwt10 && t2w1r1 < t2h1dwt10
     && ((linwr1!=0) && (loutwr1!=0) )) {
  i=58;
  }

  if (mxr1==-1 && t2w1r1 > 0 && t2w1r1 < t1 
     && t2w1r1 < t2w1r && t2w1r1 < t2w1l && t2w1r1 < t2h1u && t2w1r1 < t2h1d && t2w1r1 < t2w1rwt && t2w1r1 < t2w1lwt && t2w1r1 < t2h1uwt && t2w1r1 < t2h1dwt
     && t2w1r1 < t2w1l1 && t2w1r1 < t2h1u1 && t2w1r1 < t2h1d1 && t2w1r1 < t2w1rwt1 && t2w1r1 < t2w1lwt1 && t2w1r1 < t2h1uwt1 && t2w1r1 < t2h1dwt1
     && t2w1r1 < t2w1r2 && t2w1r1 < t2w1l2 && t2w1r1 < t2h1u2 && t2w1r1 < t2h1d2 && t2w1r1 < t2w1rwt2 && t2w1r1 < t2w1lwt2 && t2w1r1 < t2h1uwt2 && t2w1r1 < t2h1dwt2 
     && t2w1r1 < t2w1r3 && t2w1r1 < t2w1l3 && t2w1r1 < t2h1u3 && t2w1r1 < t2h1d3 && t2w1r1 < t2w1rwt3 && t2w1r1 < t2w1lwt3 && t2w1r1 < t2h1uwt3 && t2w1r1 < t2h1dwt3
     && t2w1r1 < t2w1r4 && t2w1r1 < t2w1l4 && t2w1r1 < t2h1u4 && t2w1r1 < t2h1d4 && t2w1r1 < t2w1rwt4 && t2w1r1 < t2w1lwt4 && t2w1r1 < t2h1uwt4 && t2w1r1 < t2h1dwt4
     && t2w1r1 < t2w1r5 && t2w1r1 < t2w1l5 && t2w1r1 < t2h1u5 && t2w1r1 < t2h1d5 && t2w1r1 < t2w1rwt5 && t2w1r1 < t2w1lwt5 && t2w1r1 < t2h1uwt5 && t2w1r1 < t2h1dwt5
     && t2w1r1 < t2w1r6 && t2w1r1 < t2w1l6 && t2w1r1 < t2h1u6 && t2w1r1 < t2h1d6 && t2w1r1 < t2w1rwt6 && t2w1r1 < t2w1lwt6 && t2w1r1 < t2h1uwt6 && t2w1r1 < t2h1dwt6
     && t2w1r1 < t2w1r7 && t2w1r1 < t2w1l7 && t2w1r1 < t2h1u7 && t2w1r1 < t2h1d7 && t2w1r1 < t2w1rwt7 && t2w1r1 < t2w1lwt7 && t2w1r1 < t2h1uwt7 && t2w1r1 < t2h1dwt7
     && t2w1r1 < t2w1r8 && t2w1r1 < t2w1l8 && t2w1r1 < t2h1u8 && t2w1r1 < t2h1d8 && t2w1r1 < t2w1rwt8 && t2w1r1 < t2w1lwt8 && t2w1r1 < t2h1uwt8 && t2w1r1 < t2h1dwt8
     && t2w1r1 < t2w1r9 && t2w1r1 < t2w1l9 && t2w1r1 < t2h1u9 && t2w1r1 < t2h1d9 && t2w1r1 < t2w1rwt9 && t2w1r1 < t2w1lwt9 && t2w1r1 < t2h1uwt9 && t2w1r1 < t2h1dwt9
     && t2w1r1 < t2w1r10 && t2w1r1 < t2w1l10 && t2w1r1 < t2h1u10 && t2w1r1 < t2h1d10 && t2w1r1 < t2w1rwt10 && t2w1r1 < t2w1lwt10 && t2w1r1 < t2h1uwt10 && t2w1r1 < t2h1dwt10 
     && ((loutwr1!=0 && linwr1==0) || (loutwr1==0 && linwr1!=0))){
  i=58;
  }

  if (mxr1==-1 && t2w1r1 > 0 && t2w1r1 < t1 
     && t2w1r1 < t2w1r && t2w1r1 < t2w1l && t2w1r1 < t2h1u && t2w1r1 < t2h1d && t2w1r1 < t2w1rwt && t2w1r1 < t2w1lwt && t2w1r1 < t2h1uwt && t2w1r1 < t2h1dwt
     && t2w1r1 < t2w1l1 && t2w1r1 < t2h1u1 && t2w1r1 < t2h1d1 && t2w1r1 < t2w1rwt1 && t2w1r1 < t2w1lwt1 && t2w1r1 < t2h1uwt1 && t2w1r1 < t2h1dwt1
     && t2w1r1 < t2w1r2 && t2w1r1 < t2w1l2 && t2w1r1 < t2h1u2 && t2w1r1 < t2h1d2 && t2w1r1 < t2w1rwt2 && t2w1r1 < t2w1lwt2 && t2w1r1 < t2h1uwt2 && t2w1r1 < t2h1dwt2 
     && t2w1r1 < t2w1r3 && t2w1r1 < t2w1l3 && t2w1r1 < t2h1u3 && t2w1r1 < t2h1d3 && t2w1r1 < t2w1rwt3 && t2w1r1 < t2w1lwt3 && t2w1r1 < t2h1uwt3 && t2w1r1 < t2h1dwt3
     && t2w1r1 < t2w1r4 && t2w1r1 < t2w1l4 && t2w1r1 < t2h1u4 && t2w1r1 < t2h1d4 && t2w1r1 < t2w1rwt4 && t2w1r1 < t2w1lwt4 && t2w1r1 < t2h1uwt4 && t2w1r1 < t2h1dwt4
     && t2w1r1 < t2w1r5 && t2w1r1 < t2w1l5 && t2w1r1 < t2h1u5 && t2w1r1 < t2h1d5 && t2w1r1 < t2w1rwt5 && t2w1r1 < t2w1lwt5 && t2w1r1 < t2h1uwt5 && t2w1r1 < t2h1dwt5
     && t2w1r1 < t2w1r6 && t2w1r1 < t2w1l6 && t2w1r1 < t2h1u6 && t2w1r1 < t2h1d6 && t2w1r1 < t2w1rwt6 && t2w1r1 < t2w1lwt6 && t2w1r1 < t2h1uwt6 && t2w1r1 < t2h1dwt6
     && t2w1r1 < t2w1r7 && t2w1r1 < t2w1l7 && t2w1r1 < t2h1u7 && t2w1r1 < t2h1d7 && t2w1r1 < t2w1rwt7 && t2w1r1 < t2w1lwt7 && t2w1r1 < t2h1uwt7 && t2w1r1 < t2h1dwt7
     && t2w1r1 < t2w1r8 && t2w1r1 < t2w1l8 && t2w1r1 < t2h1u8 && t2w1r1 < t2h1d8 && t2w1r1 < t2w1rwt8 && t2w1r1 < t2w1lwt8 && t2w1r1 < t2h1uwt8 && t2w1r1 < t2h1dwt8
     && t2w1r1 < t2w1r9 && t2w1r1 < t2w1l9 && t2w1r1 < t2h1u9 && t2w1r1 < t2h1d9 && t2w1r1 < t2w1rwt9 && t2w1r1 < t2w1lwt9 && t2w1r1 < t2h1uwt9 && t2w1r1 < t2h1dwt9
     && t2w1r1 < t2w1r10 && t2w1r1 < t2w1l10 && t2w1r1 < t2h1u10 && t2w1r1 < t2h1d10 && t2w1r1 < t2w1rwt10 && t2w1r1 < t2w1lwt10 && t2w1r1 < t2h1uwt10 && t2w1r1 < t2h1dwt10
     && (loutwr1==0 && linwr1==0)){
  i=58;
  }

  if (mxl1==-1 && t2w1l1 > 0 && t2w1l1 < t1 
      && t2w1l1 < t2w1r && t2w1l1 < t2w1l && t2w1l1 < t2h1u && t2w1l1 < t2h1d && t2w1l1 < t2w1rwt && t2w1l1 < t2w1lwt && t2w1l1 < t2h1uwt && t2w1l1 < t2h1dwt
      && t2w1l1 < t2w1r1 && t2w1l1 < t2h1u1 && t2w1l1 < t2h1d1 && t2w1l1 < t2w1rwt1 && t2w1l1 < t2w1lwt1 && t2w1l1 < t2h1uwt1 && t2w1l1 < t2h1dwt1
      && t2w1l1 < t2w1r2 && t2w1l1 < t2w1l2 && t2w1l1 < t2h1u2 && t2w1l1 < t2h1d2 && t2w1l1 < t2w1rwt2 && t2w1l1 < t2w1lwt2 && t2w1l1 < t2h1uwt2 && t2w1l1 < t2h1dwt2
      && t2w1l1 < t2w1r3 && t2w1l1 < t2w1l3 && t2w1l1 < t2h1u3 && t2w1l1 < t2h1d3 && t2w1l1 < t2w1rwt3 && t2w1l1 < t2w1lwt3 && t2w1l1 < t2h1uwt3 && t2w1l1 < t2h1dwt3
      && t2w1l1 < t2w1r4 && t2w1l1 < t2w1l4 && t2w1l1 < t2h1u4 && t2w1l1 < t2h1d4 && t2w1l1 < t2w1rwt4 && t2w1l1 < t2w1lwt4 && t2w1l1 < t2h1uwt4 && t2w1l1 < t2h1dwt4
      && t2w1l1 < t2w1r5 && t2w1l1 < t2w1l5 && t2w1l1 < t2h1u5 && t2w1l1 < t2h1d5 && t2w1l1 < t2w1rwt5 && t2w1l1 < t2w1lwt5 && t2w1l1 < t2h1uwt5 && t2w1l1 < t2h1dwt5
      && t2w1l1 < t2w1r6 && t2w1l1 < t2w1l6 && t2w1l1 < t2h1u6 && t2w1l1 < t2h1d6 && t2w1l1 < t2w1rwt6 && t2w1l1 < t2w1lwt6 && t2w1l1 < t2h1uwt6 && t2w1l1 < t2h1dwt6
      && t2w1l1 < t2w1r7 && t2w1l1 < t2w1l7 && t2w1l1 < t2h1u7 && t2w1l1 < t2h1d7 && t2w1l1 < t2w1rwt7 && t2w1l1 < t2w1lwt7 && t2w1l1 < t2h1uwt7 && t2w1l1 < t2h1dwt7
      && t2w1l1 < t2w1r8 && t2w1l1 < t2w1l8 && t2w1l1 < t2h1u8 && t2w1l1 < t2h1d8 && t2w1l1 < t2w1rwt8 && t2w1l1 < t2w1lwt8 && t2w1l1 < t2h1uwt8 && t2w1l1 < t2h1dwt8
      && t2w1l1 < t2w1r9 && t2w1l1 < t2w1l9 && t2w1l1 < t2h1u9 && t2w1l1 < t2h1d9 && t2w1l1 < t2w1rwt9 && t2w1l1 < t2w1lwt9 && t2w1l1 < t2h1uwt9 && t2w1l1 < t2h1dwt9
      && t2w1l1 < t2w1r10 && t2w1l1 < t2w1l10 && t2w1l1 < t2h1u10 && t2w1l1 < t2h1d10 && t2w1l1 < t2w1rwt10 && t2w1l1 < t2w1lwt10 && t2w1l1 < t2h1uwt10 && t2w1l1 < t2h1dwt10
      && ((linwl1!=0) && (loutwl1!=0) )){
  i=59;
  }

  if (mxl1==-1 && t2w1l1 > 0 && t2w1l1 < t1 
      && t2w1l1 < t2w1r && t2w1l1 < t2w1l && t2w1l1 < t2h1u && t2w1l1 < t2h1d && t2w1l1 < t2w1rwt && t2w1l1 < t2w1lwt && t2w1l1 < t2h1uwt && t2w1l1 < t2h1dwt
      && t2w1l1 < t2w1r1 && t2w1l1 < t2h1u1 && t2w1l1 < t2h1d1 && t2w1l1 < t2w1rwt1 && t2w1l1 < t2w1lwt1 && t2w1l1 < t2h1uwt1 && t2w1l1 < t2h1dwt1
      && t2w1l1 < t2w1r2 && t2w1l1 < t2w1l2 && t2w1l1 < t2h1u2 && t2w1l1 < t2h1d2 && t2w1l1 < t2w1rwt2 && t2w1l1 < t2w1lwt2 && t2w1l1 < t2h1uwt2 && t2w1l1 < t2h1dwt2
      && t2w1l1 < t2w1r3 && t2w1l1 < t2w1l3 && t2w1l1 < t2h1u3 && t2w1l1 < t2h1d3 && t2w1l1 < t2w1rwt3 && t2w1l1 < t2w1lwt3 && t2w1l1 < t2h1uwt3 && t2w1l1 < t2h1dwt3
      && t2w1l1 < t2w1r4 && t2w1l1 < t2w1l4 && t2w1l1 < t2h1u4 && t2w1l1 < t2h1d4 && t2w1l1 < t2w1rwt4 && t2w1l1 < t2w1lwt4 && t2w1l1 < t2h1uwt4 && t2w1l1 < t2h1dwt4
      && t2w1l1 < t2w1r5 && t2w1l1 < t2w1l5 && t2w1l1 < t2h1u5 && t2w1l1 < t2h1d5 && t2w1l1 < t2w1rwt5 && t2w1l1 < t2w1lwt5 && t2w1l1 < t2h1uwt5 && t2w1l1 < t2h1dwt5
      && t2w1l1 < t2w1r6 && t2w1l1 < t2w1l6 && t2w1l1 < t2h1u6 && t2w1l1 < t2h1d6 && t2w1l1 < t2w1rwt6 && t2w1l1 < t2w1lwt6 && t2w1l1 < t2h1uwt6 && t2w1l1 < t2h1dwt6
      && t2w1l1 < t2w1r7 && t2w1l1 < t2w1l7 && t2w1l1 < t2h1u7 && t2w1l1 < t2h1d7 && t2w1l1 < t2w1rwt7 && t2w1l1 < t2w1lwt7 && t2w1l1 < t2h1uwt7 && t2w1l1 < t2h1dwt7
      && t2w1l1 < t2w1r8 && t2w1l1 < t2w1l8 && t2w1l1 < t2h1u8 && t2w1l1 < t2h1d8 && t2w1l1 < t2w1rwt8 && t2w1l1 < t2w1lwt8 && t2w1l1 < t2h1uwt8 && t2w1l1 < t2h1dwt8
      && t2w1l1 < t2w1r9 && t2w1l1 < t2w1l9 && t2w1l1 < t2h1u9 && t2w1l1 < t2h1d9 && t2w1l1 < t2w1rwt9 && t2w1l1 < t2w1lwt9 && t2w1l1 < t2h1uwt9 && t2w1l1 < t2h1dwt9
      && t2w1l1 < t2w1r10 && t2w1l1 < t2w1l10 && t2w1l1 < t2h1u10 && t2w1l1 < t2h1d10 && t2w1l1 < t2w1rwt10 && t2w1l1 < t2w1lwt10 && t2w1l1 < t2h1uwt10 && t2w1l1 < t2h1dwt10
      && ((loutwl1!=0 && linwl1==0) || (loutwl1==0 && linwl1!=0))){
  i=59;
  }

  if (mxl1==-1 && t2w1l1 > 0 && t2w1l1 < t1 
      && t2w1l1 < t2w1r && t2w1l1 < t2w1l && t2w1l1 < t2h1u && t2w1l1 < t2h1d && t2w1l1 < t2w1rwt && t2w1l1 < t2w1lwt && t2w1l1 < t2h1uwt && t2w1l1 < t2h1dwt
      && t2w1l1 < t2w1r1 && t2w1l1 < t2h1u1 && t2w1l1 < t2h1d1 && t2w1l1 < t2w1rwt1 && t2w1l1 < t2w1lwt1 && t2w1l1 < t2h1uwt1 && t2w1l1 < t2h1dwt1
      && t2w1l1 < t2w1r2 && t2w1l1 < t2w1l2 && t2w1l1 < t2h1u2 && t2w1l1 < t2h1d2 && t2w1l1 < t2w1rwt2 && t2w1l1 < t2w1lwt2 && t2w1l1 < t2h1uwt2 && t2w1l1 < t2h1dwt2
      && t2w1l1 < t2w1r3 && t2w1l1 < t2w1l3 && t2w1l1 < t2h1u3 && t2w1l1 < t2h1d3 && t2w1l1 < t2w1rwt3 && t2w1l1 < t2w1lwt3 && t2w1l1 < t2h1uwt3 && t2w1l1 < t2h1dwt3
      && t2w1l1 < t2w1r4 && t2w1l1 < t2w1l4 && t2w1l1 < t2h1u4 && t2w1l1 < t2h1d4 && t2w1l1 < t2w1rwt4 && t2w1l1 < t2w1lwt4 && t2w1l1 < t2h1uwt4 && t2w1l1 < t2h1dwt4
      && t2w1l1 < t2w1r5 && t2w1l1 < t2w1l5 && t2w1l1 < t2h1u5 && t2w1l1 < t2h1d5 && t2w1l1 < t2w1rwt5 && t2w1l1 < t2w1lwt5 && t2w1l1 < t2h1uwt5 && t2w1l1 < t2h1dwt5
      && t2w1l1 < t2w1r6 && t2w1l1 < t2w1l6 && t2w1l1 < t2h1u6 && t2w1l1 < t2h1d6 && t2w1l1 < t2w1rwt6 && t2w1l1 < t2w1lwt6 && t2w1l1 < t2h1uwt6 && t2w1l1 < t2h1dwt6
      && t2w1l1 < t2w1r7 && t2w1l1 < t2w1l7 && t2w1l1 < t2h1u7 && t2w1l1 < t2h1d7 && t2w1l1 < t2w1rwt7 && t2w1l1 < t2w1lwt7 && t2w1l1 < t2h1uwt7 && t2w1l1 < t2h1dwt7
      && t2w1l1 < t2w1r8 && t2w1l1 < t2w1l8 && t2w1l1 < t2h1u8 && t2w1l1 < t2h1d8 && t2w1l1 < t2w1rwt8 && t2w1l1 < t2w1lwt8 && t2w1l1 < t2h1uwt8 && t2w1l1 < t2h1dwt8
      && t2w1l1 < t2w1r9 && t2w1l1 < t2w1l9 && t2w1l1 < t2h1u9 && t2w1l1 < t2h1d9 && t2w1l1 < t2w1rwt9 && t2w1l1 < t2w1lwt9 && t2w1l1 < t2h1uwt9 && t2w1l1 < t2h1dwt9
      && t2w1l1 < t2w1r10 && t2w1l1 < t2w1l10 && t2w1l1 < t2h1u10 && t2w1l1 < t2h1d10 && t2w1l1 < t2w1rwt10 && t2w1l1 < t2w1lwt10 && t2w1l1 < t2h1uwt10 && t2w1l1 < t2h1dwt10
      && (loutwl1==0 && linwl1==0)){
  i=59;
  }

  if (myu1==-1 && t2h1u1 > 0 && t2h1u1 < t1 
  && t2h1u1 < t2w1r && t2h1u1 < t2w1l && t2h1u1 < t2h1u && t2h1u1 < t2h1d && t2h1u1 < t2w1rwt && t2h1u1 < t2w1lwt && t2h1u1 < t2h1uwt && t2h1u1 < t2h1dwt
  && t2h1u1 < t2w1r1 && t2h1u1 < t2w1l1 && t2h1u1 < t2h1d1 && t2h1u1 < t2w1rwt1 && t2h1u1 < t2w1lwt1 && t2h1u1 < t2h1uwt1 && t2h1u1 < t2h1dwt1
  && t2h1u1 < t2w1r2 && t2h1u1 < t2w1l2 && t2h1u1 < t2h1u2 && t2h1u1 < t2h1d2 && t2h1u1 < t2w1rwt2 && t2h1u1 < t2w1lwt2 && t2h1u1 < t2h1uwt2 && t2h1u1 < t2h1dwt2
  && t2h1u1 < t2w1r3 && t2h1u1 < t2w1l3 && t2h1u1 < t2h1u3 && t2h1u1 < t2h1d3 && t2h1u1 < t2w1rwt3 && t2h1u1 < t2w1lwt3 && t2h1u1 < t2h1uwt3 && t2h1u1 < t2h1dwt3
  && t2h1u1 < t2w1r4 && t2h1u1 < t2w1l4 && t2h1u1 < t2h1u4 && t2h1u1 < t2h1d4 && t2h1u1 < t2w1rwt4 && t2h1u1 < t2w1lwt4 && t2h1u1 < t2h1uwt4 && t2h1u1 < t2h1dwt4
  && t2h1u1 < t2w1r5 && t2h1u1 < t2w1l5 && t2h1u1 < t2h1u5 && t2h1u1 < t2h1d5 && t2h1u1 < t2w1rwt5 && t2h1u1 < t2w1lwt5 && t2h1u1 < t2h1uwt5 && t2h1u1 < t2h1dwt5
  && t2h1u1 < t2w1r6 && t2h1u1 < t2w1l6 && t2h1u1 < t2h1u6 && t2h1u1 < t2h1d6 && t2h1u1 < t2w1rwt6 && t2h1u1 < t2w1lwt6 && t2h1u1 < t2h1uwt6 && t2h1u1 < t2h1dwt6
  && t2h1u1 < t2w1r7 && t2h1u1 < t2w1l7 && t2h1u1 < t2h1u7 && t2h1u1 < t2h1d7 && t2h1u1 < t2w1rwt7 && t2h1u1 < t2w1lwt7 && t2h1u1 < t2h1uwt7 && t2h1u1 < t2h1dwt7
  && t2h1u1 < t2w1r8 && t2h1u1 < t2w1l8 && t2h1u1 < t2h1u8 && t2h1u1 < t2h1d8 && t2h1u1 < t2w1rwt8 && t2h1u1 < t2w1lwt8 && t2h1u1 < t2h1uwt8 && t2h1u1 < t2h1dwt8
  && t2h1u1 < t2w1r9 && t2h1u1 < t2w1l9 && t2h1u1 < t2h1u9 && t2h1u1 < t2h1d9 && t2h1u1 < t2w1rwt9 && t2h1u1 < t2w1lwt9 && t2h1u1 < t2h1uwt9 && t2h1u1 < t2h1dwt9
  && t2h1u1 < t2w1r10 && t2h1u1 < t2w1l10 && t2h1u1 < t2h1u10 && t2h1u1 < t2h1d10 && t2h1u1 < t2w1rwt10 && t2h1u1 < t2w1lwt10 && t2h1u1 < t2h1uwt10 && t2h1u1 < t2h1dwt10
  && (louthu1 !=0 && linhu1!=0)){
  i=60;
  }

  if (myu1==-1 && t2h1u1 > 0 && t2h1u1 < t1 
  && t2h1u1 < t2w1r && t2h1u1 < t2w1l && t2h1u1 < t2h1u && t2h1u1 < t2h1d && t2h1u1 < t2w1rwt && t2h1u1 < t2w1lwt && t2h1u1 < t2h1uwt && t2h1u1 < t2h1dwt
  && t2h1u1 < t2w1r1 && t2h1u1 < t2w1l1 && t2h1u1 < t2h1d1 && t2h1u1 < t2w1rwt1 && t2h1u1 < t2w1lwt1 && t2h1u1 < t2h1uwt1 && t2h1u1 < t2h1dwt1
  && t2h1u1 < t2w1r2 && t2h1u1 < t2w1l2 && t2h1u1 < t2h1u2 && t2h1u1 < t2h1d2 && t2h1u1 < t2w1rwt2 && t2h1u1 < t2w1lwt2 && t2h1u1 < t2h1uwt2 && t2h1u1 < t2h1dwt2
  && t2h1u1 < t2w1r3 && t2h1u1 < t2w1l3 && t2h1u1 < t2h1u3 && t2h1u1 < t2h1d3 && t2h1u1 < t2w1rwt3 && t2h1u1 < t2w1lwt3 && t2h1u1 < t2h1uwt3 && t2h1u1 < t2h1dwt3
  && t2h1u1 < t2w1r4 && t2h1u1 < t2w1l4 && t2h1u1 < t2h1u4 && t2h1u1 < t2h1d4 && t2h1u1 < t2w1rwt4 && t2h1u1 < t2w1lwt4 && t2h1u1 < t2h1uwt4 && t2h1u1 < t2h1dwt4
  && t2h1u1 < t2w1r5 && t2h1u1 < t2w1l5 && t2h1u1 < t2h1u5 && t2h1u1 < t2h1d5 && t2h1u1 < t2w1rwt5 && t2h1u1 < t2w1lwt5 && t2h1u1 < t2h1uwt5 && t2h1u1 < t2h1dwt5
  && t2h1u1 < t2w1r6 && t2h1u1 < t2w1l6 && t2h1u1 < t2h1u6 && t2h1u1 < t2h1d6 && t2h1u1 < t2w1rwt6 && t2h1u1 < t2w1lwt6 && t2h1u1 < t2h1uwt6 && t2h1u1 < t2h1dwt6
  && t2h1u1 < t2w1r7 && t2h1u1 < t2w1l7 && t2h1u1 < t2h1u7 && t2h1u1 < t2h1d7 && t2h1u1 < t2w1rwt7 && t2h1u1 < t2w1lwt7 && t2h1u1 < t2h1uwt7 && t2h1u1 < t2h1dwt7
  && t2h1u1 < t2w1r8 && t2h1u1 < t2w1l8 && t2h1u1 < t2h1u8 && t2h1u1 < t2h1d8 && t2h1u1 < t2w1rwt8 && t2h1u1 < t2w1lwt8 && t2h1u1 < t2h1uwt8 && t2h1u1 < t2h1dwt8
  && t2h1u1 < t2w1r9 && t2h1u1 < t2w1l9 && t2h1u1 < t2h1u9 && t2h1u1 < t2h1d9 && t2h1u1 < t2w1rwt9 && t2h1u1 < t2w1lwt9 && t2h1u1 < t2h1uwt9 && t2h1u1 < t2h1dwt9
  && t2h1u1 < t2w1r10 && t2h1u1 < t2w1l10 && t2h1u1 < t2h1u10 && t2h1u1 < t2h1d10 && t2h1u1 < t2w1rwt10 && t2h1u1 < t2w1lwt10 && t2h1u1 < t2h1uwt10 && t2h1u1 < t2h1dwt10
  && ((louthu1!=0 && linhu1==0) || (louthu1==0 && linhu1!=0))){
  i=60;
  }

  if (myu1==-1 && t2h1u1 > 0 && t2h1u1 < t1 
  && t2h1u1 < t2w1r && t2h1u1 < t2w1l && t2h1u1 < t2h1u && t2h1u1 < t2h1d && t2h1u1 < t2w1rwt && t2h1u1 < t2w1lwt && t2h1u1 < t2h1uwt && t2h1u1 < t2h1dwt
  && t2h1u1 < t2w1r1 && t2h1u1 < t2w1l1 && t2h1u1 < t2h1d1 && t2h1u1 < t2w1rwt1 && t2h1u1 < t2w1lwt1 && t2h1u1 < t2h1uwt1 && t2h1u1 < t2h1dwt1
  && t2h1u1 < t2w1r2 && t2h1u1 < t2w1l2 && t2h1u1 < t2h1u2 && t2h1u1 < t2h1d2 && t2h1u1 < t2w1rwt2 && t2h1u1 < t2w1lwt2 && t2h1u1 < t2h1uwt2 && t2h1u1 < t2h1dwt2
  && t2h1u1 < t2w1r3 && t2h1u1 < t2w1l3 && t2h1u1 < t2h1u3 && t2h1u1 < t2h1d3 && t2h1u1 < t2w1rwt3 && t2h1u1 < t2w1lwt3 && t2h1u1 < t2h1uwt3 && t2h1u1 < t2h1dwt3
  && t2h1u1 < t2w1r4 && t2h1u1 < t2w1l4 && t2h1u1 < t2h1u4 && t2h1u1 < t2h1d4 && t2h1u1 < t2w1rwt4 && t2h1u1 < t2w1lwt4 && t2h1u1 < t2h1uwt4 && t2h1u1 < t2h1dwt4
  && t2h1u1 < t2w1r5 && t2h1u1 < t2w1l5 && t2h1u1 < t2h1u5 && t2h1u1 < t2h1d5 && t2h1u1 < t2w1rwt5 && t2h1u1 < t2w1lwt5 && t2h1u1 < t2h1uwt5 && t2h1u1 < t2h1dwt5
  && t2h1u1 < t2w1r6 && t2h1u1 < t2w1l6 && t2h1u1 < t2h1u6 && t2h1u1 < t2h1d6 && t2h1u1 < t2w1rwt6 && t2h1u1 < t2w1lwt6 && t2h1u1 < t2h1uwt6 && t2h1u1 < t2h1dwt6
  && t2h1u1 < t2w1r7 && t2h1u1 < t2w1l7 && t2h1u1 < t2h1u7 && t2h1u1 < t2h1d7 && t2h1u1 < t2w1rwt7 && t2h1u1 < t2w1lwt7 && t2h1u1 < t2h1uwt7 && t2h1u1 < t2h1dwt7
  && t2h1u1 < t2w1r8 && t2h1u1 < t2w1l8 && t2h1u1 < t2h1u8 && t2h1u1 < t2h1d8 && t2h1u1 < t2w1rwt8 && t2h1u1 < t2w1lwt8 && t2h1u1 < t2h1uwt8 && t2h1u1 < t2h1dwt8
  && t2h1u1 < t2w1r9 && t2h1u1 < t2w1l9 && t2h1u1 < t2h1u9 && t2h1u1 < t2h1d9 && t2h1u1 < t2w1rwt9 && t2h1u1 < t2w1lwt9 && t2h1u1 < t2h1uwt9 && t2h1u1 < t2h1dwt9
  && t2h1u1 < t2w1r10 && t2h1u1 < t2w1l10 && t2h1u1 < t2h1u10 && t2h1u1 < t2h1d10 && t2h1u1 < t2w1rwt10 && t2h1u1 < t2w1lwt10 && t2h1u1 < t2h1uwt10 && t2h1u1 < t2h1dwt10
  && (louthu1 == 0 && linhu1 == 0)){
  i=60;
  }

  if (myd1==-1 && t2h1d1 > 0 && t2h1d1 < t1 
  && t2h1d1 < t2w1r && t2h1d1 < t2w1l && t2h1d1 < t2h1u && t2h1d1 < t2h1d && t2h1d1 < t2w1rwt && t2h1d1 < t2w1lwt && t2h1d1 < t2h1uwt && t2h1d1 < t2h1dwt
  && t2h1d1 < t2w1r1 && t2h1d1 < t2w1l1 && t2h1d1 < t2h1u1 && t2h1d1 < t2w1rwt1 && t2h1d1 < t2w1lwt1 && t2h1d1 < t2h1uwt1 && t2h1d1 < t2h1dwt1
  && t2h1d1 < t2w1r2 && t2h1d1 < t2w1l2 && t2h1d1 < t2h1u2 && t2h1d1 < t2h1d2 && t2h1d1 < t2w1rwt2 && t2h1d1 < t2w1lwt2 && t2h1d1 < t2h1uwt2 && t2h1d1 < t2h1dwt2
  && t2h1d1 < t2w1r3 && t2h1d1 < t2w1l3 && t2h1d1 < t2h1u3 && t2h1d1 < t2h1d3 && t2h1d1 < t2w1rwt3 && t2h1d1 < t2w1lwt3 && t2h1d1 < t2h1uwt3 && t2h1d1 < t2h1dwt3
  && t2h1d1 < t2w1r4 && t2h1d1 < t2w1l4 && t2h1d1 < t2h1u4 && t2h1d1 < t2h1d4 && t2h1d1 < t2w1rwt4 && t2h1d1 < t2w1lwt4 && t2h1d1 < t2h1uwt4 && t2h1d1 < t2h1dwt4
  && t2h1d1 < t2w1r5 && t2h1d1 < t2w1l5 && t2h1d1 < t2h1u5 && t2h1d1 < t2h1d5 && t2h1d1 < t2w1rwt5 && t2h1d1 < t2w1lwt5 && t2h1d1 < t2h1uwt5 && t2h1d1 < t2h1dwt5
  && t2h1d1 < t2w1r6 && t2h1d1 < t2w1l6 && t2h1d1 < t2h1u6 && t2h1d1 < t2h1d6 && t2h1d1 < t2w1rwt6 && t2h1d1 < t2w1lwt6 && t2h1d1 < t2h1uwt6 && t2h1d1 < t2h1dwt6
  && t2h1d1 < t2w1r7 && t2h1d1 < t2w1l7 && t2h1d1 < t2h1u7 && t2h1d1 < t2h1d7 && t2h1d1 < t2w1rwt7 && t2h1d1 < t2w1lwt7 && t2h1d1 < t2h1uwt7 && t2h1d1 < t2h1dwt7
  && t2h1d1 < t2w1r8 && t2h1d1 < t2w1l8 && t2h1d1 < t2h1u8 && t2h1d1 < t2h1d8 && t2h1d1 < t2w1rwt8 && t2h1d1 < t2w1lwt8 && t2h1d1 < t2h1uwt8 && t2h1d1 < t2h1dwt8
  && t2h1d1 < t2w1r9 && t2h1d1 < t2w1l9 && t2h1d1 < t2h1u9 && t2h1d1 < t2h1d9 && t2h1d1 < t2w1rwt9 && t2h1d1 < t2w1lwt9 && t2h1d1 < t2h1uwt9 && t2h1d1 < t2h1dwt9
  && t2h1d1 < t2w1r10 && t2h1d1 < t2w1l10 && t2h1d1 < t2h1u10 && t2h1d1 < t2h1d10 && t2h1d1 < t2w1rwt10 && t2h1d1 < t2w1lwt10 && t2h1d1 < t2h1uwt10 && t2h1d1 < t2h1dwt10
  && (louthd1 !=0 && linhd1!=0)){
  i=61;
  }

  if (myd1==-1 && t2h1d1 > 0 && t2h1d1 < t1 
  && t2h1d1 < t2w1r && t2h1d1 < t2w1l && t2h1d1 < t2h1u && t2h1d1 < t2h1d && t2h1d1 < t2w1rwt && t2h1d1 < t2w1lwt && t2h1d1 < t2h1uwt && t2h1d1 < t2h1dwt
  && t2h1d1 < t2w1r1 && t2h1d1 < t2w1l1 && t2h1d1 < t2h1u1 && t2h1d1 < t2w1rwt1 && t2h1d1 < t2w1lwt1 && t2h1d1 < t2h1uwt1 && t2h1d1 < t2h1dwt1
  && t2h1d1 < t2w1r2 && t2h1d1 < t2w1l2 && t2h1d1 < t2h1u2 && t2h1d1 < t2h1d2 && t2h1d1 < t2w1rwt2 && t2h1d1 < t2w1lwt2 && t2h1d1 < t2h1uwt2 && t2h1d1 < t2h1dwt2
  && t2h1d1 < t2w1r3 && t2h1d1 < t2w1l3 && t2h1d1 < t2h1u3 && t2h1d1 < t2h1d3 && t2h1d1 < t2w1rwt3 && t2h1d1 < t2w1lwt3 && t2h1d1 < t2h1uwt3 && t2h1d1 < t2h1dwt3
  && t2h1d1 < t2w1r4 && t2h1d1 < t2w1l4 && t2h1d1 < t2h1u4 && t2h1d1 < t2h1d4 && t2h1d1 < t2w1rwt4 && t2h1d1 < t2w1lwt4 && t2h1d1 < t2h1uwt4 && t2h1d1 < t2h1dwt4
  && t2h1d1 < t2w1r5 && t2h1d1 < t2w1l5 && t2h1d1 < t2h1u5 && t2h1d1 < t2h1d5 && t2h1d1 < t2w1rwt5 && t2h1d1 < t2w1lwt5 && t2h1d1 < t2h1uwt5 && t2h1d1 < t2h1dwt5
  && t2h1d1 < t2w1r6 && t2h1d1 < t2w1l6 && t2h1d1 < t2h1u6 && t2h1d1 < t2h1d6 && t2h1d1 < t2w1rwt6 && t2h1d1 < t2w1lwt6 && t2h1d1 < t2h1uwt6 && t2h1d1 < t2h1dwt6
  && t2h1d1 < t2w1r7 && t2h1d1 < t2w1l7 && t2h1d1 < t2h1u7 && t2h1d1 < t2h1d7 && t2h1d1 < t2w1rwt7 && t2h1d1 < t2w1lwt7 && t2h1d1 < t2h1uwt7 && t2h1d1 < t2h1dwt7
  && t2h1d1 < t2w1r8 && t2h1d1 < t2w1l8 && t2h1d1 < t2h1u8 && t2h1d1 < t2h1d8 && t2h1d1 < t2w1rwt8 && t2h1d1 < t2w1lwt8 && t2h1d1 < t2h1uwt8 && t2h1d1 < t2h1dwt8
  && t2h1d1 < t2w1r9 && t2h1d1 < t2w1l9 && t2h1d1 < t2h1u9 && t2h1d1 < t2h1d9 && t2h1d1 < t2w1rwt9 && t2h1d1 < t2w1lwt9 && t2h1d1 < t2h1uwt9 && t2h1d1 < t2h1dwt9
  && t2h1d1 < t2w1r10 && t2h1d1 < t2w1l10 && t2h1d1 < t2h1u10 && t2h1d1 < t2h1d10 && t2h1d1 < t2w1rwt10 && t2h1d1 < t2w1lwt10 && t2h1d1 < t2h1uwt10 && t2h1d1 < t2h1dwt10
  && ((louthd1 !=0 && linhd1==0) || (louthd1 ==0 && linhd1!=0))){
  i=61;
  }

  if (myd1==-1 && t2h1d1 > 0 && t2h1d1 < t1 
  && t2h1d1 < t2w1r && t2h1d1 < t2w1l && t2h1d1 < t2h1u && t2h1d1 < t2h1d && t2h1d1 < t2w1rwt && t2h1d1 < t2w1lwt && t2h1d1 < t2h1uwt && t2h1d1 < t2h1dwt
  && t2h1d1 < t2w1r1 && t2h1d1 < t2w1l1 && t2h1d1 < t2h1u1 && t2h1d1 < t2w1rwt1 && t2h1d1 < t2w1lwt1 && t2h1d1 < t2h1uwt1 && t2h1d1 < t2h1dwt1
  && t2h1d1 < t2w1r2 && t2h1d1 < t2w1l2 && t2h1d1 < t2h1u2 && t2h1d1 < t2h1d2 && t2h1d1 < t2w1rwt2 && t2h1d1 < t2w1lwt2 && t2h1d1 < t2h1uwt2 && t2h1d1 < t2h1dwt2
  && t2h1d1 < t2w1r3 && t2h1d1 < t2w1l3 && t2h1d1 < t2h1u3 && t2h1d1 < t2h1d3 && t2h1d1 < t2w1rwt3 && t2h1d1 < t2w1lwt3 && t2h1d1 < t2h1uwt3 && t2h1d1 < t2h1dwt3
  && t2h1d1 < t2w1r4 && t2h1d1 < t2w1l4 && t2h1d1 < t2h1u4 && t2h1d1 < t2h1d4 && t2h1d1 < t2w1rwt4 && t2h1d1 < t2w1lwt4 && t2h1d1 < t2h1uwt4 && t2h1d1 < t2h1dwt4
  && t2h1d1 < t2w1r5 && t2h1d1 < t2w1l5 && t2h1d1 < t2h1u5 && t2h1d1 < t2h1d5 && t2h1d1 < t2w1rwt5 && t2h1d1 < t2w1lwt5 && t2h1d1 < t2h1uwt5 && t2h1d1 < t2h1dwt5
  && t2h1d1 < t2w1r6 && t2h1d1 < t2w1l6 && t2h1d1 < t2h1u6 && t2h1d1 < t2h1d6 && t2h1d1 < t2w1rwt6 && t2h1d1 < t2w1lwt6 && t2h1d1 < t2h1uwt6 && t2h1d1 < t2h1dwt6
  && t2h1d1 < t2w1r7 && t2h1d1 < t2w1l7 && t2h1d1 < t2h1u7 && t2h1d1 < t2h1d7 && t2h1d1 < t2w1rwt7 && t2h1d1 < t2w1lwt7 && t2h1d1 < t2h1uwt7 && t2h1d1 < t2h1dwt7
  && t2h1d1 < t2w1r8 && t2h1d1 < t2w1l8 && t2h1d1 < t2h1u8 && t2h1d1 < t2h1d8 && t2h1d1 < t2w1rwt8 && t2h1d1 < t2w1lwt8 && t2h1d1 < t2h1uwt8 && t2h1d1 < t2h1dwt8
  && t2h1d1 < t2w1r9 && t2h1d1 < t2w1l9 && t2h1d1 < t2h1u9 && t2h1d1 < t2h1d9 && t2h1d1 < t2w1rwt9 && t2h1d1 < t2w1lwt9 && t2h1d1 < t2h1uwt9 && t2h1d1 < t2h1dwt9
  && t2h1d1 < t2w1r10 && t2h1d1 < t2w1l10 && t2h1d1 < t2h1u10 && t2h1d1 < t2h1d10 && t2h1d1 < t2w1rwt10 && t2h1d1 < t2w1lwt10 && t2h1d1 < t2h1uwt10 && t2h1d1 < t2h1dwt10
  && (louthd1 == 0 && linhd1 == 0)){
  i=61;
  }




  if (mxrOW1!=-1 && t2w1rwt1 > 0 && t2w1rwt1 < t1 
  && t2w1rwt1 < t2w1r && t2w1rwt1 < t2w1l && t2w1rwt1 < t2h1u && t2w1rwt1 < t2h1d && t2w1rwt1 <t2w1rwt && t2w1rwt1 <t2w1lwt && t2w1rwt1 < t2h1uwt && t2w1rwt1 < t2h1dwt
  && t2w1rwt1 < t2w1r1 && t2w1rwt1 < t2w1l1 && t2w1rwt1 < t2h1u1 && t2w1rwt1 < t2h1d1 && t2w1rwt1 <t2w1lwt1 && t2w1rwt1 < t2h1uwt1 && t2w1rwt1 < t2h1dwt1
  && t2w1rwt1 < t2w1r2 && t2w1rwt1 < t2w1l2 && t2w1rwt1 < t2h1u2 && t2w1rwt1 < t2h1d2 && t2w1rwt1 <t2w1rwt2 && t2w1rwt1 <t2w1lwt2 && t2w1rwt1 < t2h1uwt2 && t2w1rwt1 < t2h1dwt2
  && t2w1rwt1 < t2w1r3 && t2w1rwt1 < t2w1l3 && t2w1rwt1 < t2h1u3 && t2w1rwt1 < t2h1d3 && t2w1rwt1 <t2w1rwt3 && t2w1rwt1 <t2w1lwt3 && t2w1rwt1 < t2h1uwt3 && t2w1rwt1 < t2h1dwt3
  && t2w1rwt1 < t2w1r4 && t2w1rwt1 < t2w1l4 && t2w1rwt1 < t2h1u4 && t2w1rwt1 < t2h1d4 && t2w1rwt1 <t2w1rwt4 && t2w1rwt1 <t2w1lwt4 && t2w1rwt1 < t2h1uwt4 && t2w1rwt1 < t2h1dwt4
  && t2w1rwt1 < t2w1r5 && t2w1rwt1 < t2w1l5 && t2w1rwt1 < t2h1u5 && t2w1rwt1 < t2h1d5 && t2w1rwt1 <t2w1rwt5 && t2w1rwt1 <t2w1lwt5 && t2w1rwt1 < t2h1uwt5 && t2w1rwt1 < t2h1dwt5
  && t2w1rwt1 < t2w1r6 && t2w1rwt1 < t2w1l6 && t2w1rwt1 < t2h1u6 && t2w1rwt1 < t2h1d6 && t2w1rwt1 <t2w1rwt6 && t2w1rwt1 <t2w1lwt6 && t2w1rwt1 < t2h1uwt6 && t2w1rwt1 < t2h1dwt6
  && t2w1rwt1 < t2w1r7 && t2w1rwt1 < t2w1l7 && t2w1rwt1 < t2h1u7 && t2w1rwt1 < t2h1d7 && t2w1rwt1 <t2w1rwt7 && t2w1rwt1 <t2w1lwt7 && t2w1rwt1 < t2h1uwt7 && t2w1rwt1 < t2h1dwt7
  && t2w1rwt1 < t2w1r8 && t2w1rwt1 < t2w1l8 && t2w1rwt1 < t2h1u8 && t2w1rwt1 < t2h1d8 && t2w1rwt1 <t2w1rwt8 && t2w1rwt1 <t2w1lwt8 && t2w1rwt1 < t2h1uwt8 && t2w1rwt1 < t2h1dwt8
  && t2w1rwt1 < t2w1r9 && t2w1rwt1 < t2w1l9 && t2w1rwt1 < t2h1u9 && t2w1rwt1 < t2h1d9 && t2w1rwt1 <t2w1rwt9 && t2w1rwt1 <t2w1lwt9 && t2w1rwt1 < t2h1uwt9 && t2w1rwt1 < t2h1dwt9
  && t2w1rwt1 < t2w1r10 && t2w1rwt1 < t2w1l10 && t2w1rwt1 < t2h1u10 && t2w1rwt1 < t2h1d10 && t2w1rwt1 <t2w1rwt10 && t2w1rwt1 <t2w1lwt10 && t2w1rwt1 < t2h1uwt10 && t2w1rwt1 < t2h1dwt10
  && ((linwr1!=0) && (loutwr1!=0) )){	
   if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1rwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1rwt1+z))*(z0hd1+(vz*t2w1rwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1rwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1rwt1+z))*(z0hu1+(vz*t2w1rwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1rwt1+y;
  xtest=vx*t2w1rwt1+x;
  xlimitrwt=-bwrwt1*sqrt(1-((vz*t2w1rwt1+z)+z0wr1)*((vz*t2w1rwt1+z)+z0wr1)/a2wrwt1);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW1 > 0){
  i=62;
  }
  else{
  i=74;
  }
  }


  if (mxrOW1!=-1 && t2w1rwt1 > 0 && t2w1rwt1 < t1 
  && t2w1rwt1 < t2w1r && t2w1rwt1 < t2w1l && t2w1rwt1 < t2h1u && t2w1rwt1 < t2h1d && t2w1rwt1 <t2w1rwt && t2w1rwt1 <t2w1lwt && t2w1rwt1 < t2h1uwt && t2w1rwt1 < t2h1dwt
  && t2w1rwt1 < t2w1r1 && t2w1rwt1 < t2w1l1 && t2w1rwt1 < t2h1u1 && t2w1rwt1 < t2h1d1 && t2w1rwt1 <t2w1lwt1 && t2w1rwt1 < t2h1uwt1 && t2w1rwt1 < t2h1dwt1
  && t2w1rwt1 < t2w1r2 && t2w1rwt1 < t2w1l2 && t2w1rwt1 < t2h1u2 && t2w1rwt1 < t2h1d2 && t2w1rwt1 <t2w1rwt2 && t2w1rwt1 <t2w1lwt2 && t2w1rwt1 < t2h1uwt2 && t2w1rwt1 < t2h1dwt2
  && t2w1rwt1 < t2w1r3 && t2w1rwt1 < t2w1l3 && t2w1rwt1 < t2h1u3 && t2w1rwt1 < t2h1d3 && t2w1rwt1 <t2w1rwt3 && t2w1rwt1 <t2w1lwt3 && t2w1rwt1 < t2h1uwt3 && t2w1rwt1 < t2h1dwt3
  && t2w1rwt1 < t2w1r4 && t2w1rwt1 < t2w1l4 && t2w1rwt1 < t2h1u4 && t2w1rwt1 < t2h1d4 && t2w1rwt1 <t2w1rwt4 && t2w1rwt1 <t2w1lwt4 && t2w1rwt1 < t2h1uwt4 && t2w1rwt1 < t2h1dwt4
  && t2w1rwt1 < t2w1r5 && t2w1rwt1 < t2w1l5 && t2w1rwt1 < t2h1u5 && t2w1rwt1 < t2h1d5 && t2w1rwt1 <t2w1rwt5 && t2w1rwt1 <t2w1lwt5 && t2w1rwt1 < t2h1uwt5 && t2w1rwt1 < t2h1dwt5
  && t2w1rwt1 < t2w1r6 && t2w1rwt1 < t2w1l6 && t2w1rwt1 < t2h1u6 && t2w1rwt1 < t2h1d6 && t2w1rwt1 <t2w1rwt6 && t2w1rwt1 <t2w1lwt6 && t2w1rwt1 < t2h1uwt6 && t2w1rwt1 < t2h1dwt6
  && t2w1rwt1 < t2w1r7 && t2w1rwt1 < t2w1l7 && t2w1rwt1 < t2h1u7 && t2w1rwt1 < t2h1d7 && t2w1rwt1 <t2w1rwt7 && t2w1rwt1 <t2w1lwt7 && t2w1rwt1 < t2h1uwt7 && t2w1rwt1 < t2h1dwt7
  && t2w1rwt1 < t2w1r8 && t2w1rwt1 < t2w1l8 && t2w1rwt1 < t2h1u8 && t2w1rwt1 < t2h1d8 && t2w1rwt1 <t2w1rwt8 && t2w1rwt1 <t2w1lwt8 && t2w1rwt1 < t2h1uwt8 && t2w1rwt1 < t2h1dwt8
  && t2w1rwt1 < t2w1r9 && t2w1rwt1 < t2w1l9 && t2w1rwt1 < t2h1u9 && t2w1rwt1 < t2h1d9 && t2w1rwt1 <t2w1rwt9 && t2w1rwt1 <t2w1lwt9 && t2w1rwt1 < t2h1uwt9 && t2w1rwt1 < t2h1dwt9
  && t2w1rwt1 < t2w1r10 && t2w1rwt1 < t2w1l10 && t2w1rwt1 < t2h1u10 && t2w1rwt1 < t2h1d10 && t2w1rwt1 <t2w1rwt10 && t2w1rwt1 <t2w1lwt10 && t2w1rwt1 < t2h1uwt10 && t2w1rwt1 < t2h1dwt10
  && ((loutwr1!=0 && linwr1==0) || (loutwr1==0 && linwr1!=0))){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1rwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1rwt1+z))*(z0hd1+(vz*t2w1rwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1rwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1rwt1+z))*(z0hu1+(vz*t2w1rwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1rwt1+y;
  xtest=vx*t2w1rwt1+x;
  xlimitr=-sqrt((pbwrwt1-(vz*t2w1rwt1+z))/pawrwt1);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW1 > 0){
  i=63; 
  }else{
  i=74;
  }
  }


  if (mxrOW1!=-1 && t2w1rwt1 > 0 && t2w1rwt1 < t1 
  && t2w1rwt1 < t2w1r && t2w1rwt1 < t2w1l && t2w1rwt1 < t2h1u && t2w1rwt1 < t2h1d && t2w1rwt1 <t2w1rwt && t2w1rwt1 <t2w1lwt && t2w1rwt1 < t2h1uwt && t2w1rwt1 < t2h1dwt
  && t2w1rwt1 < t2w1r1 && t2w1rwt1 < t2w1l1 && t2w1rwt1 < t2h1u1 && t2w1rwt1 < t2h1d1 && t2w1rwt1 <t2w1lwt1 && t2w1rwt1 < t2h1uwt1 && t2w1rwt1 < t2h1dwt1
  && t2w1rwt1 < t2w1r2 && t2w1rwt1 < t2w1l2 && t2w1rwt1 < t2h1u2 && t2w1rwt1 < t2h1d2 && t2w1rwt1 <t2w1rwt2 && t2w1rwt1 <t2w1lwt2 && t2w1rwt1 < t2h1uwt2 && t2w1rwt1 < t2h1dwt2
  && t2w1rwt1 < t2w1r3 && t2w1rwt1 < t2w1l3 && t2w1rwt1 < t2h1u3 && t2w1rwt1 < t2h1d3 && t2w1rwt1 <t2w1rwt3 && t2w1rwt1 <t2w1lwt3 && t2w1rwt1 < t2h1uwt3 && t2w1rwt1 < t2h1dwt3
  && t2w1rwt1 < t2w1r4 && t2w1rwt1 < t2w1l4 && t2w1rwt1 < t2h1u4 && t2w1rwt1 < t2h1d4 && t2w1rwt1 <t2w1rwt4 && t2w1rwt1 <t2w1lwt4 && t2w1rwt1 < t2h1uwt4 && t2w1rwt1 < t2h1dwt4
  && t2w1rwt1 < t2w1r5 && t2w1rwt1 < t2w1l5 && t2w1rwt1 < t2h1u5 && t2w1rwt1 < t2h1d5 && t2w1rwt1 <t2w1rwt5 && t2w1rwt1 <t2w1lwt5 && t2w1rwt1 < t2h1uwt5 && t2w1rwt1 < t2h1dwt5
  && t2w1rwt1 < t2w1r6 && t2w1rwt1 < t2w1l6 && t2w1rwt1 < t2h1u6 && t2w1rwt1 < t2h1d6 && t2w1rwt1 <t2w1rwt6 && t2w1rwt1 <t2w1lwt6 && t2w1rwt1 < t2h1uwt6 && t2w1rwt1 < t2h1dwt6
  && t2w1rwt1 < t2w1r7 && t2w1rwt1 < t2w1l7 && t2w1rwt1 < t2h1u7 && t2w1rwt1 < t2h1d7 && t2w1rwt1 <t2w1rwt7 && t2w1rwt1 <t2w1lwt7 && t2w1rwt1 < t2h1uwt7 && t2w1rwt1 < t2h1dwt7
  && t2w1rwt1 < t2w1r8 && t2w1rwt1 < t2w1l8 && t2w1rwt1 < t2h1u8 && t2w1rwt1 < t2h1d8 && t2w1rwt1 <t2w1rwt8 && t2w1rwt1 <t2w1lwt8 && t2w1rwt1 < t2h1uwt8 && t2w1rwt1 < t2h1dwt8
  && t2w1rwt1 < t2w1r9 && t2w1rwt1 < t2w1l9 && t2w1rwt1 < t2h1u9 && t2w1rwt1 < t2h1d9 && t2w1rwt1 <t2w1rwt9 && t2w1rwt1 <t2w1lwt9 && t2w1rwt1 < t2h1uwt9 && t2w1rwt1 < t2h1dwt9
  && t2w1rwt1 < t2w1r10 && t2w1rwt1 < t2w1l10 && t2w1rwt1 < t2h1u10 && t2w1rwt1 < t2h1d10 && t2w1rwt1 <t2w1rwt10 && t2w1rwt1 <t2w1lwt10 && t2w1rwt1 < t2h1uwt10 && t2w1rwt1 < t2h1dwt10
  && (loutwr1==0 && linwr1==0) ){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1rwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1rwt1+z))*(z0hd1+(vz*t2w1rwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1rwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1rwt1+z))*(z0hu1+(vz*t2w1rwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1rwt1+y; 
  xtest=vx*t2w1rwt1+x;
  xlimitr=-(-w2r1+w1r1)*(vz*t2w1rwt1+z)/l-w1rwt1;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW1>0){
  i=64;
  }else{
  i=74;
  }
  }


 if (mxlOW1!=-1 && t2w1lwt1 > 0 && t2w1lwt1 < t1 
  && t2w1lwt1 < t2w1r && t2w1lwt1 < t2w1l && t2w1lwt1 < t2h1u && t2w1lwt1 < t2h1d && t2w1lwt1 <t2w1rwt && t2w1lwt1 <t2w1lwt && t2w1lwt1 < t2h1uwt && t2w1lwt1 < t2h1dwt
  && t2w1lwt1 < t2w1r1 && t2w1lwt1 < t2w1l1 && t2w1lwt1 < t2h1u1 && t2w1lwt1 < t2h1d1 && t2w1lwt1 <t2w1rwt1 && t2w1lwt1 < t2h1uwt1 && t2w1lwt1 < t2h1dwt1
  && t2w1lwt1 < t2w1r2 && t2w1lwt1 < t2w1l2 && t2w1lwt1 < t2h1u2 && t2w1lwt1 < t2h1d2 && t2w1lwt1 <t2w1rwt2 && t2w1lwt1 <t2w1lwt2 && t2w1lwt1 < t2h1uwt2 && t2w1lwt1 < t2h1dwt2
  && t2w1lwt1 < t2w1r3 && t2w1lwt1 < t2w1l3 && t2w1lwt1 < t2h1u3 && t2w1lwt1 < t2h1d3 && t2w1lwt1 <t2w1rwt3 && t2w1lwt1 <t2w1lwt3 && t2w1lwt1 < t2h1uwt3 && t2w1lwt1 < t2h1dwt3
  && t2w1lwt1 < t2w1r4 && t2w1lwt1 < t2w1l4 && t2w1lwt1 < t2h1u4 && t2w1lwt1 < t2h1d4 && t2w1lwt1 <t2w1rwt4 && t2w1lwt1 <t2w1lwt4 && t2w1lwt1 < t2h1uwt4 && t2w1lwt1 < t2h1dwt4
  && t2w1lwt1 < t2w1r5 && t2w1lwt1 < t2w1l5 && t2w1lwt1 < t2h1u5 && t2w1lwt1 < t2h1d5 && t2w1lwt1 <t2w1rwt5 && t2w1lwt1 <t2w1lwt5 && t2w1lwt1 < t2h1uwt5 && t2w1lwt1 < t2h1dwt5
  && t2w1lwt1 < t2w1r6 && t2w1lwt1 < t2w1l6 && t2w1lwt1 < t2h1u6 && t2w1lwt1 < t2h1d6 && t2w1lwt1 <t2w1rwt6 && t2w1lwt1 <t2w1lwt6 && t2w1lwt1 < t2h1uwt6 && t2w1lwt1 < t2h1dwt6
  && t2w1lwt1 < t2w1r7 && t2w1lwt1 < t2w1l7 && t2w1lwt1 < t2h1u7 && t2w1lwt1 < t2h1d7 && t2w1lwt1 <t2w1rwt7 && t2w1lwt1 <t2w1lwt7 && t2w1lwt1 < t2h1uwt7 && t2w1lwt1 < t2h1dwt7
  && t2w1lwt1 < t2w1r8 && t2w1lwt1 < t2w1l8 && t2w1lwt1 < t2h1u8 && t2w1lwt1 < t2h1d8 && t2w1lwt1 <t2w1rwt8 && t2w1lwt1 <t2w1lwt8 && t2w1lwt1 < t2h1uwt8 && t2w1lwt1 < t2h1dwt8
  && t2w1lwt1 < t2w1r9 && t2w1lwt1 < t2w1l9 && t2w1lwt1 < t2h1u9 && t2w1lwt1 < t2h1d9 && t2w1lwt1 <t2w1rwt9 && t2w1lwt1 <t2w1lwt9 && t2w1lwt1 < t2h1uwt9 && t2w1lwt1 < t2h1dwt9
  && t2w1lwt1 < t2w1r10 && t2w1lwt1 < t2w1l10 && t2w1lwt1 < t2h1u10 && t2w1lwt1 < t2h1d10 && t2w1lwt1 <t2w1rwt10 && t2w1lwt1 <t2w1lwt10 && t2w1lwt1 < t2h1uwt10 && t2w1lwt1 < t2h1dwt10
  && ((linwl1!=0) && (loutwl1!=0) )){
   if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1lwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1lwt1+z))*(z0hd1+(vz*t2w1lwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1lwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1lwt1+z))*(z0hu1+(vz*t2w1lwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1lwt1+y;
  xtest=vx*t2w1lwt1+x;
  xlimitlwt=-bwlwt1*sqrt(1-((vz*t2w1lwt1+z)+z0wl1)*((vz*t2w1lwt1+z)+z0wl1)/a2wlwt1);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW1>0){
  i=65;
  }else{
  i=75;
  }
  }


  if (mxlOW1!=-1 && t2w1lwt1 > 0 && t2w1lwt1 < t1 
  && t2w1lwt1 < t2w1r && t2w1lwt1 < t2w1l && t2w1lwt1 < t2h1u && t2w1lwt1 < t2h1d && t2w1lwt1 <t2w1rwt && t2w1lwt1 <t2w1lwt && t2w1lwt1 < t2h1uwt && t2w1lwt1 < t2h1dwt
  && t2w1lwt1 < t2w1r1 && t2w1lwt1 < t2w1l1 && t2w1lwt1 < t2h1u1 && t2w1lwt1 < t2h1d1 && t2w1lwt1 <t2w1rwt1 && t2w1lwt1 < t2h1uwt1 && t2w1lwt1 < t2h1dwt1
  && t2w1lwt1 < t2w1r2 && t2w1lwt1 < t2w1l2 && t2w1lwt1 < t2h1u2 && t2w1lwt1 < t2h1d2 && t2w1lwt1 <t2w1rwt2 && t2w1lwt1 <t2w1lwt2 && t2w1lwt1 < t2h1uwt2 && t2w1lwt1 < t2h1dwt2
  && t2w1lwt1 < t2w1r3 && t2w1lwt1 < t2w1l3 && t2w1lwt1 < t2h1u3 && t2w1lwt1 < t2h1d3 && t2w1lwt1 <t2w1rwt3 && t2w1lwt1 <t2w1lwt3 && t2w1lwt1 < t2h1uwt3 && t2w1lwt1 < t2h1dwt3
  && t2w1lwt1 < t2w1r4 && t2w1lwt1 < t2w1l4 && t2w1lwt1 < t2h1u4 && t2w1lwt1 < t2h1d4 && t2w1lwt1 <t2w1rwt4 && t2w1lwt1 <t2w1lwt4 && t2w1lwt1 < t2h1uwt4 && t2w1lwt1 < t2h1dwt4
  && t2w1lwt1 < t2w1r5 && t2w1lwt1 < t2w1l5 && t2w1lwt1 < t2h1u5 && t2w1lwt1 < t2h1d5 && t2w1lwt1 <t2w1rwt5 && t2w1lwt1 <t2w1lwt5 && t2w1lwt1 < t2h1uwt5 && t2w1lwt1 < t2h1dwt5
  && t2w1lwt1 < t2w1r6 && t2w1lwt1 < t2w1l6 && t2w1lwt1 < t2h1u6 && t2w1lwt1 < t2h1d6 && t2w1lwt1 <t2w1rwt6 && t2w1lwt1 <t2w1lwt6 && t2w1lwt1 < t2h1uwt6 && t2w1lwt1 < t2h1dwt6
  && t2w1lwt1 < t2w1r7 && t2w1lwt1 < t2w1l7 && t2w1lwt1 < t2h1u7 && t2w1lwt1 < t2h1d7 && t2w1lwt1 <t2w1rwt7 && t2w1lwt1 <t2w1lwt7 && t2w1lwt1 < t2h1uwt7 && t2w1lwt1 < t2h1dwt7
  && t2w1lwt1 < t2w1r8 && t2w1lwt1 < t2w1l8 && t2w1lwt1 < t2h1u8 && t2w1lwt1 < t2h1d8 && t2w1lwt1 <t2w1rwt8 && t2w1lwt1 <t2w1lwt8 && t2w1lwt1 < t2h1uwt8 && t2w1lwt1 < t2h1dwt8
  && t2w1lwt1 < t2w1r9 && t2w1lwt1 < t2w1l9 && t2w1lwt1 < t2h1u9 && t2w1lwt1 < t2h1d9 && t2w1lwt1 <t2w1rwt9 && t2w1lwt1 <t2w1lwt9 && t2w1lwt1 < t2h1uwt9 && t2w1lwt1 < t2h1dwt9
  && t2w1lwt1 < t2w1r10 && t2w1lwt1 < t2w1l10 && t2w1lwt1 < t2h1u10 && t2w1lwt1 < t2h1d10 && t2w1lwt1 <t2w1rwt10 && t2w1lwt1 <t2w1lwt10 && t2w1lwt1 < t2h1uwt10 && t2w1lwt1 < t2h1dwt10
  && ((loutwl1!=0 && linwl1==0) || (loutwl1==0 && linwl1!=0))){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1lwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1lwt1+z))*(z0hd1+(vz*t2w1lwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1lwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1lwt1+z))*(z0hu1+(vz*t2w1lwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1lwt1+y;
  xtest=vx*t2w1lwt1+x;
  xlimitl=-sqrt((pbwlwt1-(vz*t2w1lwt1+z))/pawlwt1);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW1>0){
  i=66;
  }else{
  i=75;
  }
  }


  if (mxlOW1!=-1 && t2w1lwt1 > 0 && t2w1lwt1 < t1 
  && t2w1lwt1 < t2w1r && t2w1lwt1 < t2w1l && t2w1lwt1 < t2h1u && t2w1lwt1 < t2h1d && t2w1lwt1 <t2w1rwt && t2w1lwt1 <t2w1lwt && t2w1lwt1 < t2h1uwt && t2w1lwt1 < t2h1dwt
  && t2w1lwt1 < t2w1r1 && t2w1lwt1 < t2w1l1 && t2w1lwt1 < t2h1u1 && t2w1lwt1 < t2h1d1 && t2w1lwt1 <t2w1rwt1 && t2w1lwt1 < t2h1uwt1 && t2w1lwt1 < t2h1dwt1
  && t2w1lwt1 < t2w1r2 && t2w1lwt1 < t2w1l2 && t2w1lwt1 < t2h1u2 && t2w1lwt1 < t2h1d2 && t2w1lwt1 <t2w1rwt2 && t2w1lwt1 <t2w1lwt2 && t2w1lwt1 < t2h1uwt2 && t2w1lwt1 < t2h1dwt2
  && t2w1lwt1 < t2w1r3 && t2w1lwt1 < t2w1l3 && t2w1lwt1 < t2h1u3 && t2w1lwt1 < t2h1d3 && t2w1lwt1 <t2w1rwt3 && t2w1lwt1 <t2w1lwt3 && t2w1lwt1 < t2h1uwt3 && t2w1lwt1 < t2h1dwt3
  && t2w1lwt1 < t2w1r4 && t2w1lwt1 < t2w1l4 && t2w1lwt1 < t2h1u4 && t2w1lwt1 < t2h1d4 && t2w1lwt1 <t2w1rwt4 && t2w1lwt1 <t2w1lwt4 && t2w1lwt1 < t2h1uwt4 && t2w1lwt1 < t2h1dwt4
  && t2w1lwt1 < t2w1r5 && t2w1lwt1 < t2w1l5 && t2w1lwt1 < t2h1u5 && t2w1lwt1 < t2h1d5 && t2w1lwt1 <t2w1rwt5 && t2w1lwt1 <t2w1lwt5 && t2w1lwt1 < t2h1uwt5 && t2w1lwt1 < t2h1dwt5
  && t2w1lwt1 < t2w1r6 && t2w1lwt1 < t2w1l6 && t2w1lwt1 < t2h1u6 && t2w1lwt1 < t2h1d6 && t2w1lwt1 <t2w1rwt6 && t2w1lwt1 <t2w1lwt6 && t2w1lwt1 < t2h1uwt6 && t2w1lwt1 < t2h1dwt6
  && t2w1lwt1 < t2w1r7 && t2w1lwt1 < t2w1l7 && t2w1lwt1 < t2h1u7 && t2w1lwt1 < t2h1d7 && t2w1lwt1 <t2w1rwt7 && t2w1lwt1 <t2w1lwt7 && t2w1lwt1 < t2h1uwt7 && t2w1lwt1 < t2h1dwt7
  && t2w1lwt1 < t2w1r8 && t2w1lwt1 < t2w1l8 && t2w1lwt1 < t2h1u8 && t2w1lwt1 < t2h1d8 && t2w1lwt1 <t2w1rwt8 && t2w1lwt1 <t2w1lwt8 && t2w1lwt1 < t2h1uwt8 && t2w1lwt1 < t2h1dwt8
  && t2w1lwt1 < t2w1r9 && t2w1lwt1 < t2w1l9 && t2w1lwt1 < t2h1u9 && t2w1lwt1 < t2h1d9 && t2w1lwt1 <t2w1rwt9 && t2w1lwt1 <t2w1lwt9 && t2w1lwt1 < t2h1uwt9 && t2w1lwt1 < t2h1dwt9
  && t2w1lwt1 < t2w1r10 && t2w1lwt1 < t2w1l10 && t2w1lwt1 < t2h1u10 && t2w1lwt1 < t2h1d10 && t2w1lwt1 <t2w1rwt10 && t2w1lwt1 <t2w1lwt10 && t2w1lwt1 < t2h1uwt10 && t2w1lwt1 < t2h1dwt10
  &&  (loutwl1==0 && linwl1==0)){
  if(linhd1==0 && louthd1==0)
   {
      ylimitd=(-h2d1+h1d1)/l*(vz*t2w1lwt1+z)-h1dwt1;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ylimitd=-bhdwt1*sqrt(1-((z0hd1+(vz*t2w1lwt1+z))*(z0hd1+(vz*t2w1lwt1+z)))/a2hdwt1);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt1+z)-pbhdwt1)/-pahdwt1);
      }
   }
   if(linhu1==0 && louthu1==0)
    {
     ylimitu=(h2u1-h1u1)/l*(vz*t2w1lwt1+z)+h1uwt1;
    }else{
     if(linhu1!=0 && louthu1!=0)
     {
     ylimitu=bhuwt1*sqrt(1-((z0hu1+(vz*t2w1lwt1+z))*(z0hu1+(vz*t2w1lwt1+z)))/a2huwt1);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt1+z)-pbhuwt1)/-pahuwt1);
    }
    }
  ytest=vy*t2w1lwt1+y; 
  xtest=vx*t2w1lwt1+x;
  xlimitl=(w2l1-w1l1)*(vz*t2w1lwt1+z)/l+w1lwt1;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW1>0){
  i=67;
  }else{
  i=75;
  }
  }


  if (myuOW1!=-1 && t2h1uwt1 > 0 && t2h1uwt1 < t1 
  && t2h1uwt1 < t2w1r && t2h1uwt1 < t2w1l && t2h1uwt1 < t2h1u && t2h1uwt1 < t2h1d && t2h1uwt1 < t2w1rwt && t2h1uwt1 < t2w1lwt && t2h1uwt1 < t2h1uwt && t2h1uwt1 < t2h1dwt 
  && t2h1uwt1 < t2w1r1 && t2h1uwt1 < t2w1l1 && t2h1uwt1 < t2h1u1 && t2h1uwt1 < t2h1d1 && t2h1uwt1 < t2w1rwt1 && t2h1uwt1 < t2w1lwt1 && t2h1uwt1 < t2h1dwt1
  && t2h1uwt1 < t2w1r2 && t2h1uwt1 < t2w1l2 && t2h1uwt1 < t2h1u2 && t2h1uwt1 < t2h1d2 && t2h1uwt1 < t2w1rwt2 && t2h1uwt1 < t2w1lwt2 && t2h1uwt1 < t2h1uwt2 && t2h1uwt1 < t2h1dwt2
  && t2h1uwt1 < t2w1r3 && t2h1uwt1 < t2w1l3 && t2h1uwt1 < t2h1u3 && t2h1uwt1 < t2h1d3 && t2h1uwt1 < t2w1rwt3 && t2h1uwt1 < t2w1lwt3 && t2h1uwt1 < t2h1uwt3 && t2h1uwt1 < t2h1dwt3
  && t2h1uwt1 < t2w1r4 && t2h1uwt1 < t2w1l4 && t2h1uwt1 < t2h1u4 && t2h1uwt1 < t2h1d4 && t2h1uwt1 < t2w1rwt4 && t2h1uwt1 < t2w1lwt4 && t2h1uwt1 < t2h1uwt4 && t2h1uwt1 < t2h1dwt4
  && t2h1uwt1 < t2w1r5 && t2h1uwt1 < t2w1l5 && t2h1uwt1 < t2h1u5 && t2h1uwt1 < t2h1d5 && t2h1uwt1 < t2w1rwt5 && t2h1uwt1 < t2w1lwt5 && t2h1uwt1 < t2h1uwt5 && t2h1uwt1 < t2h1dwt5
  && t2h1uwt1 < t2w1r6 && t2h1uwt1 < t2w1l6 && t2h1uwt1 < t2h1u6 && t2h1uwt1 < t2h1d6 && t2h1uwt1 < t2w1rwt6 && t2h1uwt1 < t2w1lwt6 && t2h1uwt1 < t2h1uwt6 && t2h1uwt1 < t2h1dwt6
  && t2h1uwt1 < t2w1r7 && t2h1uwt1 < t2w1l7 && t2h1uwt1 < t2h1u7 && t2h1uwt1 < t2h1d7 && t2h1uwt1 < t2w1rwt7 && t2h1uwt1 < t2w1lwt7 && t2h1uwt1 < t2h1uwt7 && t2h1uwt1 < t2h1dwt7
  && t2h1uwt1 < t2w1r8 && t2h1uwt1 < t2w1l8 && t2h1uwt1 < t2h1u8 && t2h1uwt1 < t2h1d8 && t2h1uwt1 < t2w1rwt8 && t2h1uwt1 < t2w1lwt8 && t2h1uwt1 < t2h1uwt8 && t2h1uwt1 < t2h1dwt8
  && t2h1uwt1 < t2w1r9 && t2h1uwt1 < t2w1l9 && t2h1uwt1 < t2h1u9 && t2h1uwt1 < t2h1d9 && t2h1uwt1 < t2w1rwt9 && t2h1uwt1 < t2w1lwt9 && t2h1uwt1 < t2h1uwt9 && t2h1uwt1 < t2h1dwt9
  && t2h1uwt1 < t2w1r10 && t2h1uwt1 < t2w1l10 && t2h1uwt1 < t2h1u10 && t2h1uwt1 < t2h1d10 && t2h1uwt1 < t2w1rwt10 && t2h1uwt1 < t2w1lwt10 && t2h1uwt1 < t2h1uwt10 && t2h1uwt1 < t2h1dwt10
  && (louthu1 !=0 && linhu1!=0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1uwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1uwt1+z))*(z0wr1+(vz*t2h1uwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1uwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1uwt1+z))*(z0wl1+(vz*t2h1uwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1uwt1+x;
  ytest=vy*t2w1lwt1+y;
  ylimitu=bhuwt1*sqrt(1-((vz*t2h1uwt1+z)+z0hu1)*((vz*t2h1uwt1+z)+z0hu1)/a2huwt1);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW1>0 ){
  i=68;
  }else{
  i=76;
  }
  }


  if (myuOW1!=-1 && t2h1uwt1 > 0 && t2h1uwt1 < t1 
  && t2h1uwt1 < t2w1r && t2h1uwt1 < t2w1l && t2h1uwt1 < t2h1u && t2h1uwt1 < t2h1d && t2h1uwt1 < t2w1rwt && t2h1uwt1 < t2w1lwt && t2h1uwt1 < t2h1uwt && t2h1uwt1 < t2h1dwt 
  && t2h1uwt1 < t2w1r1 && t2h1uwt1 < t2w1l1 && t2h1uwt1 < t2h1u1 && t2h1uwt1 < t2h1d1 && t2h1uwt1 < t2w1rwt1 && t2h1uwt1 < t2w1lwt1 && t2h1uwt1 < t2h1dwt1
  && t2h1uwt1 < t2w1r2 && t2h1uwt1 < t2w1l2 && t2h1uwt1 < t2h1u2 && t2h1uwt1 < t2h1d2 && t2h1uwt1 < t2w1rwt2 && t2h1uwt1 < t2w1lwt2 && t2h1uwt1 < t2h1uwt2 && t2h1uwt1 < t2h1dwt2
  && t2h1uwt1 < t2w1r3 && t2h1uwt1 < t2w1l3 && t2h1uwt1 < t2h1u3 && t2h1uwt1 < t2h1d3 && t2h1uwt1 < t2w1rwt3 && t2h1uwt1 < t2w1lwt3 && t2h1uwt1 < t2h1uwt3 && t2h1uwt1 < t2h1dwt3
  && t2h1uwt1 < t2w1r4 && t2h1uwt1 < t2w1l4 && t2h1uwt1 < t2h1u4 && t2h1uwt1 < t2h1d4 && t2h1uwt1 < t2w1rwt4 && t2h1uwt1 < t2w1lwt4 && t2h1uwt1 < t2h1uwt4 && t2h1uwt1 < t2h1dwt4
  && t2h1uwt1 < t2w1r5 && t2h1uwt1 < t2w1l5 && t2h1uwt1 < t2h1u5 && t2h1uwt1 < t2h1d5 && t2h1uwt1 < t2w1rwt5 && t2h1uwt1 < t2w1lwt5 && t2h1uwt1 < t2h1uwt5 && t2h1uwt1 < t2h1dwt5
  && t2h1uwt1 < t2w1r6 && t2h1uwt1 < t2w1l6 && t2h1uwt1 < t2h1u6 && t2h1uwt1 < t2h1d6 && t2h1uwt1 < t2w1rwt6 && t2h1uwt1 < t2w1lwt6 && t2h1uwt1 < t2h1uwt6 && t2h1uwt1 < t2h1dwt6
  && t2h1uwt1 < t2w1r7 && t2h1uwt1 < t2w1l7 && t2h1uwt1 < t2h1u7 && t2h1uwt1 < t2h1d7 && t2h1uwt1 < t2w1rwt7 && t2h1uwt1 < t2w1lwt7 && t2h1uwt1 < t2h1uwt7 && t2h1uwt1 < t2h1dwt7
  && t2h1uwt1 < t2w1r8 && t2h1uwt1 < t2w1l8 && t2h1uwt1 < t2h1u8 && t2h1uwt1 < t2h1d8 && t2h1uwt1 < t2w1rwt8 && t2h1uwt1 < t2w1lwt8 && t2h1uwt1 < t2h1uwt8 && t2h1uwt1 < t2h1dwt8
  && t2h1uwt1 < t2w1r9 && t2h1uwt1 < t2w1l9 && t2h1uwt1 < t2h1u9 && t2h1uwt1 < t2h1d9 && t2h1uwt1 < t2w1rwt9 && t2h1uwt1 < t2w1lwt9 && t2h1uwt1 < t2h1uwt9 && t2h1uwt1 < t2h1dwt9
  && t2h1uwt1 < t2w1r10 && t2h1uwt1 < t2w1l10 && t2h1uwt1 < t2h1u10 && t2h1uwt1 < t2h1d10 && t2h1uwt1 < t2w1rwt10 && t2h1uwt1 < t2w1lwt10 && t2h1uwt1 < t2h1uwt10 && t2h1uwt1 < t2h1dwt10
  &&((louthu1!=0 && linhu1==0) || (louthu1==0 && linhu1!=0))){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1uwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1uwt1+z))*(z0wr1+(vz*t2h1uwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1uwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1uwt1+z))*(z0wl1+(vz*t2h1uwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1uwt1+x;
  ytest=vy*t2w1lwt1+y;
  ylimitu=sqrt((pbhuwt1-(vz*t2h1uwt1+z))/pahuwt1);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW1>0){
  i=69;
  }else{
  i=76;
  }
  }


  if (myuOW1!=-1 && t2h1uwt1 > 0 && t2h1uwt1 < t1 
  && t2h1uwt1 < t2w1r && t2h1uwt1 < t2w1l && t2h1uwt1 < t2h1u && t2h1uwt1 < t2h1d && t2h1uwt1 < t2w1rwt && t2h1uwt1 < t2w1lwt && t2h1uwt1 < t2h1uwt && t2h1uwt1 < t2h1dwt 
  && t2h1uwt1 < t2w1r1 && t2h1uwt1 < t2w1l1 && t2h1uwt1 < t2h1u1 && t2h1uwt1 < t2h1d1 && t2h1uwt1 < t2w1rwt1 && t2h1uwt1 < t2w1lwt1 && t2h1uwt1 < t2h1dwt1
  && t2h1uwt1 < t2w1r2 && t2h1uwt1 < t2w1l2 && t2h1uwt1 < t2h1u2 && t2h1uwt1 < t2h1d2 && t2h1uwt1 < t2w1rwt2 && t2h1uwt1 < t2w1lwt2 && t2h1uwt1 < t2h1uwt2 && t2h1uwt1 < t2h1dwt2
  && t2h1uwt1 < t2w1r3 && t2h1uwt1 < t2w1l3 && t2h1uwt1 < t2h1u3 && t2h1uwt1 < t2h1d3 && t2h1uwt1 < t2w1rwt3 && t2h1uwt1 < t2w1lwt3 && t2h1uwt1 < t2h1uwt3 && t2h1uwt1 < t2h1dwt3
  && t2h1uwt1 < t2w1r4 && t2h1uwt1 < t2w1l4 && t2h1uwt1 < t2h1u4 && t2h1uwt1 < t2h1d4 && t2h1uwt1 < t2w1rwt4 && t2h1uwt1 < t2w1lwt4 && t2h1uwt1 < t2h1uwt4 && t2h1uwt1 < t2h1dwt4
  && t2h1uwt1 < t2w1r5 && t2h1uwt1 < t2w1l5 && t2h1uwt1 < t2h1u5 && t2h1uwt1 < t2h1d5 && t2h1uwt1 < t2w1rwt5 && t2h1uwt1 < t2w1lwt5 && t2h1uwt1 < t2h1uwt5 && t2h1uwt1 < t2h1dwt5
  && t2h1uwt1 < t2w1r6 && t2h1uwt1 < t2w1l6 && t2h1uwt1 < t2h1u6 && t2h1uwt1 < t2h1d6 && t2h1uwt1 < t2w1rwt6 && t2h1uwt1 < t2w1lwt6 && t2h1uwt1 < t2h1uwt6 && t2h1uwt1 < t2h1dwt6
  && t2h1uwt1 < t2w1r7 && t2h1uwt1 < t2w1l7 && t2h1uwt1 < t2h1u7 && t2h1uwt1 < t2h1d7 && t2h1uwt1 < t2w1rwt7 && t2h1uwt1 < t2w1lwt7 && t2h1uwt1 < t2h1uwt7 && t2h1uwt1 < t2h1dwt7
  && t2h1uwt1 < t2w1r8 && t2h1uwt1 < t2w1l8 && t2h1uwt1 < t2h1u8 && t2h1uwt1 < t2h1d8 && t2h1uwt1 < t2w1rwt8 && t2h1uwt1 < t2w1lwt8 && t2h1uwt1 < t2h1uwt8 && t2h1uwt1 < t2h1dwt8
  && t2h1uwt1 < t2w1r9 && t2h1uwt1 < t2w1l9 && t2h1uwt1 < t2h1u9 && t2h1uwt1 < t2h1d9 && t2h1uwt1 < t2w1rwt9 && t2h1uwt1 < t2w1lwt9 && t2h1uwt1 < t2h1uwt9 && t2h1uwt1 < t2h1dwt9
  && t2h1uwt1 < t2w1r10 && t2h1uwt1 < t2w1l10 && t2h1uwt1 < t2h1u10 && t2h1uwt1 < t2h1d10 && t2h1uwt1 < t2w1rwt10 && t2h1uwt1 < t2w1lwt10 && t2h1uwt1 < t2h1uwt10 && t2h1uwt1 < t2h1dwt10
  && (louthu1 == 0 && linhu1 == 0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1uwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1uwt1+z))*(z0wr1+(vz*t2h1uwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1uwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1uwt1+z))*(z0wl1+(vz*t2h1uwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1uwt1+x;
  ytest=vy*t2w1lwt1+y;
  ylimitu=(h2u1-h1u1)*(vz*t2h1uwt1+z)/l+h1uwt1;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW1>0 ){
  i=70;
  }else{
  i=76;
  }
  }


  if (mydOW1!=-1 && t2h1dwt1 > 0 && t2h1dwt1 < t1 
  && t2h1dwt1 < t2w1r && t2h1dwt1 < t2w1l && t2h1dwt1 < t2h1u && t2h1dwt1 < t2h1d && t2h1dwt1 < t2w1rwt && t2h1dwt1 < t2w1lwt && t2h1dwt1 < t2h1uwt && t2h1dwt1 < t2h1dwt 
  && t2h1dwt1 < t2w1r1 && t2h1dwt1 < t2w1l1 && t2h1dwt1 < t2h1u1 && t2h1dwt1 < t2h1d1 && t2h1dwt1 < t2w1rwt1 && t2h1dwt1 < t2w1lwt1 && t2h1dwt1 < t2h1uwt1 
  && t2h1dwt1 < t2w1r2 && t2h1dwt1 < t2w1l2 && t2h1dwt1 < t2h1u2 && t2h1dwt1 < t2h1d2 && t2h1dwt1 < t2w1rwt2 && t2h1dwt1 < t2w1lwt2 && t2h1dwt1 < t2h1uwt2 && t2h1dwt1 < t2h1dwt2 
  && t2h1dwt1 < t2w1r3 && t2h1dwt1 < t2w1l3 && t2h1dwt1 < t2h1u3 && t2h1dwt1 < t2h1d3 && t2h1dwt1 < t2w1rwt3 && t2h1dwt1 < t2w1lwt3 && t2h1dwt1 < t2h1uwt3 && t2h1dwt1 < t2h1dwt3
  && t2h1dwt1 < t2w1r4 && t2h1dwt1 < t2w1l4 && t2h1dwt1 < t2h1u4 && t2h1dwt1 < t2h1d4 && t2h1dwt1 < t2w1rwt4 && t2h1dwt1 < t2w1lwt4 && t2h1dwt1 < t2h1uwt4 && t2h1dwt1 < t2h1dwt4
  && t2h1dwt1 < t2w1r5 && t2h1dwt1 < t2w1l5 && t2h1dwt1 < t2h1u5 && t2h1dwt1 < t2h1d5 && t2h1dwt1 < t2w1rwt5 && t2h1dwt1 < t2w1lwt5 && t2h1dwt1 < t2h1uwt5 && t2h1dwt1 < t2h1dwt5
  && t2h1dwt1 < t2w1r6 && t2h1dwt1 < t2w1l6 && t2h1dwt1 < t2h1u6 && t2h1dwt1 < t2h1d6 && t2h1dwt1 < t2w1rwt6 && t2h1dwt1 < t2w1lwt6 && t2h1dwt1 < t2h1uwt6 && t2h1dwt1 < t2h1dwt6
  && t2h1dwt1 < t2w1r7 && t2h1dwt1 < t2w1l7 && t2h1dwt1 < t2h1u7 && t2h1dwt1 < t2h1d7 && t2h1dwt1 < t2w1rwt7 && t2h1dwt1 < t2w1lwt7 && t2h1dwt1 < t2h1uwt7 && t2h1dwt1 < t2h1dwt7 
  && t2h1dwt1 < t2w1r8 && t2h1dwt1 < t2w1l8 && t2h1dwt1 < t2h1u8 && t2h1dwt1 < t2h1d8 && t2h1dwt1 < t2w1rwt8 && t2h1dwt1 < t2w1lwt8 && t2h1dwt1 < t2h1uwt8 && t2h1dwt1 < t2h1dwt8
  && t2h1dwt1 < t2w1r9 && t2h1dwt1 < t2w1l9 && t2h1dwt1 < t2h1u9 && t2h1dwt1 < t2h1d9 && t2h1dwt1 < t2w1rwt9 && t2h1dwt1 < t2w1lwt9 && t2h1dwt1 < t2h1uwt9 && t2h1dwt1 < t2h1dwt9 
  && t2h1dwt1 < t2w1r10 && t2h1dwt1 < t2w1l10 && t2h1dwt1 < t2h1u10 && t2h1dwt1 < t2h1d10 && t2h1dwt1 < t2w1rwt10 && t2h1dwt1 < t2w1lwt10 && t2h1dwt1 < t2h1uwt10 && t2h1dwt1 < t2h1dwt10
  && (louthd1 !=0 && linhd1!=0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1dwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1dwt1+z))*(z0wr1+(vz*t2h1dwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1dwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1dwt1+z))*(z0wl1+(vz*t2h1dwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1dwt1+x;
  ytest=vy*t2w1lwt1+y;
  ylimitd=-bhdwt1*sqrt(1-((vz*t2h1dwt1+z)+z0hd1)*((vz*t2h1dwt1+z)+z0hd1)/a2hdwt1);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW1>0){
  i=71;
  }else{
  i=77;
  }
  }


  if (mydOW1!=-1 && t2h1dwt1 > 0 && t2h1dwt1 < t1 
  && t2h1dwt1 < t2w1r && t2h1dwt1 < t2w1l && t2h1dwt1 < t2h1u && t2h1dwt1 < t2h1d && t2h1dwt1 < t2w1rwt && t2h1dwt1 < t2w1lwt && t2h1dwt1 < t2h1uwt && t2h1dwt1 < t2h1dwt 
  && t2h1dwt1 < t2w1r1 && t2h1dwt1 < t2w1l1 && t2h1dwt1 < t2h1u1 && t2h1dwt1 < t2h1d1 && t2h1dwt1 < t2w1rwt1 && t2h1dwt1 < t2w1lwt1 && t2h1dwt1 < t2h1uwt1 
  && t2h1dwt1 < t2w1r2 && t2h1dwt1 < t2w1l2 && t2h1dwt1 < t2h1u2 && t2h1dwt1 < t2h1d2 && t2h1dwt1 < t2w1rwt2 && t2h1dwt1 < t2w1lwt2 && t2h1dwt1 < t2h1uwt2 && t2h1dwt1 < t2h1dwt2 
  && t2h1dwt1 < t2w1r3 && t2h1dwt1 < t2w1l3 && t2h1dwt1 < t2h1u3 && t2h1dwt1 < t2h1d3 && t2h1dwt1 < t2w1rwt3 && t2h1dwt1 < t2w1lwt3 && t2h1dwt1 < t2h1uwt3 && t2h1dwt1 < t2h1dwt3
  && t2h1dwt1 < t2w1r4 && t2h1dwt1 < t2w1l4 && t2h1dwt1 < t2h1u4 && t2h1dwt1 < t2h1d4 && t2h1dwt1 < t2w1rwt4 && t2h1dwt1 < t2w1lwt4 && t2h1dwt1 < t2h1uwt4 && t2h1dwt1 < t2h1dwt4
  && t2h1dwt1 < t2w1r5 && t2h1dwt1 < t2w1l5 && t2h1dwt1 < t2h1u5 && t2h1dwt1 < t2h1d5 && t2h1dwt1 < t2w1rwt5 && t2h1dwt1 < t2w1lwt5 && t2h1dwt1 < t2h1uwt5 && t2h1dwt1 < t2h1dwt5
  && t2h1dwt1 < t2w1r6 && t2h1dwt1 < t2w1l6 && t2h1dwt1 < t2h1u6 && t2h1dwt1 < t2h1d6 && t2h1dwt1 < t2w1rwt6 && t2h1dwt1 < t2w1lwt6 && t2h1dwt1 < t2h1uwt6 && t2h1dwt1 < t2h1dwt6
  && t2h1dwt1 < t2w1r7 && t2h1dwt1 < t2w1l7 && t2h1dwt1 < t2h1u7 && t2h1dwt1 < t2h1d7 && t2h1dwt1 < t2w1rwt7 && t2h1dwt1 < t2w1lwt7 && t2h1dwt1 < t2h1uwt7 && t2h1dwt1 < t2h1dwt7 
  && t2h1dwt1 < t2w1r8 && t2h1dwt1 < t2w1l8 && t2h1dwt1 < t2h1u8 && t2h1dwt1 < t2h1d8 && t2h1dwt1 < t2w1rwt8 && t2h1dwt1 < t2w1lwt8 && t2h1dwt1 < t2h1uwt8 && t2h1dwt1 < t2h1dwt8
  && t2h1dwt1 < t2w1r9 && t2h1dwt1 < t2w1l9 && t2h1dwt1 < t2h1u9 && t2h1dwt1 < t2h1d9 && t2h1dwt1 < t2w1rwt9 && t2h1dwt1 < t2w1lwt9 && t2h1dwt1 < t2h1uwt9 && t2h1dwt1 < t2h1dwt9 
  && t2h1dwt1 < t2w1r10 && t2h1dwt1 < t2w1l10 && t2h1dwt1 < t2h1u10 && t2h1dwt1 < t2h1d10 && t2h1dwt1 < t2w1rwt10 && t2h1dwt1 < t2w1lwt10 && t2h1dwt1 < t2h1uwt10 && t2h1dwt1 < t2h1dwt10
  && ((louthd1 !=0 && linhd1==0) || (louthd1 ==0 && linhd1!=0))){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1dwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1dwt1+z))*(z0wr1+(vz*t2h1dwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
     xlimitl=(w2l1-w1l1)/l*(vz*t2h1dwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1dwt1+z))*(z0wl1+(vz*t2h1dwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1dwt1+x;
  ytest=vy*t2w1lwt1+y;
  ylimitd=-sqrt((pbhdwt1-(vz*t2h1dwt1+z))/pahdwt1);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW1>0 ){
  i=72;
  }else{
  i=77;
  }
  }


  if (mydOW1!=-1 && t2h1dwt1 > 0 && t2h1dwt1 < t1 
  && t2h1dwt1 < t2w1r && t2h1dwt1 < t2w1l && t2h1dwt1 < t2h1u && t2h1dwt1 < t2h1d && t2h1dwt1 < t2w1rwt && t2h1dwt1 < t2w1lwt && t2h1dwt1 < t2h1uwt && t2h1dwt1 < t2h1dwt 
  && t2h1dwt1 < t2w1r1 && t2h1dwt1 < t2w1l1 && t2h1dwt1 < t2h1u1 && t2h1dwt1 < t2h1d1 && t2h1dwt1 < t2w1rwt1 && t2h1dwt1 < t2w1lwt1 && t2h1dwt1 < t2h1uwt1 
  && t2h1dwt1 < t2w1r2 && t2h1dwt1 < t2w1l2 && t2h1dwt1 < t2h1u2 && t2h1dwt1 < t2h1d2 && t2h1dwt1 < t2w1rwt2 && t2h1dwt1 < t2w1lwt2 && t2h1dwt1 < t2h1uwt2 && t2h1dwt1 < t2h1dwt2 
  && t2h1dwt1 < t2w1r3 && t2h1dwt1 < t2w1l3 && t2h1dwt1 < t2h1u3 && t2h1dwt1 < t2h1d3 && t2h1dwt1 < t2w1rwt3 && t2h1dwt1 < t2w1lwt3 && t2h1dwt1 < t2h1uwt3 && t2h1dwt1 < t2h1dwt3
  && t2h1dwt1 < t2w1r4 && t2h1dwt1 < t2w1l4 && t2h1dwt1 < t2h1u4 && t2h1dwt1 < t2h1d4 && t2h1dwt1 < t2w1rwt4 && t2h1dwt1 < t2w1lwt4 && t2h1dwt1 < t2h1uwt4 && t2h1dwt1 < t2h1dwt4
  && t2h1dwt1 < t2w1r5 && t2h1dwt1 < t2w1l5 && t2h1dwt1 < t2h1u5 && t2h1dwt1 < t2h1d5 && t2h1dwt1 < t2w1rwt5 && t2h1dwt1 < t2w1lwt5 && t2h1dwt1 < t2h1uwt5 && t2h1dwt1 < t2h1dwt5
  && t2h1dwt1 < t2w1r6 && t2h1dwt1 < t2w1l6 && t2h1dwt1 < t2h1u6 && t2h1dwt1 < t2h1d6 && t2h1dwt1 < t2w1rwt6 && t2h1dwt1 < t2w1lwt6 && t2h1dwt1 < t2h1uwt6 && t2h1dwt1 < t2h1dwt6
  && t2h1dwt1 < t2w1r7 && t2h1dwt1 < t2w1l7 && t2h1dwt1 < t2h1u7 && t2h1dwt1 < t2h1d7 && t2h1dwt1 < t2w1rwt7 && t2h1dwt1 < t2w1lwt7 && t2h1dwt1 < t2h1uwt7 && t2h1dwt1 < t2h1dwt7 
  && t2h1dwt1 < t2w1r8 && t2h1dwt1 < t2w1l8 && t2h1dwt1 < t2h1u8 && t2h1dwt1 < t2h1d8 && t2h1dwt1 < t2w1rwt8 && t2h1dwt1 < t2w1lwt8 && t2h1dwt1 < t2h1uwt8 && t2h1dwt1 < t2h1dwt8
  && t2h1dwt1 < t2w1r9 && t2h1dwt1 < t2w1l9 && t2h1dwt1 < t2h1u9 && t2h1dwt1 < t2h1d9 && t2h1dwt1 < t2w1rwt9 && t2h1dwt1 < t2w1lwt9 && t2h1dwt1 < t2h1uwt9 && t2h1dwt1 < t2h1dwt9 
  && t2h1dwt1 < t2w1r10 && t2h1dwt1 < t2w1l10 && t2h1dwt1 < t2h1u10 && t2h1dwt1 < t2h1d10 && t2h1dwt1 < t2w1rwt10 && t2h1dwt1 < t2w1lwt10 && t2h1dwt1 < t2h1uwt10 && t2h1dwt1 < t2h1dwt10
  && (louthd1 == 0 && linhd1 == 0)){
  if(linwr1==0 && loutwr1==0)
  {
    xlimitr=(-w2r1+w1r1)/l*(vz*t2h1dwt1+z)-w1rwt1;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xlimitr=-bwrwt1*sqrt(1-((z0wr1+(vz*t2h1dwt1+z))*(z0wr1+(vz*t2h1dwt1+z)))/a2wrwt1);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt1+z)-pbwrwt1)/-pawrwt1);
    }
  }
  if(linwl1==0 && loutwl1 == 0)
   {
      xlimitl=(w2l1-w1l1)/l*(vz*t2h1dwt1+z)+w1lwt1;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xlimitl=bwlwt1*sqrt(1-((z0wl1+(vz*t2h1dwt1+z))*(z0wl1+(vz*t2h1dwt1+z)))/a2wlwt1);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt1+z)-pbwlwt1)/-pawlwt1);
      }
   }
  xtest=vx*t2h1dwt1+x;
  ytest=vy*t2w1lwt1+y;
  ylimitd=(-h2d1+h1d1)*(vz*t2h1dwt1+z)/l-h1dwt1;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW1>0 ){
  i=73;
  }else{
  i=77;
  }
  }

if (mxrOW1==-1 && t2w1rwt1 > 0 && t2w1rwt1 < t1 
  && t2w1rwt1 < t2w1r && t2w1rwt1 < t2w1l && t2w1rwt1 < t2h1u && t2w1rwt1 < t2h1d && t2w1rwt1 <t2w1rwt && t2w1rwt1 <t2w1lwt && t2w1rwt1 < t2h1uwt && t2w1rwt1 < t2h1dwt
  && t2w1rwt1 < t2w1r1 && t2w1rwt1 < t2w1l1 && t2w1rwt1 < t2h1u1 && t2w1rwt1 < t2h1d1 && t2w1rwt1 <t2w1lwt1 && t2w1rwt1 < t2h1uwt1 && t2w1rwt1 < t2h1dwt1
  && t2w1rwt1 < t2w1r2 && t2w1rwt1 < t2w1l2 && t2w1rwt1 < t2h1u2 && t2w1rwt1 < t2h1d2 && t2w1rwt1 <t2w1rwt2 && t2w1rwt1 <t2w1lwt2 && t2w1rwt1 < t2h1uwt2 && t2w1rwt1 < t2h1dwt2
  && t2w1rwt1 < t2w1r3 && t2w1rwt1 < t2w1l3 && t2w1rwt1 < t2h1u3 && t2w1rwt1 < t2h1d3 && t2w1rwt1 <t2w1rwt3 && t2w1rwt1 <t2w1lwt3 && t2w1rwt1 < t2h1uwt3 && t2w1rwt1 < t2h1dwt3
  && t2w1rwt1 < t2w1r4 && t2w1rwt1 < t2w1l4 && t2w1rwt1 < t2h1u4 && t2w1rwt1 < t2h1d4 && t2w1rwt1 <t2w1rwt4 && t2w1rwt1 <t2w1lwt4 && t2w1rwt1 < t2h1uwt4 && t2w1rwt1 < t2h1dwt4
  && t2w1rwt1 < t2w1r5 && t2w1rwt1 < t2w1l5 && t2w1rwt1 < t2h1u5 && t2w1rwt1 < t2h1d5 && t2w1rwt1 <t2w1rwt5 && t2w1rwt1 <t2w1lwt5 && t2w1rwt1 < t2h1uwt5 && t2w1rwt1 < t2h1dwt5
  && t2w1rwt1 < t2w1r6 && t2w1rwt1 < t2w1l6 && t2w1rwt1 < t2h1u6 && t2w1rwt1 < t2h1d6 && t2w1rwt1 <t2w1rwt6 && t2w1rwt1 <t2w1lwt6 && t2w1rwt1 < t2h1uwt6 && t2w1rwt1 < t2h1dwt6
  && t2w1rwt1 < t2w1r7 && t2w1rwt1 < t2w1l7 && t2w1rwt1 < t2h1u7 && t2w1rwt1 < t2h1d7 && t2w1rwt1 <t2w1rwt7 && t2w1rwt1 <t2w1lwt7 && t2w1rwt1 < t2h1uwt7 && t2w1rwt1 < t2h1dwt7
  && t2w1rwt1 < t2w1r8 && t2w1rwt1 < t2w1l8 && t2w1rwt1 < t2h1u8 && t2w1rwt1 < t2h1d8 && t2w1rwt1 <t2w1rwt8 && t2w1rwt1 <t2w1lwt8 && t2w1rwt1 < t2h1uwt8 && t2w1rwt1 < t2h1dwt8
  && t2w1rwt1 < t2w1r9 && t2w1rwt1 < t2w1l9 && t2w1rwt1 < t2h1u9 && t2w1rwt1 < t2h1d9 && t2w1rwt1 <t2w1rwt9 && t2w1rwt1 <t2w1lwt9 && t2w1rwt1 < t2h1uwt9 && t2w1rwt1 < t2h1dwt9
  && t2w1rwt1 < t2w1r10 && t2w1rwt1 < t2w1l10 && t2w1rwt1 < t2h1u10 && t2w1rwt1 < t2h1d10 && t2w1rwt1 <t2w1rwt10 && t2w1rwt1 <t2w1lwt10 && t2w1rwt1 < t2h1uwt10 && t2w1rwt1 < t2h1dwt10
  && ((linwr1!=0) && (loutwr1!=0) )) {
  i=78;
  }

  if (mxrOW1==-1 && t2w1rwt1 > 0 && t2w1rwt1 < t1 
  && t2w1rwt1 < t2w1r && t2w1rwt1 < t2w1l && t2w1rwt1 < t2h1u && t2w1rwt1 < t2h1d && t2w1rwt1 <t2w1rwt && t2w1rwt1 <t2w1lwt && t2w1rwt1 < t2h1uwt && t2w1rwt1 < t2h1dwt
  && t2w1rwt1 < t2w1r1 && t2w1rwt1 < t2w1l1 && t2w1rwt1 < t2h1u1 && t2w1rwt1 < t2h1d1 && t2w1rwt1 <t2w1lwt1 && t2w1rwt1 < t2h1uwt1 && t2w1rwt1 < t2h1dwt1
  && t2w1rwt1 < t2w1r2 && t2w1rwt1 < t2w1l2 && t2w1rwt1 < t2h1u2 && t2w1rwt1 < t2h1d2 && t2w1rwt1 <t2w1rwt2 && t2w1rwt1 <t2w1lwt2 && t2w1rwt1 < t2h1uwt2 && t2w1rwt1 < t2h1dwt2
  && t2w1rwt1 < t2w1r3 && t2w1rwt1 < t2w1l3 && t2w1rwt1 < t2h1u3 && t2w1rwt1 < t2h1d3 && t2w1rwt1 <t2w1rwt3 && t2w1rwt1 <t2w1lwt3 && t2w1rwt1 < t2h1uwt3 && t2w1rwt1 < t2h1dwt3
  && t2w1rwt1 < t2w1r4 && t2w1rwt1 < t2w1l4 && t2w1rwt1 < t2h1u4 && t2w1rwt1 < t2h1d4 && t2w1rwt1 <t2w1rwt4 && t2w1rwt1 <t2w1lwt4 && t2w1rwt1 < t2h1uwt4 && t2w1rwt1 < t2h1dwt4
  && t2w1rwt1 < t2w1r5 && t2w1rwt1 < t2w1l5 && t2w1rwt1 < t2h1u5 && t2w1rwt1 < t2h1d5 && t2w1rwt1 <t2w1rwt5 && t2w1rwt1 <t2w1lwt5 && t2w1rwt1 < t2h1uwt5 && t2w1rwt1 < t2h1dwt5
  && t2w1rwt1 < t2w1r6 && t2w1rwt1 < t2w1l6 && t2w1rwt1 < t2h1u6 && t2w1rwt1 < t2h1d6 && t2w1rwt1 <t2w1rwt6 && t2w1rwt1 <t2w1lwt6 && t2w1rwt1 < t2h1uwt6 && t2w1rwt1 < t2h1dwt6
  && t2w1rwt1 < t2w1r7 && t2w1rwt1 < t2w1l7 && t2w1rwt1 < t2h1u7 && t2w1rwt1 < t2h1d7 && t2w1rwt1 <t2w1rwt7 && t2w1rwt1 <t2w1lwt7 && t2w1rwt1 < t2h1uwt7 && t2w1rwt1 < t2h1dwt7
  && t2w1rwt1 < t2w1r8 && t2w1rwt1 < t2w1l8 && t2w1rwt1 < t2h1u8 && t2w1rwt1 < t2h1d8 && t2w1rwt1 <t2w1rwt8 && t2w1rwt1 <t2w1lwt8 && t2w1rwt1 < t2h1uwt8 && t2w1rwt1 < t2h1dwt8
  && t2w1rwt1 < t2w1r9 && t2w1rwt1 < t2w1l9 && t2w1rwt1 < t2h1u9 && t2w1rwt1 < t2h1d9 && t2w1rwt1 <t2w1rwt9 && t2w1rwt1 <t2w1lwt9 && t2w1rwt1 < t2h1uwt9 && t2w1rwt1 < t2h1dwt9
  && t2w1rwt1 < t2w1r10 && t2w1rwt1 < t2w1l10 && t2w1rwt1 < t2h1u10 && t2w1rwt1 < t2h1d10 && t2w1rwt1 <t2w1rwt10 && t2w1rwt1 <t2w1lwt10 && t2w1rwt1 < t2h1uwt10 && t2w1rwt1 < t2h1dwt10
  && ((loutwr1!=0 && linwr1==0) || (loutwr1==0 && linwr1!=0))){
  i=78;
  }

  if (mxrOW1==-1 && t2w1rwt1 > 0 && t2w1rwt1 < t1 
  && t2w1rwt1 < t2w1r && t2w1rwt1 < t2w1l && t2w1rwt1 < t2h1u && t2w1rwt1 < t2h1d && t2w1rwt1 <t2w1rwt && t2w1rwt1 <t2w1lwt && t2w1rwt1 < t2h1uwt && t2w1rwt1 < t2h1dwt
  && t2w1rwt1 < t2w1r1 && t2w1rwt1 < t2w1l1 && t2w1rwt1 < t2h1u1 && t2w1rwt1 < t2h1d1 && t2w1rwt1 <t2w1lwt1 && t2w1rwt1 < t2h1uwt1 && t2w1rwt1 < t2h1dwt1
  && t2w1rwt1 < t2w1r2 && t2w1rwt1 < t2w1l2 && t2w1rwt1 < t2h1u2 && t2w1rwt1 < t2h1d2 && t2w1rwt1 <t2w1rwt2 && t2w1rwt1 <t2w1lwt2 && t2w1rwt1 < t2h1uwt2 && t2w1rwt1 < t2h1dwt2
  && t2w1rwt1 < t2w1r3 && t2w1rwt1 < t2w1l3 && t2w1rwt1 < t2h1u3 && t2w1rwt1 < t2h1d3 && t2w1rwt1 <t2w1rwt3 && t2w1rwt1 <t2w1lwt3 && t2w1rwt1 < t2h1uwt3 && t2w1rwt1 < t2h1dwt3
  && t2w1rwt1 < t2w1r4 && t2w1rwt1 < t2w1l4 && t2w1rwt1 < t2h1u4 && t2w1rwt1 < t2h1d4 && t2w1rwt1 <t2w1rwt4 && t2w1rwt1 <t2w1lwt4 && t2w1rwt1 < t2h1uwt4 && t2w1rwt1 < t2h1dwt4
  && t2w1rwt1 < t2w1r5 && t2w1rwt1 < t2w1l5 && t2w1rwt1 < t2h1u5 && t2w1rwt1 < t2h1d5 && t2w1rwt1 <t2w1rwt5 && t2w1rwt1 <t2w1lwt5 && t2w1rwt1 < t2h1uwt5 && t2w1rwt1 < t2h1dwt5
  && t2w1rwt1 < t2w1r6 && t2w1rwt1 < t2w1l6 && t2w1rwt1 < t2h1u6 && t2w1rwt1 < t2h1d6 && t2w1rwt1 <t2w1rwt6 && t2w1rwt1 <t2w1lwt6 && t2w1rwt1 < t2h1uwt6 && t2w1rwt1 < t2h1dwt6
  && t2w1rwt1 < t2w1r7 && t2w1rwt1 < t2w1l7 && t2w1rwt1 < t2h1u7 && t2w1rwt1 < t2h1d7 && t2w1rwt1 <t2w1rwt7 && t2w1rwt1 <t2w1lwt7 && t2w1rwt1 < t2h1uwt7 && t2w1rwt1 < t2h1dwt7
  && t2w1rwt1 < t2w1r8 && t2w1rwt1 < t2w1l8 && t2w1rwt1 < t2h1u8 && t2w1rwt1 < t2h1d8 && t2w1rwt1 <t2w1rwt8 && t2w1rwt1 <t2w1lwt8 && t2w1rwt1 < t2h1uwt8 && t2w1rwt1 < t2h1dwt8
  && t2w1rwt1 < t2w1r9 && t2w1rwt1 < t2w1l9 && t2w1rwt1 < t2h1u9 && t2w1rwt1 < t2h1d9 && t2w1rwt1 <t2w1rwt9 && t2w1rwt1 <t2w1lwt9 && t2w1rwt1 < t2h1uwt9 && t2w1rwt1 < t2h1dwt9
  && t2w1rwt1 < t2w1r10 && t2w1rwt1 < t2w1l10 && t2w1rwt1 < t2h1u10 && t2w1rwt1 < t2h1d10 && t2w1rwt1 <t2w1rwt10 && t2w1rwt1 <t2w1lwt10 && t2w1rwt1 < t2h1uwt10 && t2w1rwt1 < t2h1dwt10
  &&  (loutwr1==0 && linwr1==0)){
  i=78;
  }

  if (mxlOW1==-1 && t2w1lwt1 > 0 && t2w1lwt1 < t1 
  && t2w1lwt1 < t2w1r && t2w1lwt1 < t2w1l && t2w1lwt1 < t2h1u && t2w1lwt1 < t2h1d && t2w1lwt1 <t2w1rwt && t2w1lwt1 <t2w1lwt && t2w1lwt1 < t2h1uwt && t2w1lwt1 < t2h1dwt
  && t2w1lwt1 < t2w1r1 && t2w1lwt1 < t2w1l1 && t2w1lwt1 < t2h1u1 && t2w1lwt1 < t2h1d1 && t2w1lwt1 <t2w1rwt1 && t2w1lwt1 < t2h1uwt1 && t2w1lwt1 < t2h1dwt1
  && t2w1lwt1 < t2w1r2 && t2w1lwt1 < t2w1l2 && t2w1lwt1 < t2h1u2 && t2w1lwt1 < t2h1d2 && t2w1lwt1 <t2w1rwt2 && t2w1lwt1 <t2w1lwt2 && t2w1lwt1 < t2h1uwt2 && t2w1lwt1 < t2h1dwt2
  && t2w1lwt1 < t2w1r3 && t2w1lwt1 < t2w1l3 && t2w1lwt1 < t2h1u3 && t2w1lwt1 < t2h1d3 && t2w1lwt1 <t2w1rwt3 && t2w1lwt1 <t2w1lwt3 && t2w1lwt1 < t2h1uwt3 && t2w1lwt1 < t2h1dwt3
  && t2w1lwt1 < t2w1r4 && t2w1lwt1 < t2w1l4 && t2w1lwt1 < t2h1u4 && t2w1lwt1 < t2h1d4 && t2w1lwt1 <t2w1rwt4 && t2w1lwt1 <t2w1lwt4 && t2w1lwt1 < t2h1uwt4 && t2w1lwt1 < t2h1dwt4
  && t2w1lwt1 < t2w1r5 && t2w1lwt1 < t2w1l5 && t2w1lwt1 < t2h1u5 && t2w1lwt1 < t2h1d5 && t2w1lwt1 <t2w1rwt5 && t2w1lwt1 <t2w1lwt5 && t2w1lwt1 < t2h1uwt5 && t2w1lwt1 < t2h1dwt5
  && t2w1lwt1 < t2w1r6 && t2w1lwt1 < t2w1l6 && t2w1lwt1 < t2h1u6 && t2w1lwt1 < t2h1d6 && t2w1lwt1 <t2w1rwt6 && t2w1lwt1 <t2w1lwt6 && t2w1lwt1 < t2h1uwt6 && t2w1lwt1 < t2h1dwt6
  && t2w1lwt1 < t2w1r7 && t2w1lwt1 < t2w1l7 && t2w1lwt1 < t2h1u7 && t2w1lwt1 < t2h1d7 && t2w1lwt1 <t2w1rwt7 && t2w1lwt1 <t2w1lwt7 && t2w1lwt1 < t2h1uwt7 && t2w1lwt1 < t2h1dwt7
  && t2w1lwt1 < t2w1r8 && t2w1lwt1 < t2w1l8 && t2w1lwt1 < t2h1u8 && t2w1lwt1 < t2h1d8 && t2w1lwt1 <t2w1rwt8 && t2w1lwt1 <t2w1lwt8 && t2w1lwt1 < t2h1uwt8 && t2w1lwt1 < t2h1dwt8
  && t2w1lwt1 < t2w1r9 && t2w1lwt1 < t2w1l9 && t2w1lwt1 < t2h1u9 && t2w1lwt1 < t2h1d9 && t2w1lwt1 <t2w1rwt9 && t2w1lwt1 <t2w1lwt9 && t2w1lwt1 < t2h1uwt9 && t2w1lwt1 < t2h1dwt9
  && t2w1lwt1 < t2w1r10 && t2w1lwt1 < t2w1l10 && t2w1lwt1 < t2h1u10 && t2w1lwt1 < t2h1d10 && t2w1lwt1 <t2w1rwt10 && t2w1lwt1 <t2w1lwt10 && t2w1lwt1 < t2h1uwt10 && t2w1lwt1 < t2h1dwt10
  &&  ((linwl1!=0) && (loutwl1!=0) )){
  i=79;
  }

  if (mxlOW1==-1 && t2w1lwt1 > 0 && t2w1lwt1 < t1 
  && t2w1lwt1 < t2w1r && t2w1lwt1 < t2w1l && t2w1lwt1 < t2h1u && t2w1lwt1 < t2h1d && t2w1lwt1 <t2w1rwt && t2w1lwt1 <t2w1lwt && t2w1lwt1 < t2h1uwt && t2w1lwt1 < t2h1dwt
  && t2w1lwt1 < t2w1r1 && t2w1lwt1 < t2w1l1 && t2w1lwt1 < t2h1u1 && t2w1lwt1 < t2h1d1 && t2w1lwt1 <t2w1rwt1 && t2w1lwt1 < t2h1uwt1 && t2w1lwt1 < t2h1dwt1
  && t2w1lwt1 < t2w1r2 && t2w1lwt1 < t2w1l2 && t2w1lwt1 < t2h1u2 && t2w1lwt1 < t2h1d2 && t2w1lwt1 <t2w1rwt2 && t2w1lwt1 <t2w1lwt2 && t2w1lwt1 < t2h1uwt2 && t2w1lwt1 < t2h1dwt2
  && t2w1lwt1 < t2w1r3 && t2w1lwt1 < t2w1l3 && t2w1lwt1 < t2h1u3 && t2w1lwt1 < t2h1d3 && t2w1lwt1 <t2w1rwt3 && t2w1lwt1 <t2w1lwt3 && t2w1lwt1 < t2h1uwt3 && t2w1lwt1 < t2h1dwt3
  && t2w1lwt1 < t2w1r4 && t2w1lwt1 < t2w1l4 && t2w1lwt1 < t2h1u4 && t2w1lwt1 < t2h1d4 && t2w1lwt1 <t2w1rwt4 && t2w1lwt1 <t2w1lwt4 && t2w1lwt1 < t2h1uwt4 && t2w1lwt1 < t2h1dwt4
  && t2w1lwt1 < t2w1r5 && t2w1lwt1 < t2w1l5 && t2w1lwt1 < t2h1u5 && t2w1lwt1 < t2h1d5 && t2w1lwt1 <t2w1rwt5 && t2w1lwt1 <t2w1lwt5 && t2w1lwt1 < t2h1uwt5 && t2w1lwt1 < t2h1dwt5
  && t2w1lwt1 < t2w1r6 && t2w1lwt1 < t2w1l6 && t2w1lwt1 < t2h1u6 && t2w1lwt1 < t2h1d6 && t2w1lwt1 <t2w1rwt6 && t2w1lwt1 <t2w1lwt6 && t2w1lwt1 < t2h1uwt6 && t2w1lwt1 < t2h1dwt6
  && t2w1lwt1 < t2w1r7 && t2w1lwt1 < t2w1l7 && t2w1lwt1 < t2h1u7 && t2w1lwt1 < t2h1d7 && t2w1lwt1 <t2w1rwt7 && t2w1lwt1 <t2w1lwt7 && t2w1lwt1 < t2h1uwt7 && t2w1lwt1 < t2h1dwt7
  && t2w1lwt1 < t2w1r8 && t2w1lwt1 < t2w1l8 && t2w1lwt1 < t2h1u8 && t2w1lwt1 < t2h1d8 && t2w1lwt1 <t2w1rwt8 && t2w1lwt1 <t2w1lwt8 && t2w1lwt1 < t2h1uwt8 && t2w1lwt1 < t2h1dwt8
  && t2w1lwt1 < t2w1r9 && t2w1lwt1 < t2w1l9 && t2w1lwt1 < t2h1u9 && t2w1lwt1 < t2h1d9 && t2w1lwt1 <t2w1rwt9 && t2w1lwt1 <t2w1lwt9 && t2w1lwt1 < t2h1uwt9 && t2w1lwt1 < t2h1dwt9
  && t2w1lwt1 < t2w1r10 && t2w1lwt1 < t2w1l10 && t2w1lwt1 < t2h1u10 && t2w1lwt1 < t2h1d10 && t2w1lwt1 <t2w1rwt10 && t2w1lwt1 <t2w1lwt10 && t2w1lwt1 < t2h1uwt10 && t2w1lwt1 < t2h1dwt10
  && ((loutwl1!=0 && linwl1==0) || (loutwl1==0 && linwl1!=0))){
  i=79;
  }

  if (mxlOW1==-1 && t2w1lwt1 > 0 && t2w1lwt1 < t1 
  && t2w1lwt1 < t2w1r && t2w1lwt1 < t2w1l && t2w1lwt1 < t2h1u && t2w1lwt1 < t2h1d && t2w1lwt1 <t2w1rwt && t2w1lwt1 <t2w1lwt && t2w1lwt1 < t2h1uwt && t2w1lwt1 < t2h1dwt
  && t2w1lwt1 < t2w1r1 && t2w1lwt1 < t2w1l1 && t2w1lwt1 < t2h1u1 && t2w1lwt1 < t2h1d1 && t2w1lwt1 <t2w1rwt1 && t2w1lwt1 < t2h1uwt1 && t2w1lwt1 < t2h1dwt1
  && t2w1lwt1 < t2w1r2 && t2w1lwt1 < t2w1l2 && t2w1lwt1 < t2h1u2 && t2w1lwt1 < t2h1d2 && t2w1lwt1 <t2w1rwt2 && t2w1lwt1 <t2w1lwt2 && t2w1lwt1 < t2h1uwt2 && t2w1lwt1 < t2h1dwt2
  && t2w1lwt1 < t2w1r3 && t2w1lwt1 < t2w1l3 && t2w1lwt1 < t2h1u3 && t2w1lwt1 < t2h1d3 && t2w1lwt1 <t2w1rwt3 && t2w1lwt1 <t2w1lwt3 && t2w1lwt1 < t2h1uwt3 && t2w1lwt1 < t2h1dwt3
  && t2w1lwt1 < t2w1r4 && t2w1lwt1 < t2w1l4 && t2w1lwt1 < t2h1u4 && t2w1lwt1 < t2h1d4 && t2w1lwt1 <t2w1rwt4 && t2w1lwt1 <t2w1lwt4 && t2w1lwt1 < t2h1uwt4 && t2w1lwt1 < t2h1dwt4
  && t2w1lwt1 < t2w1r5 && t2w1lwt1 < t2w1l5 && t2w1lwt1 < t2h1u5 && t2w1lwt1 < t2h1d5 && t2w1lwt1 <t2w1rwt5 && t2w1lwt1 <t2w1lwt5 && t2w1lwt1 < t2h1uwt5 && t2w1lwt1 < t2h1dwt5
  && t2w1lwt1 < t2w1r6 && t2w1lwt1 < t2w1l6 && t2w1lwt1 < t2h1u6 && t2w1lwt1 < t2h1d6 && t2w1lwt1 <t2w1rwt6 && t2w1lwt1 <t2w1lwt6 && t2w1lwt1 < t2h1uwt6 && t2w1lwt1 < t2h1dwt6
  && t2w1lwt1 < t2w1r7 && t2w1lwt1 < t2w1l7 && t2w1lwt1 < t2h1u7 && t2w1lwt1 < t2h1d7 && t2w1lwt1 <t2w1rwt7 && t2w1lwt1 <t2w1lwt7 && t2w1lwt1 < t2h1uwt7 && t2w1lwt1 < t2h1dwt7
  && t2w1lwt1 < t2w1r8 && t2w1lwt1 < t2w1l8 && t2w1lwt1 < t2h1u8 && t2w1lwt1 < t2h1d8 && t2w1lwt1 <t2w1rwt8 && t2w1lwt1 <t2w1lwt8 && t2w1lwt1 < t2h1uwt8 && t2w1lwt1 < t2h1dwt8
  && t2w1lwt1 < t2w1r9 && t2w1lwt1 < t2w1l9 && t2w1lwt1 < t2h1u9 && t2w1lwt1 < t2h1d9 && t2w1lwt1 <t2w1rwt9 && t2w1lwt1 <t2w1lwt9 && t2w1lwt1 < t2h1uwt9 && t2w1lwt1 < t2h1dwt9
  && t2w1lwt1 < t2w1r10 && t2w1lwt1 < t2w1l10 && t2w1lwt1 < t2h1u10 && t2w1lwt1 < t2h1d10 && t2w1lwt1 <t2w1rwt10 && t2w1lwt1 <t2w1lwt10 && t2w1lwt1 < t2h1uwt10 && t2w1lwt1 < t2h1dwt10
  && (loutwl1==0 && linwl1==0)){
  i=79;
  }

  if (myuOW1==-1 && t2h1uwt1 > 0 && t2h1uwt1 < t1 
  && t2h1uwt1 < t2w1r && t2h1uwt1 < t2w1l && t2h1uwt1 < t2h1u && t2h1uwt1 < t2h1d && t2h1uwt1 < t2w1rwt && t2h1uwt1 < t2w1lwt && t2h1uwt1 < t2h1uwt && t2h1uwt1 < t2h1dwt 
  && t2h1uwt1 < t2w1r1 && t2h1uwt1 < t2w1l1 && t2h1uwt1 < t2h1u1 && t2h1uwt1 < t2h1d1 && t2h1uwt1 < t2w1rwt1 && t2h1uwt1 < t2w1lwt1 && t2h1uwt1 < t2h1dwt1
  && t2h1uwt1 < t2w1r2 && t2h1uwt1 < t2w1l2 && t2h1uwt1 < t2h1u2 && t2h1uwt1 < t2h1d2 && t2h1uwt1 < t2w1rwt2 && t2h1uwt1 < t2w1lwt2 && t2h1uwt1 < t2h1uwt2 && t2h1uwt1 < t2h1dwt2
  && t2h1uwt1 < t2w1r3 && t2h1uwt1 < t2w1l3 && t2h1uwt1 < t2h1u3 && t2h1uwt1 < t2h1d3 && t2h1uwt1 < t2w1rwt3 && t2h1uwt1 < t2w1lwt3 && t2h1uwt1 < t2h1uwt3 && t2h1uwt1 < t2h1dwt3
  && t2h1uwt1 < t2w1r4 && t2h1uwt1 < t2w1l4 && t2h1uwt1 < t2h1u4 && t2h1uwt1 < t2h1d4 && t2h1uwt1 < t2w1rwt4 && t2h1uwt1 < t2w1lwt4 && t2h1uwt1 < t2h1uwt4 && t2h1uwt1 < t2h1dwt4
  && t2h1uwt1 < t2w1r5 && t2h1uwt1 < t2w1l5 && t2h1uwt1 < t2h1u5 && t2h1uwt1 < t2h1d5 && t2h1uwt1 < t2w1rwt5 && t2h1uwt1 < t2w1lwt5 && t2h1uwt1 < t2h1uwt5 && t2h1uwt1 < t2h1dwt5
  && t2h1uwt1 < t2w1r6 && t2h1uwt1 < t2w1l6 && t2h1uwt1 < t2h1u6 && t2h1uwt1 < t2h1d6 && t2h1uwt1 < t2w1rwt6 && t2h1uwt1 < t2w1lwt6 && t2h1uwt1 < t2h1uwt6 && t2h1uwt1 < t2h1dwt6
  && t2h1uwt1 < t2w1r7 && t2h1uwt1 < t2w1l7 && t2h1uwt1 < t2h1u7 && t2h1uwt1 < t2h1d7 && t2h1uwt1 < t2w1rwt7 && t2h1uwt1 < t2w1lwt7 && t2h1uwt1 < t2h1uwt7 && t2h1uwt1 < t2h1dwt7
  && t2h1uwt1 < t2w1r8 && t2h1uwt1 < t2w1l8 && t2h1uwt1 < t2h1u8 && t2h1uwt1 < t2h1d8 && t2h1uwt1 < t2w1rwt8 && t2h1uwt1 < t2w1lwt8 && t2h1uwt1 < t2h1uwt8 && t2h1uwt1 < t2h1dwt8
  && t2h1uwt1 < t2w1r9 && t2h1uwt1 < t2w1l9 && t2h1uwt1 < t2h1u9 && t2h1uwt1 < t2h1d9 && t2h1uwt1 < t2w1rwt9 && t2h1uwt1 < t2w1lwt9 && t2h1uwt1 < t2h1uwt9 && t2h1uwt1 < t2h1dwt9
  && t2h1uwt1 < t2w1r10 && t2h1uwt1 < t2w1l10 && t2h1uwt1 < t2h1u10 && t2h1uwt1 < t2h1d10 && t2h1uwt1 < t2w1rwt10 && t2h1uwt1 < t2w1lwt10 && t2h1uwt1 < t2h1uwt10 && t2h1uwt1 < t2h1dwt10
  && (louthu1 !=0 && linhu1!=0)){
  i=80;
  }

  if (myuOW1==-1 && t2h1uwt1 > 0 && t2h1uwt1 < t1 
  && t2h1uwt1 < t2w1r && t2h1uwt1 < t2w1l && t2h1uwt1 < t2h1u && t2h1uwt1 < t2h1d && t2h1uwt1 < t2w1rwt && t2h1uwt1 < t2w1lwt && t2h1uwt1 < t2h1uwt && t2h1uwt1 < t2h1dwt 
  && t2h1uwt1 < t2w1r1 && t2h1uwt1 < t2w1l1 && t2h1uwt1 < t2h1u1 && t2h1uwt1 < t2h1d1 && t2h1uwt1 < t2w1rwt1 && t2h1uwt1 < t2w1lwt1 && t2h1uwt1 < t2h1dwt1
  && t2h1uwt1 < t2w1r2 && t2h1uwt1 < t2w1l2 && t2h1uwt1 < t2h1u2 && t2h1uwt1 < t2h1d2 && t2h1uwt1 < t2w1rwt2 && t2h1uwt1 < t2w1lwt2 && t2h1uwt1 < t2h1uwt2 && t2h1uwt1 < t2h1dwt2
  && t2h1uwt1 < t2w1r3 && t2h1uwt1 < t2w1l3 && t2h1uwt1 < t2h1u3 && t2h1uwt1 < t2h1d3 && t2h1uwt1 < t2w1rwt3 && t2h1uwt1 < t2w1lwt3 && t2h1uwt1 < t2h1uwt3 && t2h1uwt1 < t2h1dwt3
  && t2h1uwt1 < t2w1r4 && t2h1uwt1 < t2w1l4 && t2h1uwt1 < t2h1u4 && t2h1uwt1 < t2h1d4 && t2h1uwt1 < t2w1rwt4 && t2h1uwt1 < t2w1lwt4 && t2h1uwt1 < t2h1uwt4 && t2h1uwt1 < t2h1dwt4
  && t2h1uwt1 < t2w1r5 && t2h1uwt1 < t2w1l5 && t2h1uwt1 < t2h1u5 && t2h1uwt1 < t2h1d5 && t2h1uwt1 < t2w1rwt5 && t2h1uwt1 < t2w1lwt5 && t2h1uwt1 < t2h1uwt5 && t2h1uwt1 < t2h1dwt5
  && t2h1uwt1 < t2w1r6 && t2h1uwt1 < t2w1l6 && t2h1uwt1 < t2h1u6 && t2h1uwt1 < t2h1d6 && t2h1uwt1 < t2w1rwt6 && t2h1uwt1 < t2w1lwt6 && t2h1uwt1 < t2h1uwt6 && t2h1uwt1 < t2h1dwt6
  && t2h1uwt1 < t2w1r7 && t2h1uwt1 < t2w1l7 && t2h1uwt1 < t2h1u7 && t2h1uwt1 < t2h1d7 && t2h1uwt1 < t2w1rwt7 && t2h1uwt1 < t2w1lwt7 && t2h1uwt1 < t2h1uwt7 && t2h1uwt1 < t2h1dwt7
  && t2h1uwt1 < t2w1r8 && t2h1uwt1 < t2w1l8 && t2h1uwt1 < t2h1u8 && t2h1uwt1 < t2h1d8 && t2h1uwt1 < t2w1rwt8 && t2h1uwt1 < t2w1lwt8 && t2h1uwt1 < t2h1uwt8 && t2h1uwt1 < t2h1dwt8
  && t2h1uwt1 < t2w1r9 && t2h1uwt1 < t2w1l9 && t2h1uwt1 < t2h1u9 && t2h1uwt1 < t2h1d9 && t2h1uwt1 < t2w1rwt9 && t2h1uwt1 < t2w1lwt9 && t2h1uwt1 < t2h1uwt9 && t2h1uwt1 < t2h1dwt9
  && t2h1uwt1 < t2w1r10 && t2h1uwt1 < t2w1l10 && t2h1uwt1 < t2h1u10 && t2h1uwt1 < t2h1d10 && t2h1uwt1 < t2w1rwt10 && t2h1uwt1 < t2w1lwt10 && t2h1uwt1 < t2h1uwt10 && t2h1uwt1 < t2h1dwt10
  && ((louthu1!=0 && linhu1==0) || (louthu1==0 && linhu1!=0))){
  i=80;
  }

  if (myuOW1==-1 && t2h1uwt1 > 0 && t2h1uwt1 < t1 
  && t2h1uwt1 < t2w1r && t2h1uwt1 < t2w1l && t2h1uwt1 < t2h1u && t2h1uwt1 < t2h1d && t2h1uwt1 < t2w1rwt && t2h1uwt1 < t2w1lwt && t2h1uwt1 < t2h1uwt && t2h1uwt1 < t2h1dwt 
  && t2h1uwt1 < t2w1r1 && t2h1uwt1 < t2w1l1 && t2h1uwt1 < t2h1u1 && t2h1uwt1 < t2h1d1 && t2h1uwt1 < t2w1rwt1 && t2h1uwt1 < t2w1lwt1 && t2h1uwt1 < t2h1dwt1
  && t2h1uwt1 < t2w1r2 && t2h1uwt1 < t2w1l2 && t2h1uwt1 < t2h1u2 && t2h1uwt1 < t2h1d2 && t2h1uwt1 < t2w1rwt2 && t2h1uwt1 < t2w1lwt2 && t2h1uwt1 < t2h1uwt2 && t2h1uwt1 < t2h1dwt2
  && t2h1uwt1 < t2w1r3 && t2h1uwt1 < t2w1l3 && t2h1uwt1 < t2h1u3 && t2h1uwt1 < t2h1d3 && t2h1uwt1 < t2w1rwt3 && t2h1uwt1 < t2w1lwt3 && t2h1uwt1 < t2h1uwt3 && t2h1uwt1 < t2h1dwt3
  && t2h1uwt1 < t2w1r4 && t2h1uwt1 < t2w1l4 && t2h1uwt1 < t2h1u4 && t2h1uwt1 < t2h1d4 && t2h1uwt1 < t2w1rwt4 && t2h1uwt1 < t2w1lwt4 && t2h1uwt1 < t2h1uwt4 && t2h1uwt1 < t2h1dwt4
  && t2h1uwt1 < t2w1r5 && t2h1uwt1 < t2w1l5 && t2h1uwt1 < t2h1u5 && t2h1uwt1 < t2h1d5 && t2h1uwt1 < t2w1rwt5 && t2h1uwt1 < t2w1lwt5 && t2h1uwt1 < t2h1uwt5 && t2h1uwt1 < t2h1dwt5
  && t2h1uwt1 < t2w1r6 && t2h1uwt1 < t2w1l6 && t2h1uwt1 < t2h1u6 && t2h1uwt1 < t2h1d6 && t2h1uwt1 < t2w1rwt6 && t2h1uwt1 < t2w1lwt6 && t2h1uwt1 < t2h1uwt6 && t2h1uwt1 < t2h1dwt6
  && t2h1uwt1 < t2w1r7 && t2h1uwt1 < t2w1l7 && t2h1uwt1 < t2h1u7 && t2h1uwt1 < t2h1d7 && t2h1uwt1 < t2w1rwt7 && t2h1uwt1 < t2w1lwt7 && t2h1uwt1 < t2h1uwt7 && t2h1uwt1 < t2h1dwt7
  && t2h1uwt1 < t2w1r8 && t2h1uwt1 < t2w1l8 && t2h1uwt1 < t2h1u8 && t2h1uwt1 < t2h1d8 && t2h1uwt1 < t2w1rwt8 && t2h1uwt1 < t2w1lwt8 && t2h1uwt1 < t2h1uwt8 && t2h1uwt1 < t2h1dwt8
  && t2h1uwt1 < t2w1r9 && t2h1uwt1 < t2w1l9 && t2h1uwt1 < t2h1u9 && t2h1uwt1 < t2h1d9 && t2h1uwt1 < t2w1rwt9 && t2h1uwt1 < t2w1lwt9 && t2h1uwt1 < t2h1uwt9 && t2h1uwt1 < t2h1dwt9
  && t2h1uwt1 < t2w1r10 && t2h1uwt1 < t2w1l10 && t2h1uwt1 < t2h1u10 && t2h1uwt1 < t2h1d10 && t2h1uwt1 < t2w1rwt10 && t2h1uwt1 < t2w1lwt10 && t2h1uwt1 < t2h1uwt10 && t2h1uwt1 < t2h1dwt10
  && (louthu1 == 0 && linhu1 == 0)){
  i=80;
  }

  if (mydOW1==-1 && t2h1dwt1 > 0 && t2h1dwt1 < t1 
  && t2h1dwt1 < t2w1r && t2h1dwt1 < t2w1l && t2h1dwt1 < t2h1u && t2h1dwt1 < t2h1d && t2h1dwt1 < t2w1rwt && t2h1dwt1 < t2w1lwt && t2h1dwt1 < t2h1uwt && t2h1dwt1 < t2h1dwt 
  && t2h1dwt1 < t2w1r1 && t2h1dwt1 < t2w1l1 && t2h1dwt1 < t2h1u1 && t2h1dwt1 < t2h1d1 && t2h1dwt1 < t2w1rwt1 && t2h1dwt1 < t2w1lwt1 && t2h1dwt1 < t2h1uwt1 
  && t2h1dwt1 < t2w1r2 && t2h1dwt1 < t2w1l2 && t2h1dwt1 < t2h1u2 && t2h1dwt1 < t2h1d2 && t2h1dwt1 < t2w1rwt2 && t2h1dwt1 < t2w1lwt2 && t2h1dwt1 < t2h1uwt2 && t2h1dwt1 < t2h1dwt2 
  && t2h1dwt1 < t2w1r3 && t2h1dwt1 < t2w1l3 && t2h1dwt1 < t2h1u3 && t2h1dwt1 < t2h1d3 && t2h1dwt1 < t2w1rwt3 && t2h1dwt1 < t2w1lwt3 && t2h1dwt1 < t2h1uwt3 && t2h1dwt1 < t2h1dwt3
  && t2h1dwt1 < t2w1r4 && t2h1dwt1 < t2w1l4 && t2h1dwt1 < t2h1u4 && t2h1dwt1 < t2h1d4 && t2h1dwt1 < t2w1rwt4 && t2h1dwt1 < t2w1lwt4 && t2h1dwt1 < t2h1uwt4 && t2h1dwt1 < t2h1dwt4
  && t2h1dwt1 < t2w1r5 && t2h1dwt1 < t2w1l5 && t2h1dwt1 < t2h1u5 && t2h1dwt1 < t2h1d5 && t2h1dwt1 < t2w1rwt5 && t2h1dwt1 < t2w1lwt5 && t2h1dwt1 < t2h1uwt5 && t2h1dwt1 < t2h1dwt5
  && t2h1dwt1 < t2w1r6 && t2h1dwt1 < t2w1l6 && t2h1dwt1 < t2h1u6 && t2h1dwt1 < t2h1d6 && t2h1dwt1 < t2w1rwt6 && t2h1dwt1 < t2w1lwt6 && t2h1dwt1 < t2h1uwt6 && t2h1dwt1 < t2h1dwt6
  && t2h1dwt1 < t2w1r7 && t2h1dwt1 < t2w1l7 && t2h1dwt1 < t2h1u7 && t2h1dwt1 < t2h1d7 && t2h1dwt1 < t2w1rwt7 && t2h1dwt1 < t2w1lwt7 && t2h1dwt1 < t2h1uwt7 && t2h1dwt1 < t2h1dwt7 
  && t2h1dwt1 < t2w1r8 && t2h1dwt1 < t2w1l8 && t2h1dwt1 < t2h1u8 && t2h1dwt1 < t2h1d8 && t2h1dwt1 < t2w1rwt8 && t2h1dwt1 < t2w1lwt8 && t2h1dwt1 < t2h1uwt8 && t2h1dwt1 < t2h1dwt8
  && t2h1dwt1 < t2w1r9 && t2h1dwt1 < t2w1l9 && t2h1dwt1 < t2h1u9 && t2h1dwt1 < t2h1d9 && t2h1dwt1 < t2w1rwt9 && t2h1dwt1 < t2w1lwt9 && t2h1dwt1 < t2h1uwt9 && t2h1dwt1 < t2h1dwt9 
  && t2h1dwt1 < t2w1r10 && t2h1dwt1 < t2w1l10 && t2h1dwt1 < t2h1u10 && t2h1dwt1 < t2h1d10 && t2h1dwt1 < t2w1rwt10 && t2h1dwt1 < t2w1lwt10 && t2h1dwt1 < t2h1uwt10 && t2h1dwt1 < t2h1dwt10
  && (louthd1 !=0 && linhd1!=0)){
  i=81;
  }

  if (mydOW1==-1 && t2h1dwt1 > 0 && t2h1dwt1 < t1 
  && t2h1dwt1 < t2w1r && t2h1dwt1 < t2w1l && t2h1dwt1 < t2h1u && t2h1dwt1 < t2h1d && t2h1dwt1 < t2w1rwt && t2h1dwt1 < t2w1lwt && t2h1dwt1 < t2h1uwt && t2h1dwt1 < t2h1dwt 
  && t2h1dwt1 < t2w1r1 && t2h1dwt1 < t2w1l1 && t2h1dwt1 < t2h1u1 && t2h1dwt1 < t2h1d1 && t2h1dwt1 < t2w1rwt1 && t2h1dwt1 < t2w1lwt1 && t2h1dwt1 < t2h1uwt1 
  && t2h1dwt1 < t2w1r2 && t2h1dwt1 < t2w1l2 && t2h1dwt1 < t2h1u2 && t2h1dwt1 < t2h1d2 && t2h1dwt1 < t2w1rwt2 && t2h1dwt1 < t2w1lwt2 && t2h1dwt1 < t2h1uwt2 && t2h1dwt1 < t2h1dwt2 
  && t2h1dwt1 < t2w1r3 && t2h1dwt1 < t2w1l3 && t2h1dwt1 < t2h1u3 && t2h1dwt1 < t2h1d3 && t2h1dwt1 < t2w1rwt3 && t2h1dwt1 < t2w1lwt3 && t2h1dwt1 < t2h1uwt3 && t2h1dwt1 < t2h1dwt3
  && t2h1dwt1 < t2w1r4 && t2h1dwt1 < t2w1l4 && t2h1dwt1 < t2h1u4 && t2h1dwt1 < t2h1d4 && t2h1dwt1 < t2w1rwt4 && t2h1dwt1 < t2w1lwt4 && t2h1dwt1 < t2h1uwt4 && t2h1dwt1 < t2h1dwt4
  && t2h1dwt1 < t2w1r5 && t2h1dwt1 < t2w1l5 && t2h1dwt1 < t2h1u5 && t2h1dwt1 < t2h1d5 && t2h1dwt1 < t2w1rwt5 && t2h1dwt1 < t2w1lwt5 && t2h1dwt1 < t2h1uwt5 && t2h1dwt1 < t2h1dwt5
  && t2h1dwt1 < t2w1r6 && t2h1dwt1 < t2w1l6 && t2h1dwt1 < t2h1u6 && t2h1dwt1 < t2h1d6 && t2h1dwt1 < t2w1rwt6 && t2h1dwt1 < t2w1lwt6 && t2h1dwt1 < t2h1uwt6 && t2h1dwt1 < t2h1dwt6
  && t2h1dwt1 < t2w1r7 && t2h1dwt1 < t2w1l7 && t2h1dwt1 < t2h1u7 && t2h1dwt1 < t2h1d7 && t2h1dwt1 < t2w1rwt7 && t2h1dwt1 < t2w1lwt7 && t2h1dwt1 < t2h1uwt7 && t2h1dwt1 < t2h1dwt7 
  && t2h1dwt1 < t2w1r8 && t2h1dwt1 < t2w1l8 && t2h1dwt1 < t2h1u8 && t2h1dwt1 < t2h1d8 && t2h1dwt1 < t2w1rwt8 && t2h1dwt1 < t2w1lwt8 && t2h1dwt1 < t2h1uwt8 && t2h1dwt1 < t2h1dwt8
  && t2h1dwt1 < t2w1r9 && t2h1dwt1 < t2w1l9 && t2h1dwt1 < t2h1u9 && t2h1dwt1 < t2h1d9 && t2h1dwt1 < t2w1rwt9 && t2h1dwt1 < t2w1lwt9 && t2h1dwt1 < t2h1uwt9 && t2h1dwt1 < t2h1dwt9 
  && t2h1dwt1 < t2w1r10 && t2h1dwt1 < t2w1l10 && t2h1dwt1 < t2h1u10 && t2h1dwt1 < t2h1d10 && t2h1dwt1 < t2w1rwt10 && t2h1dwt1 < t2w1lwt10 && t2h1dwt1 < t2h1uwt10 && t2h1dwt1 < t2h1dwt10
  &&  ((louthd1 !=0 && linhd1==0) || (louthd1 ==0 && linhd1!=0))){
  i=81;
  }

  if (mydOW1==-1 && t2h1dwt1 > 0 && t2h1dwt1 < t1 
  && t2h1dwt1 < t2w1r && t2h1dwt1 < t2w1l && t2h1dwt1 < t2h1u && t2h1dwt1 < t2h1d && t2h1dwt1 < t2w1rwt && t2h1dwt1 < t2w1lwt && t2h1dwt1 < t2h1uwt && t2h1dwt1 < t2h1dwt 
  && t2h1dwt1 < t2w1r1 && t2h1dwt1 < t2w1l1 && t2h1dwt1 < t2h1u1 && t2h1dwt1 < t2h1d1 && t2h1dwt1 < t2w1rwt1 && t2h1dwt1 < t2w1lwt1 && t2h1dwt1 < t2h1uwt1 
  && t2h1dwt1 < t2w1r2 && t2h1dwt1 < t2w1l2 && t2h1dwt1 < t2h1u2 && t2h1dwt1 < t2h1d2 && t2h1dwt1 < t2w1rwt2 && t2h1dwt1 < t2w1lwt2 && t2h1dwt1 < t2h1uwt2 && t2h1dwt1 < t2h1dwt2 
  && t2h1dwt1 < t2w1r3 && t2h1dwt1 < t2w1l3 && t2h1dwt1 < t2h1u3 && t2h1dwt1 < t2h1d3 && t2h1dwt1 < t2w1rwt3 && t2h1dwt1 < t2w1lwt3 && t2h1dwt1 < t2h1uwt3 && t2h1dwt1 < t2h1dwt3
  && t2h1dwt1 < t2w1r4 && t2h1dwt1 < t2w1l4 && t2h1dwt1 < t2h1u4 && t2h1dwt1 < t2h1d4 && t2h1dwt1 < t2w1rwt4 && t2h1dwt1 < t2w1lwt4 && t2h1dwt1 < t2h1uwt4 && t2h1dwt1 < t2h1dwt4
  && t2h1dwt1 < t2w1r5 && t2h1dwt1 < t2w1l5 && t2h1dwt1 < t2h1u5 && t2h1dwt1 < t2h1d5 && t2h1dwt1 < t2w1rwt5 && t2h1dwt1 < t2w1lwt5 && t2h1dwt1 < t2h1uwt5 && t2h1dwt1 < t2h1dwt5
  && t2h1dwt1 < t2w1r6 && t2h1dwt1 < t2w1l6 && t2h1dwt1 < t2h1u6 && t2h1dwt1 < t2h1d6 && t2h1dwt1 < t2w1rwt6 && t2h1dwt1 < t2w1lwt6 && t2h1dwt1 < t2h1uwt6 && t2h1dwt1 < t2h1dwt6
  && t2h1dwt1 < t2w1r7 && t2h1dwt1 < t2w1l7 && t2h1dwt1 < t2h1u7 && t2h1dwt1 < t2h1d7 && t2h1dwt1 < t2w1rwt7 && t2h1dwt1 < t2w1lwt7 && t2h1dwt1 < t2h1uwt7 && t2h1dwt1 < t2h1dwt7 
  && t2h1dwt1 < t2w1r8 && t2h1dwt1 < t2w1l8 && t2h1dwt1 < t2h1u8 && t2h1dwt1 < t2h1d8 && t2h1dwt1 < t2w1rwt8 && t2h1dwt1 < t2w1lwt8 && t2h1dwt1 < t2h1uwt8 && t2h1dwt1 < t2h1dwt8
  && t2h1dwt1 < t2w1r9 && t2h1dwt1 < t2w1l9 && t2h1dwt1 < t2h1u9 && t2h1dwt1 < t2h1d9 && t2h1dwt1 < t2w1rwt9 && t2h1dwt1 < t2w1lwt9 && t2h1dwt1 < t2h1uwt9 && t2h1dwt1 < t2h1dwt9 
  && t2h1dwt1 < t2w1r10 && t2h1dwt1 < t2w1l10 && t2h1dwt1 < t2h1u10 && t2h1dwt1 < t2h1d10 && t2h1dwt1 < t2w1rwt10 && t2h1dwt1 < t2w1lwt10 && t2h1dwt1 < t2h1uwt10 && t2h1dwt1 < t2h1dwt10
  && (louthd1 == 0 && linhd1 == 0)){
  i=81;
  }

												/* SECOND SHELL */

if (mxr2!=-1 && t2w1r2 > 0 && t2w1r2 < t1 
     && t2w1r2 < t2w1r && t2w1r2 < t2w1l && t2w1r2 < t2h1u && t2w1r2 < t2h1d && t2w1r2 < t2w1rwt && t2w1r2 < t2w1lwt && t2w1r2 < t2h1uwt && t2w1r2 < t2h1dwt
     && t2w1r2 < t2w1r1 && t2w1r2 < t2w1l1 && t2w1r2 < t2h1u1 && t2w1r2 < t2h1d1 && t2w1r2 < t2w1rwt1 && t2w1r2 < t2w1lwt1 && t2w1r2 < t2h1uwt1 && t2w1r2 < t2h1dwt1
     && t2w1r2 < t2w1l2 && t2w1r2 < t2h1u2 && t2w1r2 < t2h1d2 && t2w1r2 < t2w1rwt2 && t2w1r2 < t2w1lwt2 && t2w1r2 < t2h1uwt2 && t2w1r2 < t2h1dwt2 
     && t2w1r2 < t2w1r3 && t2w1r2 < t2w1l3 && t2w1r2 < t2h1u3 && t2w1r2 < t2h1d3 && t2w1r2 < t2w1rwt3 && t2w1r2 < t2w1lwt3 && t2w1r2 < t2h1uwt3 && t2w1r2 < t2h1dwt3
     && t2w1r2 < t2w1r4 && t2w1r2 < t2w1l4 && t2w1r2 < t2h1u4 && t2w1r2 < t2h1d4 && t2w1r2 < t2w1rwt4 && t2w1r2 < t2w1lwt4 && t2w1r2 < t2h1uwt4 && t2w1r2 < t2h1dwt4
     && t2w1r2 < t2w1r5 && t2w1r2 < t2w1l5 && t2w1r2 < t2h1u5 && t2w1r2 < t2h1d5 && t2w1r2 < t2w1rwt5 && t2w1r2 < t2w1lwt5 && t2w1r2 < t2h1uwt5 && t2w1r2 < t2h1dwt5
     && t2w1r2 < t2w1r6 && t2w1r2 < t2w1l6 && t2w1r2 < t2h1u6 && t2w1r2 < t2h1d6 && t2w1r2 < t2w1rwt6 && t2w1r2 < t2w1lwt6 && t2w1r2 < t2h1uwt6 && t2w1r2 < t2h1dwt6
     && t2w1r2 < t2w1r7 && t2w1r2 < t2w1l7 && t2w1r2 < t2h1u7 && t2w1r2 < t2h1d7 && t2w1r2 < t2w1rwt7 && t2w1r2 < t2w1lwt7 && t2w1r2 < t2h1uwt7 && t2w1r2 < t2h1dwt7
     && t2w1r2 < t2w1r8 && t2w1r2 < t2w1l8 && t2w1r2 < t2h1u8 && t2w1r2 < t2h1d8 && t2w1r2 < t2w1rwt8 && t2w1r2 < t2w1lwt8 && t2w1r2 < t2h1uwt8 && t2w1r2 < t2h1dwt8
     && t2w1r2 < t2w1r9 && t2w1r2 < t2w1l9 && t2w1r2 < t2h1u9 && t2w1r2 < t2h1d9 && t2w1r2 < t2w1rwt9 && t2w1r2 < t2w1lwt9 && t2w1r2 < t2h1uwt9 && t2w1r2 < t2h1dwt9
     && t2w1r2 < t2w1r10 && t2w1r2 < t2w1l10 && t2w1r2 < t2h1u10 && t2w1r2 < t2h1d10 && t2w1r2 < t2w1rwt10 && t2w1r2 < t2w1lwt10 && t2w1r2 < t2h1uwt10 && t2w1r2 < t2h1dwt10
     && ((linwr2!=0) && (loutwr2!=0) )) {	
    if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1r2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1r2+z))*(z0hd2+(vz*t2w1r2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1r2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1r2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1r2+z))*(z0hu2+(vz*t2w1r2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1r2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1r2+y;
  xlimitr=bwr2*sqrt(1-((vz*t2w1r2+z)+z0wr2)*((vz*t2w1r2+z)+z0wr2)/a2wr2);
  xtest=vx*t2w1r2+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr2 > 0){
  i=82;
  }else{
  i=98;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr2!=-1 && t2w1r2 > 0 && t2w1r2 < t1 
     && t2w1r2 < t2w1r && t2w1r2 < t2w1l && t2w1r2 < t2h1u && t2w1r2 < t2h1d && t2w1r2 < t2w1rwt && t2w1r2 < t2w1lwt && t2w1r2 < t2h1uwt && t2w1r2 < t2h1dwt
     && t2w1r2 < t2w1r1 && t2w1r2 < t2w1l1 && t2w1r2 < t2h1u1 && t2w1r2 < t2h1d1 && t2w1r2 < t2w1rwt1 && t2w1r2 < t2w1lwt1 && t2w1r2 < t2h1uwt1 && t2w1r2 < t2h1dwt1
     && t2w1r2 < t2w1l2 && t2w1r2 < t2h1u2 && t2w1r2 < t2h1d2 && t2w1r2 < t2w1rwt2 && t2w1r2 < t2w1lwt2 && t2w1r2 < t2h1uwt2 && t2w1r2 < t2h1dwt2 
     && t2w1r2 < t2w1r3 && t2w1r2 < t2w1l3 && t2w1r2 < t2h1u3 && t2w1r2 < t2h1d3 && t2w1r2 < t2w1rwt3 && t2w1r2 < t2w1lwt3 && t2w1r2 < t2h1uwt3 && t2w1r2 < t2h1dwt3
     && t2w1r2 < t2w1r4 && t2w1r2 < t2w1l4 && t2w1r2 < t2h1u4 && t2w1r2 < t2h1d4 && t2w1r2 < t2w1rwt4 && t2w1r2 < t2w1lwt4 && t2w1r2 < t2h1uwt4 && t2w1r2 < t2h1dwt4
     && t2w1r2 < t2w1r5 && t2w1r2 < t2w1l5 && t2w1r2 < t2h1u5 && t2w1r2 < t2h1d5 && t2w1r2 < t2w1rwt5 && t2w1r2 < t2w1lwt5 && t2w1r2 < t2h1uwt5 && t2w1r2 < t2h1dwt5
     && t2w1r2 < t2w1r6 && t2w1r2 < t2w1l6 && t2w1r2 < t2h1u6 && t2w1r2 < t2h1d6 && t2w1r2 < t2w1rwt6 && t2w1r2 < t2w1lwt6 && t2w1r2 < t2h1uwt6 && t2w1r2 < t2h1dwt6
     && t2w1r2 < t2w1r7 && t2w1r2 < t2w1l7 && t2w1r2 < t2h1u7 && t2w1r2 < t2h1d7 && t2w1r2 < t2w1rwt7 && t2w1r2 < t2w1lwt7 && t2w1r2 < t2h1uwt7 && t2w1r2 < t2h1dwt7
     && t2w1r2 < t2w1r8 && t2w1r2 < t2w1l8 && t2w1r2 < t2h1u8 && t2w1r2 < t2h1d8 && t2w1r2 < t2w1rwt8 && t2w1r2 < t2w1lwt8 && t2w1r2 < t2h1uwt8 && t2w1r2 < t2h1dwt8
     && t2w1r2 < t2w1r9 && t2w1r2 < t2w1l9 && t2w1r2 < t2h1u9 && t2w1r2 < t2h1d9 && t2w1r2 < t2w1rwt9 && t2w1r2 < t2w1lwt9 && t2w1r2 < t2h1uwt9 && t2w1r2 < t2h1dwt9
     && t2w1r2 < t2w1r10 && t2w1r2 < t2w1l10 && t2w1r2 < t2h1u10 && t2w1r2 < t2h1d10 && t2w1r2 < t2w1rwt10 && t2w1r2 < t2w1lwt10 && t2w1r2 < t2h1uwt10 && t2w1r2 < t2h1dwt10
     && ((loutwr2!=0 && linwr2==0) || (loutwr2==0 && linwr2!=0))){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1r2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1r2+z))*(z0hd2+(vz*t2w1r2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1r2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1r2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1r2+z))*(z0hu2+(vz*t2w1r2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1r2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1r2+y;
  xtest=vx*t2w1r2+x;
  xlimitr=-sqrt(pbwr2-(vz*t2w1r2+z)/pawr2);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr2 > 0){
  i=83;
  }else{
  i=98;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr2!=-1 && t2w1r2 > 0 && t2w1r2 < t1 
     && t2w1r2 < t2w1r && t2w1r2 < t2w1l && t2w1r2 < t2h1u && t2w1r2 < t2h1d && t2w1r2 < t2w1rwt && t2w1r2 < t2w1lwt && t2w1r2 < t2h1uwt && t2w1r2 < t2h1dwt
     && t2w1r2 < t2w1r1 && t2w1r2 < t2w1l1 && t2w1r2 < t2h1u1 && t2w1r2 < t2h1d1 && t2w1r2 < t2w1rwt1 && t2w1r2 < t2w1lwt1 && t2w1r2 < t2h1uwt1 && t2w1r2 < t2h1dwt1
     && t2w1r2 < t2w1l2 && t2w1r2 < t2h1u2 && t2w1r2 < t2h1d2 && t2w1r2 < t2w1rwt2 && t2w1r2 < t2w1lwt2 && t2w1r2 < t2h1uwt2 && t2w1r2 < t2h1dwt2 
     && t2w1r2 < t2w1r3 && t2w1r2 < t2w1l3 && t2w1r2 < t2h1u3 && t2w1r2 < t2h1d3 && t2w1r2 < t2w1rwt3 && t2w1r2 < t2w1lwt3 && t2w1r2 < t2h1uwt3 && t2w1r2 < t2h1dwt3
     && t2w1r2 < t2w1r4 && t2w1r2 < t2w1l4 && t2w1r2 < t2h1u4 && t2w1r2 < t2h1d4 && t2w1r2 < t2w1rwt4 && t2w1r2 < t2w1lwt4 && t2w1r2 < t2h1uwt4 && t2w1r2 < t2h1dwt4
     && t2w1r2 < t2w1r5 && t2w1r2 < t2w1l5 && t2w1r2 < t2h1u5 && t2w1r2 < t2h1d5 && t2w1r2 < t2w1rwt5 && t2w1r2 < t2w1lwt5 && t2w1r2 < t2h1uwt5 && t2w1r2 < t2h1dwt5
     && t2w1r2 < t2w1r6 && t2w1r2 < t2w1l6 && t2w1r2 < t2h1u6 && t2w1r2 < t2h1d6 && t2w1r2 < t2w1rwt6 && t2w1r2 < t2w1lwt6 && t2w1r2 < t2h1uwt6 && t2w1r2 < t2h1dwt6
     && t2w1r2 < t2w1r7 && t2w1r2 < t2w1l7 && t2w1r2 < t2h1u7 && t2w1r2 < t2h1d7 && t2w1r2 < t2w1rwt7 && t2w1r2 < t2w1lwt7 && t2w1r2 < t2h1uwt7 && t2w1r2 < t2h1dwt7
     && t2w1r2 < t2w1r8 && t2w1r2 < t2w1l8 && t2w1r2 < t2h1u8 && t2w1r2 < t2h1d8 && t2w1r2 < t2w1rwt8 && t2w1r2 < t2w1lwt8 && t2w1r2 < t2h1uwt8 && t2w1r2 < t2h1dwt8
     && t2w1r2 < t2w1r9 && t2w1r2 < t2w1l9 && t2w1r2 < t2h1u9 && t2w1r2 < t2h1d9 && t2w1r2 < t2w1rwt9 && t2w1r2 < t2w1lwt9 && t2w1r2 < t2h1uwt9 && t2w1r2 < t2h1dwt9
     && t2w1r2 < t2w1r10 && t2w1r2 < t2w1l10 && t2w1r2 < t2h1u10 && t2w1r2 < t2h1d10 && t2w1r2 < t2w1rwt10 && t2w1r2 < t2w1lwt10 && t2w1r2 < t2h1uwt10 && t2w1r2 < t2h1dwt10
     && (loutwr2==0 && linwr2==0)){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1r2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1r2+z))*(z0hd2+(vz*t2w1r2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1r2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1r2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1r2+z))*(z0hu2+(vz*t2w1r2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1r2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1r2+y;
  xtest=vx*t2w1r2+x;
  xlimitr=-(w2r2+w1r2)*(vz*t2w1r2+z)/l-w1r2;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr2>0){
  i=84;
  }else{
  i=98;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl2!=-1 && t2w1l2 > 0 && t2w1l2 < t1 
      && t2w1l2 < t2w1r && t2w1l2 < t2w1l && t2w1l2 < t2h1u && t2w1l2 < t2h1d && t2w1l2 < t2w1rwt && t2w1l2 < t2w1lwt && t2w1l2 < t2h1uwt && t2w1l2 < t2h1dwt
      && t2w1l2 < t2w1r1 && t2w1l2 < t2w1l1 && t2w1l2 < t2h1u1 && t2w1l2 < t2h1d1 && t2w1l2 < t2w1rwt1 && t2w1l2 < t2w1lwt1 && t2w1l2 < t2h1uwt1 && t2w1l2 < t2h1dwt1
      && t2w1l2 < t2w1r2 && t2w1l2 < t2h1u2 && t2w1l2 < t2h1d2 && t2w1l2 < t2w1rwt2 && t2w1l2 < t2w1lwt2 && t2w1l2 < t2h1uwt2 && t2w1l2 < t2h1dwt2
      && t2w1l2 < t2w1r3 && t2w1l2 < t2w1l3 && t2w1l2 < t2h1u3 && t2w1l2 < t2h1d3 && t2w1l2 < t2w1rwt3 && t2w1l2 < t2w1lwt3 && t2w1l2 < t2h1uwt3 && t2w1l2 < t2h1dwt3
      && t2w1l2 < t2w1r4 && t2w1l2 < t2w1l4 && t2w1l2 < t2h1u4 && t2w1l2 < t2h1d4 && t2w1l2 < t2w1rwt4 && t2w1l2 < t2w1lwt4 && t2w1l2 < t2h1uwt4 && t2w1l2 < t2h1dwt4
      && t2w1l2 < t2w1r5 && t2w1l2 < t2w1l5 && t2w1l2 < t2h1u5 && t2w1l2 < t2h1d5 && t2w1l2 < t2w1rwt5 && t2w1l2 < t2w1lwt5 && t2w1l2 < t2h1uwt5 && t2w1l2 < t2h1dwt5
      && t2w1l2 < t2w1r6 && t2w1l2 < t2w1l6 && t2w1l2 < t2h1u6 && t2w1l2 < t2h1d6 && t2w1l2 < t2w1rwt6 && t2w1l2 < t2w1lwt6 && t2w1l2 < t2h1uwt6 && t2w1l2 < t2h1dwt6
      && t2w1l2 < t2w1r7 && t2w1l2 < t2w1l7 && t2w1l2 < t2h1u7 && t2w1l2 < t2h1d7 && t2w1l2 < t2w1rwt7 && t2w1l2 < t2w1lwt7 && t2w1l2 < t2h1uwt7 && t2w1l2 < t2h1dwt7
      && t2w1l2 < t2w1r8 && t2w1l2 < t2w1l8 && t2w1l2 < t2h1u8 && t2w1l2 < t2h1d8 && t2w1l2 < t2w1rwt8 && t2w1l2 < t2w1lwt8 && t2w1l2 < t2h1uwt8 && t2w1l2 < t2h1dwt8
      && t2w1l2 < t2w1r9 && t2w1l2 < t2w1l9 && t2w1l2 < t2h1u9 && t2w1l2 < t2h1d9 && t2w1l2 < t2w1rwt9 && t2w1l2 < t2w1lwt9 && t2w1l2 < t2h1uwt9 && t2w1l2 < t2h1dwt9
      && t2w1l2 < t2w1r10 && t2w1l2 < t2w1l10 && t2w1l2 < t2h1u10 && t2w1l2 < t2h1d10 && t2w1l2 < t2w1rwt10 && t2w1l2 < t2w1lwt10 && t2w1l2 < t2h1uwt10 && t2w1l2 < t2h1dwt10
      && ((linwl2!=0) && (loutwl2!=0) )){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1l2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1l2+z))*(z0hd2+(vz*t2w1l2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1l2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1l2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1l2+z))*(z0hu2+(vz*t2w1l2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1l2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1l2+y;
  xlimitl=bwl2*sqrt(1-((vz*t2w1l2+z)+z0wl2)*((vz*t2w1l2+z)+z0wl2)/a2wl2);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl2>0){
  i=85;
  }else{
  i=99;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl2!=-1 && t2w1l2 > 0 && t2w1l2 < t1 
      && t2w1l2 < t2w1r && t2w1l2 < t2w1l && t2w1l2 < t2h1u && t2w1l2 < t2h1d && t2w1l2 < t2w1rwt && t2w1l2 < t2w1lwt && t2w1l2 < t2h1uwt && t2w1l2 < t2h1dwt
      && t2w1l2 < t2w1r1 && t2w1l2 < t2w1l1 && t2w1l2 < t2h1u1 && t2w1l2 < t2h1d1 && t2w1l2 < t2w1rwt1 && t2w1l2 < t2w1lwt1 && t2w1l2 < t2h1uwt1 && t2w1l2 < t2h1dwt1
      && t2w1l2 < t2w1r2 && t2w1l2 < t2h1u2 && t2w1l2 < t2h1d2 && t2w1l2 < t2w1rwt2 && t2w1l2 < t2w1lwt2 && t2w1l2 < t2h1uwt2 && t2w1l2 < t2h1dwt2
      && t2w1l2 < t2w1r3 && t2w1l2 < t2w1l3 && t2w1l2 < t2h1u3 && t2w1l2 < t2h1d3 && t2w1l2 < t2w1rwt3 && t2w1l2 < t2w1lwt3 && t2w1l2 < t2h1uwt3 && t2w1l2 < t2h1dwt3
      && t2w1l2 < t2w1r4 && t2w1l2 < t2w1l4 && t2w1l2 < t2h1u4 && t2w1l2 < t2h1d4 && t2w1l2 < t2w1rwt4 && t2w1l2 < t2w1lwt4 && t2w1l2 < t2h1uwt4 && t2w1l2 < t2h1dwt4
      && t2w1l2 < t2w1r5 && t2w1l2 < t2w1l5 && t2w1l2 < t2h1u5 && t2w1l2 < t2h1d5 && t2w1l2 < t2w1rwt5 && t2w1l2 < t2w1lwt5 && t2w1l2 < t2h1uwt5 && t2w1l2 < t2h1dwt5
      && t2w1l2 < t2w1r6 && t2w1l2 < t2w1l6 && t2w1l2 < t2h1u6 && t2w1l2 < t2h1d6 && t2w1l2 < t2w1rwt6 && t2w1l2 < t2w1lwt6 && t2w1l2 < t2h1uwt6 && t2w1l2 < t2h1dwt6
      && t2w1l2 < t2w1r7 && t2w1l2 < t2w1l7 && t2w1l2 < t2h1u7 && t2w1l2 < t2h1d7 && t2w1l2 < t2w1rwt7 && t2w1l2 < t2w1lwt7 && t2w1l2 < t2h1uwt7 && t2w1l2 < t2h1dwt7
      && t2w1l2 < t2w1r8 && t2w1l2 < t2w1l8 && t2w1l2 < t2h1u8 && t2w1l2 < t2h1d8 && t2w1l2 < t2w1rwt8 && t2w1l2 < t2w1lwt8 && t2w1l2 < t2h1uwt8 && t2w1l2 < t2h1dwt8
      && t2w1l2 < t2w1r9 && t2w1l2 < t2w1l9 && t2w1l2 < t2h1u9 && t2w1l2 < t2h1d9 && t2w1l2 < t2w1rwt9 && t2w1l2 < t2w1lwt9 && t2w1l2 < t2h1uwt9 && t2w1l2 < t2h1dwt9
      && t2w1l2 < t2w1r10 && t2w1l2 < t2w1l10 && t2w1l2 < t2h1u10 && t2w1l2 < t2h1d10 && t2w1l2 < t2w1rwt10 && t2w1l2 < t2w1lwt10 && t2w1l2 < t2h1uwt10 && t2w1l2 < t2h1dwt10  
      && ((loutwl2!=0 && linwl2==0) || (loutwl2==0 && linwl2!=0))){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1l2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1l2+z))*(z0hd2+(vz*t2w1l2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1l2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1l2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1l2+z))*(z0hu2+(vz*t2w1l2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1l2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1l2+y;
  xlimitl=sqrt(pbwl2-(vz*t2w1l2+z)/pawl2);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl2>0){
  i=86;
  }else{
  i=99;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl2!=-1 && t2w1l2 > 0 && t2w1l2 < t1 
      && t2w1l2 < t2w1r && t2w1l2 < t2w1l && t2w1l2 < t2h1u && t2w1l2 < t2h1d && t2w1l2 < t2w1rwt && t2w1l2 < t2w1lwt && t2w1l2 < t2h1uwt && t2w1l2 < t2h1dwt
      && t2w1l2 < t2w1r1 && t2w1l2 < t2w1l1 && t2w1l2 < t2h1u1 && t2w1l2 < t2h1d1 && t2w1l2 < t2w1rwt1 && t2w1l2 < t2w1lwt1 && t2w1l2 < t2h1uwt1 && t2w1l2 < t2h1dwt1
      && t2w1l2 < t2w1r2 && t2w1l2 < t2h1u2 && t2w1l2 < t2h1d2 && t2w1l2 < t2w1rwt2 && t2w1l2 < t2w1lwt2 && t2w1l2 < t2h1uwt2 && t2w1l2 < t2h1dwt2
      && t2w1l2 < t2w1r3 && t2w1l2 < t2w1l3 && t2w1l2 < t2h1u3 && t2w1l2 < t2h1d3 && t2w1l2 < t2w1rwt3 && t2w1l2 < t2w1lwt3 && t2w1l2 < t2h1uwt3 && t2w1l2 < t2h1dwt3
      && t2w1l2 < t2w1r4 && t2w1l2 < t2w1l4 && t2w1l2 < t2h1u4 && t2w1l2 < t2h1d4 && t2w1l2 < t2w1rwt4 && t2w1l2 < t2w1lwt4 && t2w1l2 < t2h1uwt4 && t2w1l2 < t2h1dwt4
      && t2w1l2 < t2w1r5 && t2w1l2 < t2w1l5 && t2w1l2 < t2h1u5 && t2w1l2 < t2h1d5 && t2w1l2 < t2w1rwt5 && t2w1l2 < t2w1lwt5 && t2w1l2 < t2h1uwt5 && t2w1l2 < t2h1dwt5
      && t2w1l2 < t2w1r6 && t2w1l2 < t2w1l6 && t2w1l2 < t2h1u6 && t2w1l2 < t2h1d6 && t2w1l2 < t2w1rwt6 && t2w1l2 < t2w1lwt6 && t2w1l2 < t2h1uwt6 && t2w1l2 < t2h1dwt6
      && t2w1l2 < t2w1r7 && t2w1l2 < t2w1l7 && t2w1l2 < t2h1u7 && t2w1l2 < t2h1d7 && t2w1l2 < t2w1rwt7 && t2w1l2 < t2w1lwt7 && t2w1l2 < t2h1uwt7 && t2w1l2 < t2h1dwt7
      && t2w1l2 < t2w1r8 && t2w1l2 < t2w1l8 && t2w1l2 < t2h1u8 && t2w1l2 < t2h1d8 && t2w1l2 < t2w1rwt8 && t2w1l2 < t2w1lwt8 && t2w1l2 < t2h1uwt8 && t2w1l2 < t2h1dwt8
      && t2w1l2 < t2w1r9 && t2w1l2 < t2w1l9 && t2w1l2 < t2h1u9 && t2w1l2 < t2h1d9 && t2w1l2 < t2w1rwt9 && t2w1l2 < t2w1lwt9 && t2w1l2 < t2h1uwt9 && t2w1l2 < t2h1dwt9
      && t2w1l2 < t2w1r10 && t2w1l2 < t2w1l10 && t2w1l2 < t2h1u10 && t2w1l2 < t2h1d10 && t2w1l2 < t2w1rwt10 && t2w1l2 < t2w1lwt10 && t2w1l2 < t2h1uwt10 && t2w1l2 < t2h1dwt10
      && (loutwl2==0 && linwl2==0)){
 if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1l2+z)-h1d2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhd2*sqrt(1-((z0hd2+(vz*t2w1l2+z))*(z0hd2+(vz*t2w1l2+z)))/a2hd2);
      }else{
      ylimitd=-sqrt(((vz*t2w1l2+z)-pbhd2)/-pahd2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1l2+z)+h1u2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhu2*sqrt(1-((z0hu2+(vz*t2w1l2+z))*(z0hu2+(vz*t2w1l2+z)))/a2hu2);
     }else{
     ylimitu=sqrt(((vz*t2w1l2+z)-pbhu2)/-pahu2);
    }
    }
  ytest=vy*t2w1l2+y;
  xlimitl=(w2l2-w1l2)*(vz*t2w1l2+z)/l+w1l2;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl2>0){
  i=87;
  }else{
  i=99;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu2!=-1 && t2h1u2 > 0 && t2h1u2 < t1 
  && t2h1u2 < t2w1r && t2h1u2 < t2w1l && t2h1u2 < t2h1u && t2h1u2 < t2h1d && t2h1u2 < t2w1rwt && t2h1u2 < t2w1lwt && t2h1u2 < t2h1uwt && t2h1u2 < t2h1dwt
  && t2h1u2 < t2w1r1 && t2h1u2 < t2w1l1 && t2h1u2 < t2h1u1 && t2h1u2 < t2h1d1 && t2h1u2 < t2w1rwt1 && t2h1u2 < t2w1lwt1 && t2h1u2 < t2h1uwt1 && t2h1u2 < t2h1dwt1
  && t2h1u2 < t2w1r2 && t2h1u2 < t2w1l2 && t2h1u2 < t2h1d2 && t2h1u2 < t2w1rwt2 && t2h1u2 < t2w1lwt2 && t2h1u2 < t2h1uwt2 && t2h1u2 < t2h1dwt2
  && t2h1u2 < t2w1r3 && t2h1u2 < t2w1l3 && t2h1u2 < t2h1u3 && t2h1u2 < t2h1d3 && t2h1u2 < t2w1rwt3 && t2h1u2 < t2w1lwt3 && t2h1u2 < t2h1uwt3 && t2h1u2 < t2h1dwt3
  && t2h1u2 < t2w1r4 && t2h1u2 < t2w1l4 && t2h1u2 < t2h1u4 && t2h1u2 < t2h1d4 && t2h1u2 < t2w1rwt4 && t2h1u2 < t2w1lwt4 && t2h1u2 < t2h1uwt4 && t2h1u2 < t2h1dwt4
  && t2h1u2 < t2w1r5 && t2h1u2 < t2w1l5 && t2h1u2 < t2h1u5 && t2h1u2 < t2h1d5 && t2h1u2 < t2w1rwt5 && t2h1u2 < t2w1lwt5 && t2h1u2 < t2h1uwt5 && t2h1u2 < t2h1dwt5
  && t2h1u2 < t2w1r6 && t2h1u2 < t2w1l6 && t2h1u2 < t2h1u6 && t2h1u2 < t2h1d6 && t2h1u2 < t2w1rwt6 && t2h1u2 < t2w1lwt6 && t2h1u2 < t2h1uwt6 && t2h1u2 < t2h1dwt6
  && t2h1u2 < t2w1r7 && t2h1u2 < t2w1l7 && t2h1u2 < t2h1u7 && t2h1u2 < t2h1d7 && t2h1u2 < t2w1rwt7 && t2h1u2 < t2w1lwt7 && t2h1u2 < t2h1uwt7 && t2h1u2 < t2h1dwt7
  && t2h1u2 < t2w1r8 && t2h1u2 < t2w1l8 && t2h1u2 < t2h1u8 && t2h1u2 < t2h1d8 && t2h1u2 < t2w1rwt8 && t2h1u2 < t2w1lwt8 && t2h1u2 < t2h1uwt8 && t2h1u2 < t2h1dwt8
  && t2h1u2 < t2w1r9 && t2h1u2 < t2w1l9 && t2h1u2 < t2h1u9 && t2h1u2 < t2h1d9 && t2h1u2 < t2w1rwt9 && t2h1u2 < t2w1lwt9 && t2h1u2 < t2h1uwt9 && t2h1u2 < t2h1dwt9
  && t2h1u2 < t2w1r10 && t2h1u2 < t2w1l10 && t2h1u2 < t2h1u10 && t2h1u2 < t2h1d10 && t2h1u2 < t2w1rwt10 && t2h1u2 < t2w1lwt10 && t2h1u2 < t2h1uwt10 && t2h1u2 < t2h1dwt10
  && (louthu2 !=0 && linhu2!=0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1u2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1u2+z))*(z0wr2+(vz*t2h1u2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1u2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1u2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1u2+z))*(z0wl2+(vz*t2h1u2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1u2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1u2+x;
  ylimitu=bhu2*sqrt(1-((vz*t2h1u2+z)+z0hu2)*((vz*t2h1u2+z)+z0hu2)/a2hu2);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu2>0 ){
  i=88;
  }else{
  i=100;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu2!=-1 && t2h1u2 > 0 && t2h1u2 < t1 
  && t2h1u2 < t2w1r && t2h1u2 < t2w1l && t2h1u2 < t2h1u && t2h1u2 < t2h1d && t2h1u2 < t2w1rwt && t2h1u2 < t2w1lwt && t2h1u2 < t2h1uwt && t2h1u2 < t2h1dwt
  && t2h1u2 < t2w1r1 && t2h1u2 < t2w1l1 && t2h1u2 < t2h1u1 && t2h1u2 < t2h1d1 && t2h1u2 < t2w1rwt1 && t2h1u2 < t2w1lwt1 && t2h1u2 < t2h1uwt1 && t2h1u2 < t2h1dwt1
  && t2h1u2 < t2w1r2 && t2h1u2 < t2w1l2 && t2h1u2 < t2h1d2 && t2h1u2 < t2w1rwt2 && t2h1u2 < t2w1lwt2 && t2h1u2 < t2h1uwt2 && t2h1u2 < t2h1dwt2
  && t2h1u2 < t2w1r3 && t2h1u2 < t2w1l3 && t2h1u2 < t2h1u3 && t2h1u2 < t2h1d3 && t2h1u2 < t2w1rwt3 && t2h1u2 < t2w1lwt3 && t2h1u2 < t2h1uwt3 && t2h1u2 < t2h1dwt3
  && t2h1u2 < t2w1r4 && t2h1u2 < t2w1l4 && t2h1u2 < t2h1u4 && t2h1u2 < t2h1d4 && t2h1u2 < t2w1rwt4 && t2h1u2 < t2w1lwt4 && t2h1u2 < t2h1uwt4 && t2h1u2 < t2h1dwt4
  && t2h1u2 < t2w1r5 && t2h1u2 < t2w1l5 && t2h1u2 < t2h1u5 && t2h1u2 < t2h1d5 && t2h1u2 < t2w1rwt5 && t2h1u2 < t2w1lwt5 && t2h1u2 < t2h1uwt5 && t2h1u2 < t2h1dwt5
  && t2h1u2 < t2w1r6 && t2h1u2 < t2w1l6 && t2h1u2 < t2h1u6 && t2h1u2 < t2h1d6 && t2h1u2 < t2w1rwt6 && t2h1u2 < t2w1lwt6 && t2h1u2 < t2h1uwt6 && t2h1u2 < t2h1dwt6
  && t2h1u2 < t2w1r7 && t2h1u2 < t2w1l7 && t2h1u2 < t2h1u7 && t2h1u2 < t2h1d7 && t2h1u2 < t2w1rwt7 && t2h1u2 < t2w1lwt7 && t2h1u2 < t2h1uwt7 && t2h1u2 < t2h1dwt7
  && t2h1u2 < t2w1r8 && t2h1u2 < t2w1l8 && t2h1u2 < t2h1u8 && t2h1u2 < t2h1d8 && t2h1u2 < t2w1rwt8 && t2h1u2 < t2w1lwt8 && t2h1u2 < t2h1uwt8 && t2h1u2 < t2h1dwt8
  && t2h1u2 < t2w1r9 && t2h1u2 < t2w1l9 && t2h1u2 < t2h1u9 && t2h1u2 < t2h1d9 && t2h1u2 < t2w1rwt9 && t2h1u2 < t2w1lwt9 && t2h1u2 < t2h1uwt9 && t2h1u2 < t2h1dwt9
  && t2h1u2 < t2w1r10 && t2h1u2 < t2w1l10 && t2h1u2 < t2h1u10 && t2h1u2 < t2h1d10 && t2h1u2 < t2w1rwt10 && t2h1u2 < t2w1lwt10 && t2h1u2 < t2h1uwt10 && t2h1u2 < t2h1dwt10
  && ((louthu2!=0 && linhu2==0) || (louthu2==0 && linhu2!=0))){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1u2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1u2+z))*(z0wr2+(vz*t2h1u2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1u2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1u2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1u2+z))*(z0wl2+(vz*t2h1u2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1u2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1u2+x;
  ylimitu=sqrt(pbhu2-(vz*t2h1u2+z)/pahu2);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu2>0){
  i=89;
  }else{
  i=100;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu2!=-1 && t2h1u2 > 0 && t2h1u2 < t1 
  && t2h1u2 < t2w1r && t2h1u2 < t2w1l && t2h1u2 < t2h1u && t2h1u2 < t2h1d && t2h1u2 < t2w1rwt && t2h1u2 < t2w1lwt && t2h1u2 < t2h1uwt && t2h1u2 < t2h1dwt
  && t2h1u2 < t2w1r1 && t2h1u2 < t2w1l1 && t2h1u2 < t2h1u1 && t2h1u2 < t2h1d1 && t2h1u2 < t2w1rwt1 && t2h1u2 < t2w1lwt1 && t2h1u2 < t2h1uwt1 && t2h1u2 < t2h1dwt1
  && t2h1u2 < t2w1r2 && t2h1u2 < t2w1l2 && t2h1u2 < t2h1d2 && t2h1u2 < t2w1rwt2 && t2h1u2 < t2w1lwt2 && t2h1u2 < t2h1uwt2 && t2h1u2 < t2h1dwt2
  && t2h1u2 < t2w1r3 && t2h1u2 < t2w1l3 && t2h1u2 < t2h1u3 && t2h1u2 < t2h1d3 && t2h1u2 < t2w1rwt3 && t2h1u2 < t2w1lwt3 && t2h1u2 < t2h1uwt3 && t2h1u2 < t2h1dwt3
  && t2h1u2 < t2w1r4 && t2h1u2 < t2w1l4 && t2h1u2 < t2h1u4 && t2h1u2 < t2h1d4 && t2h1u2 < t2w1rwt4 && t2h1u2 < t2w1lwt4 && t2h1u2 < t2h1uwt4 && t2h1u2 < t2h1dwt4
  && t2h1u2 < t2w1r5 && t2h1u2 < t2w1l5 && t2h1u2 < t2h1u5 && t2h1u2 < t2h1d5 && t2h1u2 < t2w1rwt5 && t2h1u2 < t2w1lwt5 && t2h1u2 < t2h1uwt5 && t2h1u2 < t2h1dwt5
  && t2h1u2 < t2w1r6 && t2h1u2 < t2w1l6 && t2h1u2 < t2h1u6 && t2h1u2 < t2h1d6 && t2h1u2 < t2w1rwt6 && t2h1u2 < t2w1lwt6 && t2h1u2 < t2h1uwt6 && t2h1u2 < t2h1dwt6
  && t2h1u2 < t2w1r7 && t2h1u2 < t2w1l7 && t2h1u2 < t2h1u7 && t2h1u2 < t2h1d7 && t2h1u2 < t2w1rwt7 && t2h1u2 < t2w1lwt7 && t2h1u2 < t2h1uwt7 && t2h1u2 < t2h1dwt7
  && t2h1u2 < t2w1r8 && t2h1u2 < t2w1l8 && t2h1u2 < t2h1u8 && t2h1u2 < t2h1d8 && t2h1u2 < t2w1rwt8 && t2h1u2 < t2w1lwt8 && t2h1u2 < t2h1uwt8 && t2h1u2 < t2h1dwt8
  && t2h1u2 < t2w1r9 && t2h1u2 < t2w1l9 && t2h1u2 < t2h1u9 && t2h1u2 < t2h1d9 && t2h1u2 < t2w1rwt9 && t2h1u2 < t2w1lwt9 && t2h1u2 < t2h1uwt9 && t2h1u2 < t2h1dwt9
  && t2h1u2 < t2w1r10 && t2h1u2 < t2w1l10 && t2h1u2 < t2h1u10 && t2h1u2 < t2h1d10 && t2h1u2 < t2w1rwt10 && t2h1u2 < t2w1lwt10 && t2h1u2 < t2h1uwt10 && t2h1u2 < t2h1dwt10
  && (louthu2 == 0 && linhu2 == 0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1u2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1u2+z))*(z0wr2+(vz*t2h1u2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1u2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1u2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1u2+z))*(z0wl2+(vz*t2h1u2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1u2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1u2+x;
  ylimitu=(h2u2-h1u2)*(vz*t2h1u2+z)/l+h1u2;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu2>0 ){
  i=90;
  }else{
  i=100;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd2!=-1 && t2h1d2 > 0 && t2h1d2 < t1 
  && t2h1d2 < t2w1r && t2h1d2 < t2w1l && t2h1d2 < t2h1u && t2h1d2 < t2h1d && t2h1d2 < t2w1rwt && t2h1d2 < t2w1lwt && t2h1d2 < t2h1uwt && t2h1d2 < t2h1dwt
  && t2h1d2 < t2w1r1 && t2h1d2 < t2w1l1 && t2h1d2 < t2h1u1 && t2h1d2 < t2h1d1 && t2h1d2 < t2w1rwt1 && t2h1d2 < t2w1lwt1 && t2h1d2 < t2h1uwt1 && t2h1d2 < t2h1dwt1
  && t2h1d2 < t2w1r2 && t2h1d2 < t2w1l2 && t2h1d2 < t2h1u2 && t2h1d2 < t2w1rwt2 && t2h1d2 < t2w1lwt2 && t2h1d2 < t2h1uwt2 && t2h1d2 < t2h1dwt2
  && t2h1d2 < t2w1r3 && t2h1d2 < t2w1l3 && t2h1d2 < t2h1u3 && t2h1d2 < t2h1d3 && t2h1d2 < t2w1rwt3 && t2h1d2 < t2w1lwt3 && t2h1d2 < t2h1uwt3 && t2h1d2 < t2h1dwt3
  && t2h1d2 < t2w1r4 && t2h1d2 < t2w1l4 && t2h1d2 < t2h1u4 && t2h1d2 < t2h1d4 && t2h1d2 < t2w1rwt4 && t2h1d2 < t2w1lwt4 && t2h1d2 < t2h1uwt4 && t2h1d2 < t2h1dwt4
  && t2h1d2 < t2w1r5 && t2h1d2 < t2w1l5 && t2h1d2 < t2h1u5 && t2h1d2 < t2h1d5 && t2h1d2 < t2w1rwt5 && t2h1d2 < t2w1lwt5 && t2h1d2 < t2h1uwt5 && t2h1d2 < t2h1dwt5
  && t2h1d2 < t2w1r6 && t2h1d2 < t2w1l6 && t2h1d2 < t2h1u6 && t2h1d2 < t2h1d6 && t2h1d2 < t2w1rwt6 && t2h1d2 < t2w1lwt6 && t2h1d2 < t2h1uwt6 && t2h1d2 < t2h1dwt6
  && t2h1d2 < t2w1r7 && t2h1d2 < t2w1l7 && t2h1d2 < t2h1u7 && t2h1d2 < t2h1d7 && t2h1d2 < t2w1rwt7 && t2h1d2 < t2w1lwt7 && t2h1d2 < t2h1uwt7 && t2h1d2 < t2h1dwt7
  && t2h1d2 < t2w1r8 && t2h1d2 < t2w1l8 && t2h1d2 < t2h1u8 && t2h1d2 < t2h1d8 && t2h1d2 < t2w1rwt8 && t2h1d2 < t2w1lwt8 && t2h1d2 < t2h1uwt8 && t2h1d2 < t2h1dwt8
  && t2h1d2 < t2w1r9 && t2h1d2 < t2w1l9 && t2h1d2 < t2h1u9 && t2h1d2 < t2h1d9 && t2h1d2 < t2w1rwt9 && t2h1d2 < t2w1lwt9 && t2h1d2 < t2h1uwt9 && t2h1d2 < t2h1dwt9
  && t2h1d2 < t2w1r10 && t2h1d2 < t2w1l10 && t2h1d2 < t2h1u10 && t2h1d2 < t2h1d10 && t2h1d2 < t2w1rwt10 && t2h1d2 < t2w1lwt10 && t2h1d2 < t2h1uwt10 && t2h1d2 < t2h1dwt10
  && (louthd2 !=0 && linhd2!=0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1d2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1d2+z))*(z0wr2+(vz*t2h1d2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1d2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1d2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1d2+z))*(z0wl2+(vz*t2h1d2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1d2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1d2+x;
  ylimitd=-bhd2*sqrt(1-((vz*t2h1d2+z)+z0hd2)*((vz*t2h1d2+z)+z0hd2)/a2hd2);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd2>0){
  i=91;
  }else{
  i=101;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd2!=-1 && t2h1d2 > 0 && t2h1d2 < t1 
  && t2h1d2 < t2w1r && t2h1d2 < t2w1l && t2h1d2 < t2h1u && t2h1d2 < t2h1d && t2h1d2 < t2w1rwt && t2h1d2 < t2w1lwt && t2h1d2 < t2h1uwt && t2h1d2 < t2h1dwt
  && t2h1d2 < t2w1r1 && t2h1d2 < t2w1l1 && t2h1d2 < t2h1u1 && t2h1d2 < t2h1d1 && t2h1d2 < t2w1rwt1 && t2h1d2 < t2w1lwt1 && t2h1d2 < t2h1uwt1 && t2h1d2 < t2h1dwt1
  && t2h1d2 < t2w1r2 && t2h1d2 < t2w1l2 && t2h1d2 < t2h1u2 && t2h1d2 < t2w1rwt2 && t2h1d2 < t2w1lwt2 && t2h1d2 < t2h1uwt2 && t2h1d2 < t2h1dwt2
  && t2h1d2 < t2w1r3 && t2h1d2 < t2w1l3 && t2h1d2 < t2h1u3 && t2h1d2 < t2h1d3 && t2h1d2 < t2w1rwt3 && t2h1d2 < t2w1lwt3 && t2h1d2 < t2h1uwt3 && t2h1d2 < t2h1dwt3
  && t2h1d2 < t2w1r4 && t2h1d2 < t2w1l4 && t2h1d2 < t2h1u4 && t2h1d2 < t2h1d4 && t2h1d2 < t2w1rwt4 && t2h1d2 < t2w1lwt4 && t2h1d2 < t2h1uwt4 && t2h1d2 < t2h1dwt4
  && t2h1d2 < t2w1r5 && t2h1d2 < t2w1l5 && t2h1d2 < t2h1u5 && t2h1d2 < t2h1d5 && t2h1d2 < t2w1rwt5 && t2h1d2 < t2w1lwt5 && t2h1d2 < t2h1uwt5 && t2h1d2 < t2h1dwt5
  && t2h1d2 < t2w1r6 && t2h1d2 < t2w1l6 && t2h1d2 < t2h1u6 && t2h1d2 < t2h1d6 && t2h1d2 < t2w1rwt6 && t2h1d2 < t2w1lwt6 && t2h1d2 < t2h1uwt6 && t2h1d2 < t2h1dwt6
  && t2h1d2 < t2w1r7 && t2h1d2 < t2w1l7 && t2h1d2 < t2h1u7 && t2h1d2 < t2h1d7 && t2h1d2 < t2w1rwt7 && t2h1d2 < t2w1lwt7 && t2h1d2 < t2h1uwt7 && t2h1d2 < t2h1dwt7
  && t2h1d2 < t2w1r8 && t2h1d2 < t2w1l8 && t2h1d2 < t2h1u8 && t2h1d2 < t2h1d8 && t2h1d2 < t2w1rwt8 && t2h1d2 < t2w1lwt8 && t2h1d2 < t2h1uwt8 && t2h1d2 < t2h1dwt8
  && t2h1d2 < t2w1r9 && t2h1d2 < t2w1l9 && t2h1d2 < t2h1u9 && t2h1d2 < t2h1d9 && t2h1d2 < t2w1rwt9 && t2h1d2 < t2w1lwt9 && t2h1d2 < t2h1uwt9 && t2h1d2 < t2h1dwt9
  && t2h1d2 < t2w1r10 && t2h1d2 < t2w1l10 && t2h1d2 < t2h1u10 && t2h1d2 < t2h1d10 && t2h1d2 < t2w1rwt10 && t2h1d2 < t2w1lwt10 && t2h1d2 < t2h1uwt10 && t2h1d2 < t2h1dwt10
  && ((louthd2 !=0 && linhd2==0) || (louthd2 ==0 && linhd2!=0))){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1d2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1d2+z))*(z0wr2+(vz*t2h1d2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1d2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1d2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1d2+z))*(z0wl2+(vz*t2h1d2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1d2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1d2+x;
  ylimitd=-sqrt(pbhd2-(vz*t2h1d2+z)/pahd2);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd2>0 ){
  i=92;
  }else{
  i=101;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd2!=-1 && t2h1d2 > 0 && t2h1d2 < t1 
  && t2h1d2 < t2w1r && t2h1d2 < t2w1l && t2h1d2 < t2h1u && t2h1d2 < t2h1d && t2h1d2 < t2w1rwt && t2h1d2 < t2w1lwt && t2h1d2 < t2h1uwt && t2h1d2 < t2h1dwt
  && t2h1d2 < t2w1r1 && t2h1d2 < t2w1l1 && t2h1d2 < t2h1u1 && t2h1d2 < t2h1d1 && t2h1d2 < t2w1rwt1 && t2h1d2 < t2w1lwt1 && t2h1d2 < t2h1uwt1 && t2h1d2 < t2h1dwt1
  && t2h1d2 < t2w1r2 && t2h1d2 < t2w1l2 && t2h1d2 < t2h1u2 && t2h1d2 < t2w1rwt2 && t2h1d2 < t2w1lwt2 && t2h1d2 < t2h1uwt2 && t2h1d2 < t2h1dwt2
  && t2h1d2 < t2w1r3 && t2h1d2 < t2w1l3 && t2h1d2 < t2h1u3 && t2h1d2 < t2h1d3 && t2h1d2 < t2w1rwt3 && t2h1d2 < t2w1lwt3 && t2h1d2 < t2h1uwt3 && t2h1d2 < t2h1dwt3
  && t2h1d2 < t2w1r4 && t2h1d2 < t2w1l4 && t2h1d2 < t2h1u4 && t2h1d2 < t2h1d4 && t2h1d2 < t2w1rwt4 && t2h1d2 < t2w1lwt4 && t2h1d2 < t2h1uwt4 && t2h1d2 < t2h1dwt4
  && t2h1d2 < t2w1r5 && t2h1d2 < t2w1l5 && t2h1d2 < t2h1u5 && t2h1d2 < t2h1d5 && t2h1d2 < t2w1rwt5 && t2h1d2 < t2w1lwt5 && t2h1d2 < t2h1uwt5 && t2h1d2 < t2h1dwt5
  && t2h1d2 < t2w1r6 && t2h1d2 < t2w1l6 && t2h1d2 < t2h1u6 && t2h1d2 < t2h1d6 && t2h1d2 < t2w1rwt6 && t2h1d2 < t2w1lwt6 && t2h1d2 < t2h1uwt6 && t2h1d2 < t2h1dwt6
  && t2h1d2 < t2w1r7 && t2h1d2 < t2w1l7 && t2h1d2 < t2h1u7 && t2h1d2 < t2h1d7 && t2h1d2 < t2w1rwt7 && t2h1d2 < t2w1lwt7 && t2h1d2 < t2h1uwt7 && t2h1d2 < t2h1dwt7
  && t2h1d2 < t2w1r8 && t2h1d2 < t2w1l8 && t2h1d2 < t2h1u8 && t2h1d2 < t2h1d8 && t2h1d2 < t2w1rwt8 && t2h1d2 < t2w1lwt8 && t2h1d2 < t2h1uwt8 && t2h1d2 < t2h1dwt8
  && t2h1d2 < t2w1r9 && t2h1d2 < t2w1l9 && t2h1d2 < t2h1u9 && t2h1d2 < t2h1d9 && t2h1d2 < t2w1rwt9 && t2h1d2 < t2w1lwt9 && t2h1d2 < t2h1uwt9 && t2h1d2 < t2h1dwt9
  && t2h1d2 < t2w1r10 && t2h1d2 < t2w1l10 && t2h1d2 < t2h1u10 && t2h1d2 < t2h1d10 && t2h1d2 < t2w1rwt10 && t2h1d2 < t2w1lwt10 && t2h1d2 < t2h1uwt10 && t2h1d2 < t2h1dwt10
  && (louthd2 == 0 && linhd2 == 0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1d2+z)-w1r2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwr2*sqrt(1-((z0wr2+(vz*t2h1d2+z))*(z0wr2+(vz*t2h1d2+z)))/a2wr2);
    }else{
    xlimitr=-sqrt(((vz*t2h1d2+z)-pbwr2)/-pawr2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1d2+z)+w1l2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwl2*sqrt(1-((z0wl2+(vz*t2h1d2+z))*(z0wl2+(vz*t2h1d2+z)))/a2wl2);
      }else{
      xlimitl=sqrt(((vz*t2h1d2+z)-pbwl2)/-pawl2);
      }
   }
  xtest=vx*t2h1d2+x;
  ylimitd=(-h2d2+h1d2)*(vz*t2h1d2+z)/l-h1d2;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd2>0 ){
  i=93;
  }else{
  i=101;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr2==-1 && t2w1r2 > 0 && t2w1r2 < t1 
     && t2w1r2 < t2w1r && t2w1r2 < t2w1l && t2w1r2 < t2h1u && t2w1r2 < t2h1d && t2w1r2 < t2w1rwt && t2w1r2 < t2w1lwt && t2w1r2 < t2h1uwt && t2w1r2 < t2h1dwt
     && t2w1r2 < t2w1r1 && t2w1r2 < t2w1l1 && t2w1r2 < t2h1u1 && t2w1r2 < t2h1d1 && t2w1r2 < t2w1rwt1 && t2w1r2 < t2w1lwt1 && t2w1r2 < t2h1uwt1 && t2w1r2 < t2h1dwt1
     && t2w1r2 < t2w1l2 && t2w1r2 < t2h1u2 && t2w1r2 < t2h1d2 && t2w1r2 < t2w1rwt2 && t2w1r2 < t2w1lwt2 && t2w1r2 < t2h1uwt2 && t2w1r2 < t2h1dwt2 
     && t2w1r2 < t2w1r3 && t2w1r2 < t2w1l3 && t2w1r2 < t2h1u3 && t2w1r2 < t2h1d3 && t2w1r2 < t2w1rwt3 && t2w1r2 < t2w1lwt3 && t2w1r2 < t2h1uwt3 && t2w1r2 < t2h1dwt3
     && t2w1r2 < t2w1r4 && t2w1r2 < t2w1l4 && t2w1r2 < t2h1u4 && t2w1r2 < t2h1d4 && t2w1r2 < t2w1rwt4 && t2w1r2 < t2w1lwt4 && t2w1r2 < t2h1uwt4 && t2w1r2 < t2h1dwt4
     && t2w1r2 < t2w1r5 && t2w1r2 < t2w1l5 && t2w1r2 < t2h1u5 && t2w1r2 < t2h1d5 && t2w1r2 < t2w1rwt5 && t2w1r2 < t2w1lwt5 && t2w1r2 < t2h1uwt5 && t2w1r2 < t2h1dwt5
     && t2w1r2 < t2w1r6 && t2w1r2 < t2w1l6 && t2w1r2 < t2h1u6 && t2w1r2 < t2h1d6 && t2w1r2 < t2w1rwt6 && t2w1r2 < t2w1lwt6 && t2w1r2 < t2h1uwt6 && t2w1r2 < t2h1dwt6
     && t2w1r2 < t2w1r7 && t2w1r2 < t2w1l7 && t2w1r2 < t2h1u7 && t2w1r2 < t2h1d7 && t2w1r2 < t2w1rwt7 && t2w1r2 < t2w1lwt7 && t2w1r2 < t2h1uwt7 && t2w1r2 < t2h1dwt7
     && t2w1r2 < t2w1r8 && t2w1r2 < t2w1l8 && t2w1r2 < t2h1u8 && t2w1r2 < t2h1d8 && t2w1r2 < t2w1rwt8 && t2w1r2 < t2w1lwt8 && t2w1r2 < t2h1uwt8 && t2w1r2 < t2h1dwt8
     && t2w1r2 < t2w1r9 && t2w1r2 < t2w1l9 && t2w1r2 < t2h1u9 && t2w1r2 < t2h1d9 && t2w1r2 < t2w1rwt9 && t2w1r2 < t2w1lwt9 && t2w1r2 < t2h1uwt9 && t2w1r2 < t2h1dwt9
     && t2w1r2 < t2w1r10 && t2w1r2 < t2w1l10 && t2w1r2 < t2h1u10 && t2w1r2 < t2h1d10 && t2w1r2 < t2w1rwt10 && t2w1r2 < t2w1lwt10 && t2w1r2 < t2h1uwt10 && t2w1r2 < t2h1dwt10
     && ((linwr2!=0) && (loutwr2!=0) )) {
  i=94;
  }

  if (mxr2==-1 && t2w1r2 > 0 && t2w1r2 < t1 
     && t2w1r2 < t2w1r && t2w1r2 < t2w1l && t2w1r2 < t2h1u && t2w1r2 < t2h1d && t2w1r2 < t2w1rwt && t2w1r2 < t2w1lwt && t2w1r2 < t2h1uwt && t2w1r2 < t2h1dwt
     && t2w1r2 < t2w1r1 && t2w1r2 < t2w1l1 && t2w1r2 < t2h1u1 && t2w1r2 < t2h1d1 && t2w1r2 < t2w1rwt1 && t2w1r2 < t2w1lwt1 && t2w1r2 < t2h1uwt1 && t2w1r2 < t2h1dwt1
     && t2w1r2 < t2w1l2 && t2w1r2 < t2h1u2 && t2w1r2 < t2h1d2 && t2w1r2 < t2w1rwt2 && t2w1r2 < t2w1lwt2 && t2w1r2 < t2h1uwt2 && t2w1r2 < t2h1dwt2 
     && t2w1r2 < t2w1r3 && t2w1r2 < t2w1l3 && t2w1r2 < t2h1u3 && t2w1r2 < t2h1d3 && t2w1r2 < t2w1rwt3 && t2w1r2 < t2w1lwt3 && t2w1r2 < t2h1uwt3 && t2w1r2 < t2h1dwt3
     && t2w1r2 < t2w1r4 && t2w1r2 < t2w1l4 && t2w1r2 < t2h1u4 && t2w1r2 < t2h1d4 && t2w1r2 < t2w1rwt4 && t2w1r2 < t2w1lwt4 && t2w1r2 < t2h1uwt4 && t2w1r2 < t2h1dwt4
     && t2w1r2 < t2w1r5 && t2w1r2 < t2w1l5 && t2w1r2 < t2h1u5 && t2w1r2 < t2h1d5 && t2w1r2 < t2w1rwt5 && t2w1r2 < t2w1lwt5 && t2w1r2 < t2h1uwt5 && t2w1r2 < t2h1dwt5
     && t2w1r2 < t2w1r6 && t2w1r2 < t2w1l6 && t2w1r2 < t2h1u6 && t2w1r2 < t2h1d6 && t2w1r2 < t2w1rwt6 && t2w1r2 < t2w1lwt6 && t2w1r2 < t2h1uwt6 && t2w1r2 < t2h1dwt6
     && t2w1r2 < t2w1r7 && t2w1r2 < t2w1l7 && t2w1r2 < t2h1u7 && t2w1r2 < t2h1d7 && t2w1r2 < t2w1rwt7 && t2w1r2 < t2w1lwt7 && t2w1r2 < t2h1uwt7 && t2w1r2 < t2h1dwt7
     && t2w1r2 < t2w1r8 && t2w1r2 < t2w1l8 && t2w1r2 < t2h1u8 && t2w1r2 < t2h1d8 && t2w1r2 < t2w1rwt8 && t2w1r2 < t2w1lwt8 && t2w1r2 < t2h1uwt8 && t2w1r2 < t2h1dwt8
     && t2w1r2 < t2w1r9 && t2w1r2 < t2w1l9 && t2w1r2 < t2h1u9 && t2w1r2 < t2h1d9 && t2w1r2 < t2w1rwt9 && t2w1r2 < t2w1lwt9 && t2w1r2 < t2h1uwt9 && t2w1r2 < t2h1dwt9
     && t2w1r2 < t2w1r10 && t2w1r2 < t2w1l10 && t2w1r2 < t2h1u10 && t2w1r2 < t2h1d10 && t2w1r2 < t2w1rwt10 && t2w1r2 < t2w1lwt10 && t2w1r2 < t2h1uwt10 && t2w1r2 < t2h1dwt10
     && ((loutwr2!=0 && linwr2==0) || (loutwr2==0 && linwr2!=0))){
  i=94;
  }

  if (mxr2==-1 && t2w1r2 > 0 && t2w1r2 < t1 
     && t2w1r2 < t2w1r && t2w1r2 < t2w1l && t2w1r2 < t2h1u && t2w1r2 < t2h1d && t2w1r2 < t2w1rwt && t2w1r2 < t2w1lwt && t2w1r2 < t2h1uwt && t2w1r2 < t2h1dwt
     && t2w1r2 < t2w1r1 && t2w1r2 < t2w1l1 && t2w1r2 < t2h1u1 && t2w1r2 < t2h1d1 && t2w1r2 < t2w1rwt1 && t2w1r2 < t2w1lwt1 && t2w1r2 < t2h1uwt1 && t2w1r2 < t2h1dwt1
     && t2w1r2 < t2w1l2 && t2w1r2 < t2h1u2 && t2w1r2 < t2h1d2 && t2w1r2 < t2w1rwt2 && t2w1r2 < t2w1lwt2 && t2w1r2 < t2h1uwt2 && t2w1r2 < t2h1dwt2 
     && t2w1r2 < t2w1r3 && t2w1r2 < t2w1l3 && t2w1r2 < t2h1u3 && t2w1r2 < t2h1d3 && t2w1r2 < t2w1rwt3 && t2w1r2 < t2w1lwt3 && t2w1r2 < t2h1uwt3 && t2w1r2 < t2h1dwt3
     && t2w1r2 < t2w1r4 && t2w1r2 < t2w1l4 && t2w1r2 < t2h1u4 && t2w1r2 < t2h1d4 && t2w1r2 < t2w1rwt4 && t2w1r2 < t2w1lwt4 && t2w1r2 < t2h1uwt4 && t2w1r2 < t2h1dwt4
     && t2w1r2 < t2w1r5 && t2w1r2 < t2w1l5 && t2w1r2 < t2h1u5 && t2w1r2 < t2h1d5 && t2w1r2 < t2w1rwt5 && t2w1r2 < t2w1lwt5 && t2w1r2 < t2h1uwt5 && t2w1r2 < t2h1dwt5
     && t2w1r2 < t2w1r6 && t2w1r2 < t2w1l6 && t2w1r2 < t2h1u6 && t2w1r2 < t2h1d6 && t2w1r2 < t2w1rwt6 && t2w1r2 < t2w1lwt6 && t2w1r2 < t2h1uwt6 && t2w1r2 < t2h1dwt6
     && t2w1r2 < t2w1r7 && t2w1r2 < t2w1l7 && t2w1r2 < t2h1u7 && t2w1r2 < t2h1d7 && t2w1r2 < t2w1rwt7 && t2w1r2 < t2w1lwt7 && t2w1r2 < t2h1uwt7 && t2w1r2 < t2h1dwt7
     && t2w1r2 < t2w1r8 && t2w1r2 < t2w1l8 && t2w1r2 < t2h1u8 && t2w1r2 < t2h1d8 && t2w1r2 < t2w1rwt8 && t2w1r2 < t2w1lwt8 && t2w1r2 < t2h1uwt8 && t2w1r2 < t2h1dwt8
     && t2w1r2 < t2w1r9 && t2w1r2 < t2w1l9 && t2w1r2 < t2h1u9 && t2w1r2 < t2h1d9 && t2w1r2 < t2w1rwt9 && t2w1r2 < t2w1lwt9 && t2w1r2 < t2h1uwt9 && t2w1r2 < t2h1dwt9
     && t2w1r2 < t2w1r10 && t2w1r2 < t2w1l10 && t2w1r2 < t2h1u10 && t2w1r2 < t2h1d10 && t2w1r2 < t2w1rwt10 && t2w1r2 < t2w1lwt10 && t2w1r2 < t2h1uwt10 && t2w1r2 < t2h1dwt10
     && (loutwr2==0 && linwr2==0)){
  i=94;
  }

  if (mxl2==-1 && t2w1l2 > 0 && t2w1l2 < t1 
      && t2w1l2 < t2w1r && t2w1l2 < t2w1l && t2w1l2 < t2h1u && t2w1l2 < t2h1d && t2w1l2 < t2w1rwt && t2w1l2 < t2w1lwt && t2w1l2 < t2h1uwt && t2w1l2 < t2h1dwt
      && t2w1l2 < t2w1r1 && t2w1l2 < t2w1l1 && t2w1l2 < t2h1u1 && t2w1l2 < t2h1d1 && t2w1l2 < t2w1rwt1 && t2w1l2 < t2w1lwt1 && t2w1l2 < t2h1uwt1 && t2w1l2 < t2h1dwt1
      && t2w1l2 < t2w1r2 && t2w1l2 < t2h1u2 && t2w1l2 < t2h1d2 && t2w1l2 < t2w1rwt2 && t2w1l2 < t2w1lwt2 && t2w1l2 < t2h1uwt2 && t2w1l2 < t2h1dwt2
      && t2w1l2 < t2w1r3 && t2w1l2 < t2w1l3 && t2w1l2 < t2h1u3 && t2w1l2 < t2h1d3 && t2w1l2 < t2w1rwt3 && t2w1l2 < t2w1lwt3 && t2w1l2 < t2h1uwt3 && t2w1l2 < t2h1dwt3
      && t2w1l2 < t2w1r4 && t2w1l2 < t2w1l4 && t2w1l2 < t2h1u4 && t2w1l2 < t2h1d4 && t2w1l2 < t2w1rwt4 && t2w1l2 < t2w1lwt4 && t2w1l2 < t2h1uwt4 && t2w1l2 < t2h1dwt4
      && t2w1l2 < t2w1r5 && t2w1l2 < t2w1l5 && t2w1l2 < t2h1u5 && t2w1l2 < t2h1d5 && t2w1l2 < t2w1rwt5 && t2w1l2 < t2w1lwt5 && t2w1l2 < t2h1uwt5 && t2w1l2 < t2h1dwt5
      && t2w1l2 < t2w1r6 && t2w1l2 < t2w1l6 && t2w1l2 < t2h1u6 && t2w1l2 < t2h1d6 && t2w1l2 < t2w1rwt6 && t2w1l2 < t2w1lwt6 && t2w1l2 < t2h1uwt6 && t2w1l2 < t2h1dwt6
      && t2w1l2 < t2w1r7 && t2w1l2 < t2w1l7 && t2w1l2 < t2h1u7 && t2w1l2 < t2h1d7 && t2w1l2 < t2w1rwt7 && t2w1l2 < t2w1lwt7 && t2w1l2 < t2h1uwt7 && t2w1l2 < t2h1dwt7
      && t2w1l2 < t2w1r8 && t2w1l2 < t2w1l8 && t2w1l2 < t2h1u8 && t2w1l2 < t2h1d8 && t2w1l2 < t2w1rwt8 && t2w1l2 < t2w1lwt8 && t2w1l2 < t2h1uwt8 && t2w1l2 < t2h1dwt8
      && t2w1l2 < t2w1r9 && t2w1l2 < t2w1l9 && t2w1l2 < t2h1u9 && t2w1l2 < t2h1d9 && t2w1l2 < t2w1rwt9 && t2w1l2 < t2w1lwt9 && t2w1l2 < t2h1uwt9 && t2w1l2 < t2h1dwt9
      && t2w1l2 < t2w1r10 && t2w1l2 < t2w1l10 && t2w1l2 < t2h1u10 && t2w1l2 < t2h1d10 && t2w1l2 < t2w1rwt10 && t2w1l2 < t2w1lwt10 && t2w1l2 < t2h1uwt10 && t2w1l2 < t2h1dwt10
      && ((linwl2!=0) && (loutwl2!=0) )){
  i=95;
  }

  if (mxl2==-1 && t2w1l2 > 0 && t2w1l2 < t1 
      && t2w1l2 < t2w1r && t2w1l2 < t2w1l && t2w1l2 < t2h1u && t2w1l2 < t2h1d && t2w1l2 < t2w1rwt && t2w1l2 < t2w1lwt && t2w1l2 < t2h1uwt && t2w1l2 < t2h1dwt
      && t2w1l2 < t2w1r1 && t2w1l2 < t2w1l1 && t2w1l2 < t2h1u1 && t2w1l2 < t2h1d1 && t2w1l2 < t2w1rwt1 && t2w1l2 < t2w1lwt1 && t2w1l2 < t2h1uwt1 && t2w1l2 < t2h1dwt1
      && t2w1l2 < t2w1r2 && t2w1l2 < t2h1u2 && t2w1l2 < t2h1d2 && t2w1l2 < t2w1rwt2 && t2w1l2 < t2w1lwt2 && t2w1l2 < t2h1uwt2 && t2w1l2 < t2h1dwt2
      && t2w1l2 < t2w1r3 && t2w1l2 < t2w1l3 && t2w1l2 < t2h1u3 && t2w1l2 < t2h1d3 && t2w1l2 < t2w1rwt3 && t2w1l2 < t2w1lwt3 && t2w1l2 < t2h1uwt3 && t2w1l2 < t2h1dwt3
      && t2w1l2 < t2w1r4 && t2w1l2 < t2w1l4 && t2w1l2 < t2h1u4 && t2w1l2 < t2h1d4 && t2w1l2 < t2w1rwt4 && t2w1l2 < t2w1lwt4 && t2w1l2 < t2h1uwt4 && t2w1l2 < t2h1dwt4
      && t2w1l2 < t2w1r5 && t2w1l2 < t2w1l5 && t2w1l2 < t2h1u5 && t2w1l2 < t2h1d5 && t2w1l2 < t2w1rwt5 && t2w1l2 < t2w1lwt5 && t2w1l2 < t2h1uwt5 && t2w1l2 < t2h1dwt5
      && t2w1l2 < t2w1r6 && t2w1l2 < t2w1l6 && t2w1l2 < t2h1u6 && t2w1l2 < t2h1d6 && t2w1l2 < t2w1rwt6 && t2w1l2 < t2w1lwt6 && t2w1l2 < t2h1uwt6 && t2w1l2 < t2h1dwt6
      && t2w1l2 < t2w1r7 && t2w1l2 < t2w1l7 && t2w1l2 < t2h1u7 && t2w1l2 < t2h1d7 && t2w1l2 < t2w1rwt7 && t2w1l2 < t2w1lwt7 && t2w1l2 < t2h1uwt7 && t2w1l2 < t2h1dwt7
      && t2w1l2 < t2w1r8 && t2w1l2 < t2w1l8 && t2w1l2 < t2h1u8 && t2w1l2 < t2h1d8 && t2w1l2 < t2w1rwt8 && t2w1l2 < t2w1lwt8 && t2w1l2 < t2h1uwt8 && t2w1l2 < t2h1dwt8
      && t2w1l2 < t2w1r9 && t2w1l2 < t2w1l9 && t2w1l2 < t2h1u9 && t2w1l2 < t2h1d9 && t2w1l2 < t2w1rwt9 && t2w1l2 < t2w1lwt9 && t2w1l2 < t2h1uwt9 && t2w1l2 < t2h1dwt9
      && t2w1l2 < t2w1r10 && t2w1l2 < t2w1l10 && t2w1l2 < t2h1u10 && t2w1l2 < t2h1d10 && t2w1l2 < t2w1rwt10 && t2w1l2 < t2w1lwt10 && t2w1l2 < t2h1uwt10 && t2w1l2 < t2h1dwt10
      &&  ((loutwl2!=0 && linwl2==0) || (loutwl2==0 && linwl2!=0))){
  i=95;
  }

  if (mxl2==-1 && t2w1l2 > 0 && t2w1l2 < t1 
      && t2w1l2 < t2w1r && t2w1l2 < t2w1l && t2w1l2 < t2h1u && t2w1l2 < t2h1d && t2w1l2 < t2w1rwt && t2w1l2 < t2w1lwt && t2w1l2 < t2h1uwt && t2w1l2 < t2h1dwt
      && t2w1l2 < t2w1r1 && t2w1l2 < t2w1l1 && t2w1l2 < t2h1u1 && t2w1l2 < t2h1d1 && t2w1l2 < t2w1rwt1 && t2w1l2 < t2w1lwt1 && t2w1l2 < t2h1uwt1 && t2w1l2 < t2h1dwt1
      && t2w1l2 < t2w1r2 && t2w1l2 < t2h1u2 && t2w1l2 < t2h1d2 && t2w1l2 < t2w1rwt2 && t2w1l2 < t2w1lwt2 && t2w1l2 < t2h1uwt2 && t2w1l2 < t2h1dwt2
      && t2w1l2 < t2w1r3 && t2w1l2 < t2w1l3 && t2w1l2 < t2h1u3 && t2w1l2 < t2h1d3 && t2w1l2 < t2w1rwt3 && t2w1l2 < t2w1lwt3 && t2w1l2 < t2h1uwt3 && t2w1l2 < t2h1dwt3
      && t2w1l2 < t2w1r4 && t2w1l2 < t2w1l4 && t2w1l2 < t2h1u4 && t2w1l2 < t2h1d4 && t2w1l2 < t2w1rwt4 && t2w1l2 < t2w1lwt4 && t2w1l2 < t2h1uwt4 && t2w1l2 < t2h1dwt4
      && t2w1l2 < t2w1r5 && t2w1l2 < t2w1l5 && t2w1l2 < t2h1u5 && t2w1l2 < t2h1d5 && t2w1l2 < t2w1rwt5 && t2w1l2 < t2w1lwt5 && t2w1l2 < t2h1uwt5 && t2w1l2 < t2h1dwt5
      && t2w1l2 < t2w1r6 && t2w1l2 < t2w1l6 && t2w1l2 < t2h1u6 && t2w1l2 < t2h1d6 && t2w1l2 < t2w1rwt6 && t2w1l2 < t2w1lwt6 && t2w1l2 < t2h1uwt6 && t2w1l2 < t2h1dwt6
      && t2w1l2 < t2w1r7 && t2w1l2 < t2w1l7 && t2w1l2 < t2h1u7 && t2w1l2 < t2h1d7 && t2w1l2 < t2w1rwt7 && t2w1l2 < t2w1lwt7 && t2w1l2 < t2h1uwt7 && t2w1l2 < t2h1dwt7
      && t2w1l2 < t2w1r8 && t2w1l2 < t2w1l8 && t2w1l2 < t2h1u8 && t2w1l2 < t2h1d8 && t2w1l2 < t2w1rwt8 && t2w1l2 < t2w1lwt8 && t2w1l2 < t2h1uwt8 && t2w1l2 < t2h1dwt8
      && t2w1l2 < t2w1r9 && t2w1l2 < t2w1l9 && t2w1l2 < t2h1u9 && t2w1l2 < t2h1d9 && t2w1l2 < t2w1rwt9 && t2w1l2 < t2w1lwt9 && t2w1l2 < t2h1uwt9 && t2w1l2 < t2h1dwt9
      && t2w1l2 < t2w1r10 && t2w1l2 < t2w1l10 && t2w1l2 < t2h1u10 && t2w1l2 < t2h1d10 && t2w1l2 < t2w1rwt10 && t2w1l2 < t2w1lwt10 && t2w1l2 < t2h1uwt10 && t2w1l2 < t2h1dwt10
      && (loutwl2==0 && linwl2==0)){
  i=95;
  }

  if (myu2==-1 && t2h1u2 > 0 && t2h1u2 < t1 
  && t2h1u2 < t2w1r && t2h1u2 < t2w1l && t2h1u2 < t2h1u && t2h1u2 < t2h1d && t2h1u2 < t2w1rwt && t2h1u2 < t2w1lwt && t2h1u2 < t2h1uwt && t2h1u2 < t2h1dwt
  && t2h1u2 < t2w1r1 && t2h1u2 < t2w1l1 && t2h1u2 < t2h1u1 && t2h1u2 < t2h1d1 && t2h1u2 < t2w1rwt1 && t2h1u2 < t2w1lwt1 && t2h1u2 < t2h1uwt1 && t2h1u2 < t2h1dwt1
  && t2h1u2 < t2w1r2 && t2h1u2 < t2w1l2 && t2h1u2 < t2h1d2 && t2h1u2 < t2w1rwt2 && t2h1u2 < t2w1lwt2 && t2h1u2 < t2h1uwt2 && t2h1u2 < t2h1dwt2
  && t2h1u2 < t2w1r3 && t2h1u2 < t2w1l3 && t2h1u2 < t2h1u3 && t2h1u2 < t2h1d3 && t2h1u2 < t2w1rwt3 && t2h1u2 < t2w1lwt3 && t2h1u2 < t2h1uwt3 && t2h1u2 < t2h1dwt3
  && t2h1u2 < t2w1r4 && t2h1u2 < t2w1l4 && t2h1u2 < t2h1u4 && t2h1u2 < t2h1d4 && t2h1u2 < t2w1rwt4 && t2h1u2 < t2w1lwt4 && t2h1u2 < t2h1uwt4 && t2h1u2 < t2h1dwt4
  && t2h1u2 < t2w1r5 && t2h1u2 < t2w1l5 && t2h1u2 < t2h1u5 && t2h1u2 < t2h1d5 && t2h1u2 < t2w1rwt5 && t2h1u2 < t2w1lwt5 && t2h1u2 < t2h1uwt5 && t2h1u2 < t2h1dwt5
  && t2h1u2 < t2w1r6 && t2h1u2 < t2w1l6 && t2h1u2 < t2h1u6 && t2h1u2 < t2h1d6 && t2h1u2 < t2w1rwt6 && t2h1u2 < t2w1lwt6 && t2h1u2 < t2h1uwt6 && t2h1u2 < t2h1dwt6
  && t2h1u2 < t2w1r7 && t2h1u2 < t2w1l7 && t2h1u2 < t2h1u7 && t2h1u2 < t2h1d7 && t2h1u2 < t2w1rwt7 && t2h1u2 < t2w1lwt7 && t2h1u2 < t2h1uwt7 && t2h1u2 < t2h1dwt7
  && t2h1u2 < t2w1r8 && t2h1u2 < t2w1l8 && t2h1u2 < t2h1u8 && t2h1u2 < t2h1d8 && t2h1u2 < t2w1rwt8 && t2h1u2 < t2w1lwt8 && t2h1u2 < t2h1uwt8 && t2h1u2 < t2h1dwt8
  && t2h1u2 < t2w1r9 && t2h1u2 < t2w1l9 && t2h1u2 < t2h1u9 && t2h1u2 < t2h1d9 && t2h1u2 < t2w1rwt9 && t2h1u2 < t2w1lwt9 && t2h1u2 < t2h1uwt9 && t2h1u2 < t2h1dwt9
  && t2h1u2 < t2w1r10 && t2h1u2 < t2w1l10 && t2h1u2 < t2h1u10 && t2h1u2 < t2h1d10 && t2h1u2 < t2w1rwt10 && t2h1u2 < t2w1lwt10 && t2h1u2 < t2h1uwt10 && t2h1u2 < t2h1dwt10
  && (louthu2 !=0 && linhu2!=0)){
  i=96;
  }

  if (myu2==-1 && t2h1u2 > 0 && t2h1u2 < t1 
  && t2h1u2 < t2w1r && t2h1u2 < t2w1l && t2h1u2 < t2h1u && t2h1u2 < t2h1d && t2h1u2 < t2w1rwt && t2h1u2 < t2w1lwt && t2h1u2 < t2h1uwt && t2h1u2 < t2h1dwt
  && t2h1u2 < t2w1r1 && t2h1u2 < t2w1l1 && t2h1u2 < t2h1u1 && t2h1u2 < t2h1d1 && t2h1u2 < t2w1rwt1 && t2h1u2 < t2w1lwt1 && t2h1u2 < t2h1uwt1 && t2h1u2 < t2h1dwt1
  && t2h1u2 < t2w1r2 && t2h1u2 < t2w1l2 && t2h1u2 < t2h1d2 && t2h1u2 < t2w1rwt2 && t2h1u2 < t2w1lwt2 && t2h1u2 < t2h1uwt2 && t2h1u2 < t2h1dwt2
  && t2h1u2 < t2w1r3 && t2h1u2 < t2w1l3 && t2h1u2 < t2h1u3 && t2h1u2 < t2h1d3 && t2h1u2 < t2w1rwt3 && t2h1u2 < t2w1lwt3 && t2h1u2 < t2h1uwt3 && t2h1u2 < t2h1dwt3
  && t2h1u2 < t2w1r4 && t2h1u2 < t2w1l4 && t2h1u2 < t2h1u4 && t2h1u2 < t2h1d4 && t2h1u2 < t2w1rwt4 && t2h1u2 < t2w1lwt4 && t2h1u2 < t2h1uwt4 && t2h1u2 < t2h1dwt4
  && t2h1u2 < t2w1r5 && t2h1u2 < t2w1l5 && t2h1u2 < t2h1u5 && t2h1u2 < t2h1d5 && t2h1u2 < t2w1rwt5 && t2h1u2 < t2w1lwt5 && t2h1u2 < t2h1uwt5 && t2h1u2 < t2h1dwt5
  && t2h1u2 < t2w1r6 && t2h1u2 < t2w1l6 && t2h1u2 < t2h1u6 && t2h1u2 < t2h1d6 && t2h1u2 < t2w1rwt6 && t2h1u2 < t2w1lwt6 && t2h1u2 < t2h1uwt6 && t2h1u2 < t2h1dwt6
  && t2h1u2 < t2w1r7 && t2h1u2 < t2w1l7 && t2h1u2 < t2h1u7 && t2h1u2 < t2h1d7 && t2h1u2 < t2w1rwt7 && t2h1u2 < t2w1lwt7 && t2h1u2 < t2h1uwt7 && t2h1u2 < t2h1dwt7
  && t2h1u2 < t2w1r8 && t2h1u2 < t2w1l8 && t2h1u2 < t2h1u8 && t2h1u2 < t2h1d8 && t2h1u2 < t2w1rwt8 && t2h1u2 < t2w1lwt8 && t2h1u2 < t2h1uwt8 && t2h1u2 < t2h1dwt8
  && t2h1u2 < t2w1r9 && t2h1u2 < t2w1l9 && t2h1u2 < t2h1u9 && t2h1u2 < t2h1d9 && t2h1u2 < t2w1rwt9 && t2h1u2 < t2w1lwt9 && t2h1u2 < t2h1uwt9 && t2h1u2 < t2h1dwt9
  && t2h1u2 < t2w1r10 && t2h1u2 < t2w1l10 && t2h1u2 < t2h1u10 && t2h1u2 < t2h1d10 && t2h1u2 < t2w1rwt10 && t2h1u2 < t2w1lwt10 && t2h1u2 < t2h1uwt10 && t2h1u2 < t2h1dwt10
  && ((louthu2!=0 && linhu2==0) || (louthu2==0 && linhu2!=0))){
  i=96;
  }

  if (myu2==-1 && t2h1u2 > 0 && t2h1u2 < t1 
  && t2h1u2 < t2w1r && t2h1u2 < t2w1l && t2h1u2 < t2h1u && t2h1u2 < t2h1d && t2h1u2 < t2w1rwt && t2h1u2 < t2w1lwt && t2h1u2 < t2h1uwt && t2h1u2 < t2h1dwt
  && t2h1u2 < t2w1r1 && t2h1u2 < t2w1l1 && t2h1u2 < t2h1u1 && t2h1u2 < t2h1d1 && t2h1u2 < t2w1rwt1 && t2h1u2 < t2w1lwt1 && t2h1u2 < t2h1uwt1 && t2h1u2 < t2h1dwt1
  && t2h1u2 < t2w1r2 && t2h1u2 < t2w1l2 && t2h1u2 < t2h1d2 && t2h1u2 < t2w1rwt2 && t2h1u2 < t2w1lwt2 && t2h1u2 < t2h1uwt2 && t2h1u2 < t2h1dwt2
  && t2h1u2 < t2w1r3 && t2h1u2 < t2w1l3 && t2h1u2 < t2h1u3 && t2h1u2 < t2h1d3 && t2h1u2 < t2w1rwt3 && t2h1u2 < t2w1lwt3 && t2h1u2 < t2h1uwt3 && t2h1u2 < t2h1dwt3
  && t2h1u2 < t2w1r4 && t2h1u2 < t2w1l4 && t2h1u2 < t2h1u4 && t2h1u2 < t2h1d4 && t2h1u2 < t2w1rwt4 && t2h1u2 < t2w1lwt4 && t2h1u2 < t2h1uwt4 && t2h1u2 < t2h1dwt4
  && t2h1u2 < t2w1r5 && t2h1u2 < t2w1l5 && t2h1u2 < t2h1u5 && t2h1u2 < t2h1d5 && t2h1u2 < t2w1rwt5 && t2h1u2 < t2w1lwt5 && t2h1u2 < t2h1uwt5 && t2h1u2 < t2h1dwt5
  && t2h1u2 < t2w1r6 && t2h1u2 < t2w1l6 && t2h1u2 < t2h1u6 && t2h1u2 < t2h1d6 && t2h1u2 < t2w1rwt6 && t2h1u2 < t2w1lwt6 && t2h1u2 < t2h1uwt6 && t2h1u2 < t2h1dwt6
  && t2h1u2 < t2w1r7 && t2h1u2 < t2w1l7 && t2h1u2 < t2h1u7 && t2h1u2 < t2h1d7 && t2h1u2 < t2w1rwt7 && t2h1u2 < t2w1lwt7 && t2h1u2 < t2h1uwt7 && t2h1u2 < t2h1dwt7
  && t2h1u2 < t2w1r8 && t2h1u2 < t2w1l8 && t2h1u2 < t2h1u8 && t2h1u2 < t2h1d8 && t2h1u2 < t2w1rwt8 && t2h1u2 < t2w1lwt8 && t2h1u2 < t2h1uwt8 && t2h1u2 < t2h1dwt8
  && t2h1u2 < t2w1r9 && t2h1u2 < t2w1l9 && t2h1u2 < t2h1u9 && t2h1u2 < t2h1d9 && t2h1u2 < t2w1rwt9 && t2h1u2 < t2w1lwt9 && t2h1u2 < t2h1uwt9 && t2h1u2 < t2h1dwt9
  && t2h1u2 < t2w1r10 && t2h1u2 < t2w1l10 && t2h1u2 < t2h1u10 && t2h1u2 < t2h1d10 && t2h1u2 < t2w1rwt10 && t2h1u2 < t2w1lwt10 && t2h1u2 < t2h1uwt10 && t2h1u2 < t2h1dwt10
  && (louthu2 == 0 && linhu2 == 0)){
  i=96;
  }

  if (myd2==-1 && t2h1d2 > 0 && t2h1d2 < t1 
  && t2h1d2 < t2w1r && t2h1d2 < t2w1l && t2h1d2 < t2h1u && t2h1d2 < t2h1d && t2h1d2 < t2w1rwt && t2h1d2 < t2w1lwt && t2h1d2 < t2h1uwt && t2h1d2 < t2h1dwt
  && t2h1d2 < t2w1r1 && t2h1d2 < t2w1l1 && t2h1d2 < t2h1u1 && t2h1d2 < t2h1d1 && t2h1d2 < t2w1rwt1 && t2h1d2 < t2w1lwt1 && t2h1d2 < t2h1uwt1 && t2h1d2 < t2h1dwt1
  && t2h1d2 < t2w1r2 && t2h1d2 < t2w1l2 && t2h1d2 < t2h1u2 && t2h1d2 < t2w1rwt2 && t2h1d2 < t2w1lwt2 && t2h1d2 < t2h1uwt2 && t2h1d2 < t2h1dwt2
  && t2h1d2 < t2w1r3 && t2h1d2 < t2w1l3 && t2h1d2 < t2h1u3 && t2h1d2 < t2h1d3 && t2h1d2 < t2w1rwt3 && t2h1d2 < t2w1lwt3 && t2h1d2 < t2h1uwt3 && t2h1d2 < t2h1dwt3
  && t2h1d2 < t2w1r4 && t2h1d2 < t2w1l4 && t2h1d2 < t2h1u4 && t2h1d2 < t2h1d4 && t2h1d2 < t2w1rwt4 && t2h1d2 < t2w1lwt4 && t2h1d2 < t2h1uwt4 && t2h1d2 < t2h1dwt4
  && t2h1d2 < t2w1r5 && t2h1d2 < t2w1l5 && t2h1d2 < t2h1u5 && t2h1d2 < t2h1d5 && t2h1d2 < t2w1rwt5 && t2h1d2 < t2w1lwt5 && t2h1d2 < t2h1uwt5 && t2h1d2 < t2h1dwt5
  && t2h1d2 < t2w1r6 && t2h1d2 < t2w1l6 && t2h1d2 < t2h1u6 && t2h1d2 < t2h1d6 && t2h1d2 < t2w1rwt6 && t2h1d2 < t2w1lwt6 && t2h1d2 < t2h1uwt6 && t2h1d2 < t2h1dwt6
  && t2h1d2 < t2w1r7 && t2h1d2 < t2w1l7 && t2h1d2 < t2h1u7 && t2h1d2 < t2h1d7 && t2h1d2 < t2w1rwt7 && t2h1d2 < t2w1lwt7 && t2h1d2 < t2h1uwt7 && t2h1d2 < t2h1dwt7
  && t2h1d2 < t2w1r8 && t2h1d2 < t2w1l8 && t2h1d2 < t2h1u8 && t2h1d2 < t2h1d8 && t2h1d2 < t2w1rwt8 && t2h1d2 < t2w1lwt8 && t2h1d2 < t2h1uwt8 && t2h1d2 < t2h1dwt8
  && t2h1d2 < t2w1r9 && t2h1d2 < t2w1l9 && t2h1d2 < t2h1u9 && t2h1d2 < t2h1d9 && t2h1d2 < t2w1rwt9 && t2h1d2 < t2w1lwt9 && t2h1d2 < t2h1uwt9 && t2h1d2 < t2h1dwt9
  && t2h1d2 < t2w1r10 && t2h1d2 < t2w1l10 && t2h1d2 < t2h1u10 && t2h1d2 < t2h1d10 && t2h1d2 < t2w1rwt10 && t2h1d2 < t2w1lwt10 && t2h1d2 < t2h1uwt10 && t2h1d2 < t2h1dwt10
  && (louthd2 !=0 && linhd2!=0)){
  i=97;
  }

  if (myd2==-1 && t2h1d2 > 0 && t2h1d2 < t1 
  && t2h1d2 < t2w1r && t2h1d2 < t2w1l && t2h1d2 < t2h1u && t2h1d2 < t2h1d && t2h1d2 < t2w1rwt && t2h1d2 < t2w1lwt && t2h1d2 < t2h1uwt && t2h1d2 < t2h1dwt
  && t2h1d2 < t2w1r1 && t2h1d2 < t2w1l1 && t2h1d2 < t2h1u1 && t2h1d2 < t2h1d1 && t2h1d2 < t2w1rwt1 && t2h1d2 < t2w1lwt1 && t2h1d2 < t2h1uwt1 && t2h1d2 < t2h1dwt1
  && t2h1d2 < t2w1r2 && t2h1d2 < t2w1l2 && t2h1d2 < t2h1u2 && t2h1d2 < t2w1rwt2 && t2h1d2 < t2w1lwt2 && t2h1d2 < t2h1uwt2 && t2h1d2 < t2h1dwt2
  && t2h1d2 < t2w1r3 && t2h1d2 < t2w1l3 && t2h1d2 < t2h1u3 && t2h1d2 < t2h1d3 && t2h1d2 < t2w1rwt3 && t2h1d2 < t2w1lwt3 && t2h1d2 < t2h1uwt3 && t2h1d2 < t2h1dwt3
  && t2h1d2 < t2w1r4 && t2h1d2 < t2w1l4 && t2h1d2 < t2h1u4 && t2h1d2 < t2h1d4 && t2h1d2 < t2w1rwt4 && t2h1d2 < t2w1lwt4 && t2h1d2 < t2h1uwt4 && t2h1d2 < t2h1dwt4
  && t2h1d2 < t2w1r5 && t2h1d2 < t2w1l5 && t2h1d2 < t2h1u5 && t2h1d2 < t2h1d5 && t2h1d2 < t2w1rwt5 && t2h1d2 < t2w1lwt5 && t2h1d2 < t2h1uwt5 && t2h1d2 < t2h1dwt5
  && t2h1d2 < t2w1r6 && t2h1d2 < t2w1l6 && t2h1d2 < t2h1u6 && t2h1d2 < t2h1d6 && t2h1d2 < t2w1rwt6 && t2h1d2 < t2w1lwt6 && t2h1d2 < t2h1uwt6 && t2h1d2 < t2h1dwt6
  && t2h1d2 < t2w1r7 && t2h1d2 < t2w1l7 && t2h1d2 < t2h1u7 && t2h1d2 < t2h1d7 && t2h1d2 < t2w1rwt7 && t2h1d2 < t2w1lwt7 && t2h1d2 < t2h1uwt7 && t2h1d2 < t2h1dwt7
  && t2h1d2 < t2w1r8 && t2h1d2 < t2w1l8 && t2h1d2 < t2h1u8 && t2h1d2 < t2h1d8 && t2h1d2 < t2w1rwt8 && t2h1d2 < t2w1lwt8 && t2h1d2 < t2h1uwt8 && t2h1d2 < t2h1dwt8
  && t2h1d2 < t2w1r9 && t2h1d2 < t2w1l9 && t2h1d2 < t2h1u9 && t2h1d2 < t2h1d9 && t2h1d2 < t2w1rwt9 && t2h1d2 < t2w1lwt9 && t2h1d2 < t2h1uwt9 && t2h1d2 < t2h1dwt9
  && t2h1d2 < t2w1r10 && t2h1d2 < t2w1l10 && t2h1d2 < t2h1u10 && t2h1d2 < t2h1d10 && t2h1d2 < t2w1rwt10 && t2h1d2 < t2w1lwt10 && t2h1d2 < t2h1uwt10 && t2h1d2 < t2h1dwt10
  && ((louthd2 !=0 && linhd2==0) || (louthd2 ==0 && linhd2!=0))){
  i=97;
  }

  if (myd2==-1 && t2h1d2 > 0 && t2h1d2 < t1 
  && t2h1d2 < t2w1r && t2h1d2 < t2w1l && t2h1d2 < t2h1u && t2h1d2 < t2h1d && t2h1d2 < t2w1rwt && t2h1d2 < t2w1lwt && t2h1d2 < t2h1uwt && t2h1d2 < t2h1dwt
  && t2h1d2 < t2w1r1 && t2h1d2 < t2w1l1 && t2h1d2 < t2h1u1 && t2h1d2 < t2h1d1 && t2h1d2 < t2w1rwt1 && t2h1d2 < t2w1lwt1 && t2h1d2 < t2h1uwt1 && t2h1d2 < t2h1dwt1
  && t2h1d2 < t2w1r2 && t2h1d2 < t2w1l2 && t2h1d2 < t2h1u2 && t2h1d2 < t2w1rwt2 && t2h1d2 < t2w1lwt2 && t2h1d2 < t2h1uwt2 && t2h1d2 < t2h1dwt2
  && t2h1d2 < t2w1r3 && t2h1d2 < t2w1l3 && t2h1d2 < t2h1u3 && t2h1d2 < t2h1d3 && t2h1d2 < t2w1rwt3 && t2h1d2 < t2w1lwt3 && t2h1d2 < t2h1uwt3 && t2h1d2 < t2h1dwt3
  && t2h1d2 < t2w1r4 && t2h1d2 < t2w1l4 && t2h1d2 < t2h1u4 && t2h1d2 < t2h1d4 && t2h1d2 < t2w1rwt4 && t2h1d2 < t2w1lwt4 && t2h1d2 < t2h1uwt4 && t2h1d2 < t2h1dwt4
  && t2h1d2 < t2w1r5 && t2h1d2 < t2w1l5 && t2h1d2 < t2h1u5 && t2h1d2 < t2h1d5 && t2h1d2 < t2w1rwt5 && t2h1d2 < t2w1lwt5 && t2h1d2 < t2h1uwt5 && t2h1d2 < t2h1dwt5
  && t2h1d2 < t2w1r6 && t2h1d2 < t2w1l6 && t2h1d2 < t2h1u6 && t2h1d2 < t2h1d6 && t2h1d2 < t2w1rwt6 && t2h1d2 < t2w1lwt6 && t2h1d2 < t2h1uwt6 && t2h1d2 < t2h1dwt6
  && t2h1d2 < t2w1r7 && t2h1d2 < t2w1l7 && t2h1d2 < t2h1u7 && t2h1d2 < t2h1d7 && t2h1d2 < t2w1rwt7 && t2h1d2 < t2w1lwt7 && t2h1d2 < t2h1uwt7 && t2h1d2 < t2h1dwt7
  && t2h1d2 < t2w1r8 && t2h1d2 < t2w1l8 && t2h1d2 < t2h1u8 && t2h1d2 < t2h1d8 && t2h1d2 < t2w1rwt8 && t2h1d2 < t2w1lwt8 && t2h1d2 < t2h1uwt8 && t2h1d2 < t2h1dwt8
  && t2h1d2 < t2w1r9 && t2h1d2 < t2w1l9 && t2h1d2 < t2h1u9 && t2h1d2 < t2h1d9 && t2h1d2 < t2w1rwt9 && t2h1d2 < t2w1lwt9 && t2h1d2 < t2h1uwt9 && t2h1d2 < t2h1dwt9
  && t2h1d2 < t2w1r10 && t2h1d2 < t2w1l10 && t2h1d2 < t2h1u10 && t2h1d2 < t2h1d10 && t2h1d2 < t2w1rwt10 && t2h1d2 < t2w1lwt10 && t2h1d2 < t2h1uwt10 && t2h1d2 < t2h1dwt10
  && (louthd2 == 0 && linhd2 == 0)){
  i=97;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW2!=-1 && t2w1rwt2 > 0 && t2w1rwt2 < t1 
  && t2w1rwt2 < t2w1r && t2w1rwt2 < t2w1l && t2w1rwt2 < t2h1u && t2w1rwt2 < t2h1d && t2w1rwt2 <t2w1rwt && t2w1rwt2 <t2w1lwt && t2w1rwt2 < t2h1uwt && t2w1rwt2 < t2h1dwt
  && t2w1rwt2 < t2w1r1 && t2w1rwt2 < t2w1l1 && t2w1rwt2 < t2h1u1 && t2w1rwt2 < t2h1d1 && t2w1rwt2 <t2w1rwt1 && t2w1rwt2 <t2w1lwt1 && t2w1rwt2 < t2h1uwt1 && t2w1rwt2 < t2h1dwt1
  && t2w1rwt2 < t2w1r2 && t2w1rwt2 < t2w1l2 && t2w1rwt2 < t2h1u2 && t2w1rwt2 < t2h1d2 && t2w1rwt2 <t2w1lwt2 && t2w1rwt2 < t2h1uwt2 && t2w1rwt2 < t2h1dwt2
  && t2w1rwt2 < t2w1r3 && t2w1rwt2 < t2w1l3 && t2w1rwt2 < t2h1u3 && t2w1rwt2 < t2h1d3 && t2w1rwt2 <t2w1rwt3 && t2w1rwt2 <t2w1lwt3 && t2w1rwt2 < t2h1uwt3 && t2w1rwt2 < t2h1dwt3
  && t2w1rwt2 < t2w1r4 && t2w1rwt2 < t2w1l4 && t2w1rwt2 < t2h1u4 && t2w1rwt2 < t2h1d4 && t2w1rwt2 <t2w1rwt4 && t2w1rwt2 <t2w1lwt4 && t2w1rwt2 < t2h1uwt4 && t2w1rwt2 < t2h1dwt4
  && t2w1rwt2 < t2w1r5 && t2w1rwt2 < t2w1l5 && t2w1rwt2 < t2h1u5 && t2w1rwt2 < t2h1d5 && t2w1rwt2 <t2w1rwt5 && t2w1rwt2 <t2w1lwt5 && t2w1rwt2 < t2h1uwt5 && t2w1rwt2 < t2h1dwt5
  && t2w1rwt2 < t2w1r6 && t2w1rwt2 < t2w1l6 && t2w1rwt2 < t2h1u6 && t2w1rwt2 < t2h1d6 && t2w1rwt2 <t2w1rwt6 && t2w1rwt2 <t2w1lwt6 && t2w1rwt2 < t2h1uwt6 && t2w1rwt2 < t2h1dwt6
  && t2w1rwt2 < t2w1r7 && t2w1rwt2 < t2w1l7 && t2w1rwt2 < t2h1u7 && t2w1rwt2 < t2h1d7 && t2w1rwt2 <t2w1rwt7 && t2w1rwt2 <t2w1lwt7 && t2w1rwt2 < t2h1uwt7 && t2w1rwt2 < t2h1dwt7
  && t2w1rwt2 < t2w1r8 && t2w1rwt2 < t2w1l8 && t2w1rwt2 < t2h1u8 && t2w1rwt2 < t2h1d8 && t2w1rwt2 <t2w1rwt8 && t2w1rwt2 <t2w1lwt8 && t2w1rwt2 < t2h1uwt8 && t2w1rwt2 < t2h1dwt8
  && t2w1rwt2 < t2w1r9 && t2w1rwt2 < t2w1l9 && t2w1rwt2 < t2h1u9 && t2w1rwt2 < t2h1d9 && t2w1rwt2 <t2w1rwt9 && t2w1rwt2 <t2w1lwt9 && t2w1rwt2 < t2h1uwt9 && t2w1rwt2 < t2h1dwt9
  && t2w1rwt2 < t2w1r10 && t2w1rwt2 < t2w1l10 && t2w1rwt2 < t2h1u10 && t2w1rwt2 < t2h1d10 && t2w1rwt2 <t2w1rwt10 && t2w1rwt2 <t2w1lwt10 && t2w1rwt2 < t2h1uwt10 && t2w1rwt2 < t2h1dwt10
  && ((linwr2!=0) && (loutwr2!=0) )){	
   if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1rwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1rwt2+z))*(z0hd2+(vz*t2w1rwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1rwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1rwt2+z))*(z0hu2+(vz*t2w1rwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1rwt2+y;
  xtest=vx*t2w1rwt2+x;
  xlimitrwt=-bwrwt2*sqrt(1-((vz*t2w1rwt2+z)+z0wr2)*((vz*t2w1rwt2+z)+z0wr2)/a2wrwt2);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW2 > 0){
  i=102;
  }
  else{
  i=114;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW2!=-1 && t2w1rwt2 > 0 && t2w1rwt2 < t1 
  && t2w1rwt2 < t2w1r && t2w1rwt2 < t2w1l && t2w1rwt2 < t2h1u && t2w1rwt2 < t2h1d && t2w1rwt2 <t2w1rwt && t2w1rwt2 <t2w1lwt && t2w1rwt2 < t2h1uwt && t2w1rwt2 < t2h1dwt
  && t2w1rwt2 < t2w1r1 && t2w1rwt2 < t2w1l1 && t2w1rwt2 < t2h1u1 && t2w1rwt2 < t2h1d1 && t2w1rwt2 <t2w1rwt1 && t2w1rwt2 <t2w1lwt1 && t2w1rwt2 < t2h1uwt1 && t2w1rwt2 < t2h1dwt1
  && t2w1rwt2 < t2w1r2 && t2w1rwt2 < t2w1l2 && t2w1rwt2 < t2h1u2 && t2w1rwt2 < t2h1d2 && t2w1rwt2 <t2w1lwt2 && t2w1rwt2 < t2h1uwt2 && t2w1rwt2 < t2h1dwt2
  && t2w1rwt2 < t2w1r3 && t2w1rwt2 < t2w1l3 && t2w1rwt2 < t2h1u3 && t2w1rwt2 < t2h1d3 && t2w1rwt2 <t2w1rwt3 && t2w1rwt2 <t2w1lwt3 && t2w1rwt2 < t2h1uwt3 && t2w1rwt2 < t2h1dwt3
  && t2w1rwt2 < t2w1r4 && t2w1rwt2 < t2w1l4 && t2w1rwt2 < t2h1u4 && t2w1rwt2 < t2h1d4 && t2w1rwt2 <t2w1rwt4 && t2w1rwt2 <t2w1lwt4 && t2w1rwt2 < t2h1uwt4 && t2w1rwt2 < t2h1dwt4
  && t2w1rwt2 < t2w1r5 && t2w1rwt2 < t2w1l5 && t2w1rwt2 < t2h1u5 && t2w1rwt2 < t2h1d5 && t2w1rwt2 <t2w1rwt5 && t2w1rwt2 <t2w1lwt5 && t2w1rwt2 < t2h1uwt5 && t2w1rwt2 < t2h1dwt5
  && t2w1rwt2 < t2w1r6 && t2w1rwt2 < t2w1l6 && t2w1rwt2 < t2h1u6 && t2w1rwt2 < t2h1d6 && t2w1rwt2 <t2w1rwt6 && t2w1rwt2 <t2w1lwt6 && t2w1rwt2 < t2h1uwt6 && t2w1rwt2 < t2h1dwt6
  && t2w1rwt2 < t2w1r7 && t2w1rwt2 < t2w1l7 && t2w1rwt2 < t2h1u7 && t2w1rwt2 < t2h1d7 && t2w1rwt2 <t2w1rwt7 && t2w1rwt2 <t2w1lwt7 && t2w1rwt2 < t2h1uwt7 && t2w1rwt2 < t2h1dwt7
  && t2w1rwt2 < t2w1r8 && t2w1rwt2 < t2w1l8 && t2w1rwt2 < t2h1u8 && t2w1rwt2 < t2h1d8 && t2w1rwt2 <t2w1rwt8 && t2w1rwt2 <t2w1lwt8 && t2w1rwt2 < t2h1uwt8 && t2w1rwt2 < t2h1dwt8
  && t2w1rwt2 < t2w1r9 && t2w1rwt2 < t2w1l9 && t2w1rwt2 < t2h1u9 && t2w1rwt2 < t2h1d9 && t2w1rwt2 <t2w1rwt9 && t2w1rwt2 <t2w1lwt9 && t2w1rwt2 < t2h1uwt9 && t2w1rwt2 < t2h1dwt9
  && t2w1rwt2 < t2w1r10 && t2w1rwt2 < t2w1l10 && t2w1rwt2 < t2h1u10 && t2w1rwt2 < t2h1d10 && t2w1rwt2 <t2w1rwt10 && t2w1rwt2 <t2w1lwt10 && t2w1rwt2 < t2h1uwt10 && t2w1rwt2 < t2h1dwt10
  && ((loutwr2!=0 && linwr2==0) || (loutwr2==0 && linwr2!=0))){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1rwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1rwt2+z))*(z0hd2+(vz*t2w1rwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1rwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1rwt2+z))*(z0hu2+(vz*t2w1rwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1rwt2+y;
  xtest=vx*t2w1rwt2+x;
  xlimitr=-sqrt((pbwrwt2-(vz*t2w1rwt2+z))/pawrwt2);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW2 > 0){
  i=103; 
  }else{
  i=114;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW2!=-1 && t2w1rwt2 > 0 && t2w1rwt2 < t1 
  && t2w1rwt2 < t2w1r && t2w1rwt2 < t2w1l && t2w1rwt2 < t2h1u && t2w1rwt2 < t2h1d && t2w1rwt2 <t2w1rwt && t2w1rwt2 <t2w1lwt && t2w1rwt2 < t2h1uwt && t2w1rwt2 < t2h1dwt
  && t2w1rwt2 < t2w1r1 && t2w1rwt2 < t2w1l1 && t2w1rwt2 < t2h1u1 && t2w1rwt2 < t2h1d1 && t2w1rwt2 <t2w1rwt1 && t2w1rwt2 <t2w1lwt1 && t2w1rwt2 < t2h1uwt1 && t2w1rwt2 < t2h1dwt1
  && t2w1rwt2 < t2w1r2 && t2w1rwt2 < t2w1l2 && t2w1rwt2 < t2h1u2 && t2w1rwt2 < t2h1d2 && t2w1rwt2 <t2w1lwt2 && t2w1rwt2 < t2h1uwt2 && t2w1rwt2 < t2h1dwt2
  && t2w1rwt2 < t2w1r3 && t2w1rwt2 < t2w1l3 && t2w1rwt2 < t2h1u3 && t2w1rwt2 < t2h1d3 && t2w1rwt2 <t2w1rwt3 && t2w1rwt2 <t2w1lwt3 && t2w1rwt2 < t2h1uwt3 && t2w1rwt2 < t2h1dwt3
  && t2w1rwt2 < t2w1r4 && t2w1rwt2 < t2w1l4 && t2w1rwt2 < t2h1u4 && t2w1rwt2 < t2h1d4 && t2w1rwt2 <t2w1rwt4 && t2w1rwt2 <t2w1lwt4 && t2w1rwt2 < t2h1uwt4 && t2w1rwt2 < t2h1dwt4
  && t2w1rwt2 < t2w1r5 && t2w1rwt2 < t2w1l5 && t2w1rwt2 < t2h1u5 && t2w1rwt2 < t2h1d5 && t2w1rwt2 <t2w1rwt5 && t2w1rwt2 <t2w1lwt5 && t2w1rwt2 < t2h1uwt5 && t2w1rwt2 < t2h1dwt5
  && t2w1rwt2 < t2w1r6 && t2w1rwt2 < t2w1l6 && t2w1rwt2 < t2h1u6 && t2w1rwt2 < t2h1d6 && t2w1rwt2 <t2w1rwt6 && t2w1rwt2 <t2w1lwt6 && t2w1rwt2 < t2h1uwt6 && t2w1rwt2 < t2h1dwt6
  && t2w1rwt2 < t2w1r7 && t2w1rwt2 < t2w1l7 && t2w1rwt2 < t2h1u7 && t2w1rwt2 < t2h1d7 && t2w1rwt2 <t2w1rwt7 && t2w1rwt2 <t2w1lwt7 && t2w1rwt2 < t2h1uwt7 && t2w1rwt2 < t2h1dwt7
  && t2w1rwt2 < t2w1r8 && t2w1rwt2 < t2w1l8 && t2w1rwt2 < t2h1u8 && t2w1rwt2 < t2h1d8 && t2w1rwt2 <t2w1rwt8 && t2w1rwt2 <t2w1lwt8 && t2w1rwt2 < t2h1uwt8 && t2w1rwt2 < t2h1dwt8
  && t2w1rwt2 < t2w1r9 && t2w1rwt2 < t2w1l9 && t2w1rwt2 < t2h1u9 && t2w1rwt2 < t2h1d9 && t2w1rwt2 <t2w1rwt9 && t2w1rwt2 <t2w1lwt9 && t2w1rwt2 < t2h1uwt9 && t2w1rwt2 < t2h1dwt9
  && t2w1rwt2 < t2w1r10 && t2w1rwt2 < t2w1l10 && t2w1rwt2 < t2h1u10 && t2w1rwt2 < t2h1d10 && t2w1rwt2 <t2w1rwt10 && t2w1rwt2 <t2w1lwt10 && t2w1rwt2 < t2h1uwt10 && t2w1rwt2 < t2h1dwt10
  &&  (loutwr2==0 && linwr2==0)){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1rwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1rwt2+z))*(z0hd2+(vz*t2w1rwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1rwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1rwt2+z))*(z0hu2+(vz*t2w1rwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1rwt2+y; 
  xtest=vx*t2w1rwt2+x;
  xlimitr=-(-w2r2+w1r2)*(vz*t2w1rwt2+z)/l-w1rwt2;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW2>0){
  i=104;
  }else{
  i=114;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW2!=-1 && t2w1lwt2 > 0 && t2w1lwt2 < t1 
  && t2w1lwt2 < t2w1r && t2w1lwt2 < t2w1l && t2w1lwt2 < t2h1u && t2w1lwt2 < t2h1d && t2w1lwt2 <t2w1rwt && t2w1lwt2 <t2w1lwt && t2w1lwt2 < t2h1uwt && t2w1lwt2 < t2h1dwt
  && t2w1lwt2 < t2w1r1 && t2w1lwt2 < t2w1l1 && t2w1lwt2 < t2h1u1 && t2w1lwt2 < t2h1d1 && t2w1lwt2 <t2w1rwt1 && t2w1lwt2 <t2w1lwt1 && t2w1lwt2 < t2h1uwt1 && t2w1lwt2 < t2h1dwt1
  && t2w1lwt2 < t2w1r2 && t2w1lwt2 < t2w1l2 && t2w1lwt2 < t2h1u2 && t2w1lwt2 < t2h1d2 && t2w1lwt2 <t2w1rwt2 && t2w1lwt2 < t2h1uwt2 && t2w1lwt2 < t2h1dwt2
  && t2w1lwt2 < t2w1r3 && t2w1lwt2 < t2w1l3 && t2w1lwt2 < t2h1u3 && t2w1lwt2 < t2h1d3 && t2w1lwt2 <t2w1rwt3 && t2w1lwt2 <t2w1lwt3 && t2w1lwt2 < t2h1uwt3 && t2w1lwt2 < t2h1dwt3
  && t2w1lwt2 < t2w1r4 && t2w1lwt2 < t2w1l4 && t2w1lwt2 < t2h1u4 && t2w1lwt2 < t2h1d4 && t2w1lwt2 <t2w1rwt4 && t2w1lwt2 <t2w1lwt4 && t2w1lwt2 < t2h1uwt4 && t2w1lwt2 < t2h1dwt4
  && t2w1lwt2 < t2w1r5 && t2w1lwt2 < t2w1l5 && t2w1lwt2 < t2h1u5 && t2w1lwt2 < t2h1d5 && t2w1lwt2 <t2w1rwt5 && t2w1lwt2 <t2w1lwt5 && t2w1lwt2 < t2h1uwt5 && t2w1lwt2 < t2h1dwt5
  && t2w1lwt2 < t2w1r6 && t2w1lwt2 < t2w1l6 && t2w1lwt2 < t2h1u6 && t2w1lwt2 < t2h1d6 && t2w1lwt2 <t2w1rwt6 && t2w1lwt2 <t2w1lwt6 && t2w1lwt2 < t2h1uwt6 && t2w1lwt2 < t2h1dwt6
  && t2w1lwt2 < t2w1r7 && t2w1lwt2 < t2w1l7 && t2w1lwt2 < t2h1u7 && t2w1lwt2 < t2h1d7 && t2w1lwt2 <t2w1rwt7 && t2w1lwt2 <t2w1lwt7 && t2w1lwt2 < t2h1uwt7 && t2w1lwt2 < t2h1dwt7
  && t2w1lwt2 < t2w1r8 && t2w1lwt2 < t2w1l8 && t2w1lwt2 < t2h1u8 && t2w1lwt2 < t2h1d8 && t2w1lwt2 <t2w1rwt8 && t2w1lwt2 <t2w1lwt8 && t2w1lwt2 < t2h1uwt8 && t2w1lwt2 < t2h1dwt8
  && t2w1lwt2 < t2w1r9 && t2w1lwt2 < t2w1l9 && t2w1lwt2 < t2h1u9 && t2w1lwt2 < t2h1d9 && t2w1lwt2 <t2w1rwt9 && t2w1lwt2 <t2w1lwt9 && t2w1lwt2 < t2h1uwt9 && t2w1lwt2 < t2h1dwt9
  && t2w1lwt2 < t2w1r10 && t2w1lwt2 < t2w1l10 && t2w1lwt2 < t2h1u10 && t2w1lwt2 < t2h1d10 && t2w1lwt2 <t2w1rwt10 && t2w1lwt2 <t2w1lwt10 && t2w1lwt2 < t2h1uwt10 && t2w1lwt2 < t2h1dwt10
  &&  ((linwl2!=0) && (loutwl2!=0) )){
  if(linhd2==0 && louthd2==0)
   if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1lwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1lwt2+z))*(z0hd2+(vz*t2w1lwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1lwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1lwt2+z))*(z0hu2+(vz*t2w1lwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1lwt2+y;
  xtest=vx*t2w1lwt2+x;
  xlimitlwt=-bwlwt2*sqrt(1-((vz*t2w1lwt2+z)+z0wl2)*((vz*t2w1lwt2+z)+z0wl2)/a2wlwt2);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW2>0){
  i=105;
  }else{
  i=115;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW2!=-1 &&& t2w1lwt2 > 0 && t2w1lwt2 < t1 
  && t2w1lwt2 < t2w1r && t2w1lwt2 < t2w1l && t2w1lwt2 < t2h1u && t2w1lwt2 < t2h1d && t2w1lwt2 <t2w1rwt && t2w1lwt2 <t2w1lwt && t2w1lwt2 < t2h1uwt && t2w1lwt2 < t2h1dwt
  && t2w1lwt2 < t2w1r1 && t2w1lwt2 < t2w1l1 && t2w1lwt2 < t2h1u1 && t2w1lwt2 < t2h1d1 && t2w1lwt2 <t2w1rwt1 && t2w1lwt2 <t2w1lwt1 && t2w1lwt2 < t2h1uwt1 && t2w1lwt2 < t2h1dwt1
  && t2w1lwt2 < t2w1r2 && t2w1lwt2 < t2w1l2 && t2w1lwt2 < t2h1u2 && t2w1lwt2 < t2h1d2 && t2w1lwt2 <t2w1rwt2 && t2w1lwt2 < t2h1uwt2 && t2w1lwt2 < t2h1dwt2
  && t2w1lwt2 < t2w1r3 && t2w1lwt2 < t2w1l3 && t2w1lwt2 < t2h1u3 && t2w1lwt2 < t2h1d3 && t2w1lwt2 <t2w1rwt3 && t2w1lwt2 <t2w1lwt3 && t2w1lwt2 < t2h1uwt3 && t2w1lwt2 < t2h1dwt3
  && t2w1lwt2 < t2w1r4 && t2w1lwt2 < t2w1l4 && t2w1lwt2 < t2h1u4 && t2w1lwt2 < t2h1d4 && t2w1lwt2 <t2w1rwt4 && t2w1lwt2 <t2w1lwt4 && t2w1lwt2 < t2h1uwt4 && t2w1lwt2 < t2h1dwt4
  && t2w1lwt2 < t2w1r5 && t2w1lwt2 < t2w1l5 && t2w1lwt2 < t2h1u5 && t2w1lwt2 < t2h1d5 && t2w1lwt2 <t2w1rwt5 && t2w1lwt2 <t2w1lwt5 && t2w1lwt2 < t2h1uwt5 && t2w1lwt2 < t2h1dwt5
  && t2w1lwt2 < t2w1r6 && t2w1lwt2 < t2w1l6 && t2w1lwt2 < t2h1u6 && t2w1lwt2 < t2h1d6 && t2w1lwt2 <t2w1rwt6 && t2w1lwt2 <t2w1lwt6 && t2w1lwt2 < t2h1uwt6 && t2w1lwt2 < t2h1dwt6
  && t2w1lwt2 < t2w1r7 && t2w1lwt2 < t2w1l7 && t2w1lwt2 < t2h1u7 && t2w1lwt2 < t2h1d7 && t2w1lwt2 <t2w1rwt7 && t2w1lwt2 <t2w1lwt7 && t2w1lwt2 < t2h1uwt7 && t2w1lwt2 < t2h1dwt7
  && t2w1lwt2 < t2w1r8 && t2w1lwt2 < t2w1l8 && t2w1lwt2 < t2h1u8 && t2w1lwt2 < t2h1d8 && t2w1lwt2 <t2w1rwt8 && t2w1lwt2 <t2w1lwt8 && t2w1lwt2 < t2h1uwt8 && t2w1lwt2 < t2h1dwt8
  && t2w1lwt2 < t2w1r9 && t2w1lwt2 < t2w1l9 && t2w1lwt2 < t2h1u9 && t2w1lwt2 < t2h1d9 && t2w1lwt2 <t2w1rwt9 && t2w1lwt2 <t2w1lwt9 && t2w1lwt2 < t2h1uwt9 && t2w1lwt2 < t2h1dwt9
  && t2w1lwt2 < t2w1r10 && t2w1lwt2 < t2w1l10 && t2w1lwt2 < t2h1u10 && t2w1lwt2 < t2h1d10 && t2w1lwt2 <t2w1rwt10 && t2w1lwt2 <t2w1lwt10 && t2w1lwt2 < t2h1uwt10 && t2w1lwt2 < t2h1dwt10
  && ((loutwl2!=0 && linwl2==0) || (loutwl2==0 && linwl2!=0))){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1lwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1lwt2+z))*(z0hd2+(vz*t2w1lwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1lwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1lwt2+z))*(z0hu2+(vz*t2w1lwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1lwt2+y;
  xtest=vx*t2w1lwt2+x;
  xlimitl=-sqrt((pbwlwt2-(vz*t2w1lwt2+z))/pawlwt2);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW2>0){
  i=106;
  }else{
  i=115;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW2!=-1 && t2w1lwt2 > 0 && t2w1lwt2 < t1 
  && t2w1lwt2 < t2w1r && t2w1lwt2 < t2w1l && t2w1lwt2 < t2h1u && t2w1lwt2 < t2h1d && t2w1lwt2 <t2w1rwt && t2w1lwt2 <t2w1lwt && t2w1lwt2 < t2h1uwt && t2w1lwt2 < t2h1dwt
  && t2w1lwt2 < t2w1r1 && t2w1lwt2 < t2w1l1 && t2w1lwt2 < t2h1u1 && t2w1lwt2 < t2h1d1 && t2w1lwt2 <t2w1rwt1 && t2w1lwt2 <t2w1lwt1 && t2w1lwt2 < t2h1uwt1 && t2w1lwt2 < t2h1dwt1
  && t2w1lwt2 < t2w1r2 && t2w1lwt2 < t2w1l2 && t2w1lwt2 < t2h1u2 && t2w1lwt2 < t2h1d2 && t2w1lwt2 <t2w1rwt2 && t2w1lwt2 < t2h1uwt2 && t2w1lwt2 < t2h1dwt2
  && t2w1lwt2 < t2w1r3 && t2w1lwt2 < t2w1l3 && t2w1lwt2 < t2h1u3 && t2w1lwt2 < t2h1d3 && t2w1lwt2 <t2w1rwt3 && t2w1lwt2 <t2w1lwt3 && t2w1lwt2 < t2h1uwt3 && t2w1lwt2 < t2h1dwt3
  && t2w1lwt2 < t2w1r4 && t2w1lwt2 < t2w1l4 && t2w1lwt2 < t2h1u4 && t2w1lwt2 < t2h1d4 && t2w1lwt2 <t2w1rwt4 && t2w1lwt2 <t2w1lwt4 && t2w1lwt2 < t2h1uwt4 && t2w1lwt2 < t2h1dwt4
  && t2w1lwt2 < t2w1r5 && t2w1lwt2 < t2w1l5 && t2w1lwt2 < t2h1u5 && t2w1lwt2 < t2h1d5 && t2w1lwt2 <t2w1rwt5 && t2w1lwt2 <t2w1lwt5 && t2w1lwt2 < t2h1uwt5 && t2w1lwt2 < t2h1dwt5
  && t2w1lwt2 < t2w1r6 && t2w1lwt2 < t2w1l6 && t2w1lwt2 < t2h1u6 && t2w1lwt2 < t2h1d6 && t2w1lwt2 <t2w1rwt6 && t2w1lwt2 <t2w1lwt6 && t2w1lwt2 < t2h1uwt6 && t2w1lwt2 < t2h1dwt6
  && t2w1lwt2 < t2w1r7 && t2w1lwt2 < t2w1l7 && t2w1lwt2 < t2h1u7 && t2w1lwt2 < t2h1d7 && t2w1lwt2 <t2w1rwt7 && t2w1lwt2 <t2w1lwt7 && t2w1lwt2 < t2h1uwt7 && t2w1lwt2 < t2h1dwt7
  && t2w1lwt2 < t2w1r8 && t2w1lwt2 < t2w1l8 && t2w1lwt2 < t2h1u8 && t2w1lwt2 < t2h1d8 && t2w1lwt2 <t2w1rwt8 && t2w1lwt2 <t2w1lwt8 && t2w1lwt2 < t2h1uwt8 && t2w1lwt2 < t2h1dwt8
  && t2w1lwt2 < t2w1r9 && t2w1lwt2 < t2w1l9 && t2w1lwt2 < t2h1u9 && t2w1lwt2 < t2h1d9 && t2w1lwt2 <t2w1rwt9 && t2w1lwt2 <t2w1lwt9 && t2w1lwt2 < t2h1uwt9 && t2w1lwt2 < t2h1dwt9
  && t2w1lwt2 < t2w1r10 && t2w1lwt2 < t2w1l10 && t2w1lwt2 < t2h1u10 && t2w1lwt2 < t2h1d10 && t2w1lwt2 <t2w1rwt10 && t2w1lwt2 <t2w1lwt10 && t2w1lwt2 < t2h1uwt10 && t2w1lwt2 < t2h1dwt10
  && (loutwl2==0 && linwl2==0)){
  if(linhd2==0 && louthd2==0)
   {
      ylimitd=(-h2d2+h1d2)/l*(vz*t2w1lwt2+z)-h1dwt2;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ylimitd=-bhdwt2*sqrt(1-((z0hd2+(vz*t2w1lwt2+z))*(z0hd2+(vz*t2w1lwt2+z)))/a2hdwt2);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt2+z)-pbhdwt2)/-pahdwt2);
      }
   }
   if(linhu2==0 && louthu2==0)
    {
     ylimitu=(h2u2-h1u2)/l*(vz*t2w1lwt2+z)+h1uwt2;
    }else{
     if(linhu2!=0 && louthu2!=0)
     {
     ylimitu=bhuwt2*sqrt(1-((z0hu2+(vz*t2w1lwt2+z))*(z0hu2+(vz*t2w1lwt2+z)))/a2huwt2);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt2+z)-pbhuwt2)/-pahuwt2);
    }
    }
  ytest=vy*t2w1lwt2+y; 
  xtest=vx*t2w1lwt2+x;
  xlimitl=(w2l2-w1l2)*(vz*t2w1lwt2+z)/l+w1lwt2;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW2>0){
  i=107;
  }else{
  i=115;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW2!=-1 && t2h1uwt2 > 0 && t2h1uwt2 < t1 
  && t2h1uwt2 < t2w1r && t2h1uwt2 < t2w1l && t2h1uwt2 < t2h1u && t2h1uwt2 < t2h1d && t2h1uwt2 < t2w1rwt && t2h1uwt2 < t2w1lwt && t2h1uwt2 < t2h1uwt && t2h1uwt2 < t2h1dwt 
  && t2h1uwt2 < t2w1r1 && t2h1uwt2 < t2w1l1 && t2h1uwt2 < t2h1u1 && t2h1uwt2 < t2h1d1 && t2h1uwt2 < t2w1rwt1 && t2h1uwt2 < t2w1lwt1 && t2h1uwt2 < t2h1uwt1 && t2h1uwt2 < t2h1dwt1
  && t2h1uwt2 < t2w1r2 && t2h1uwt2 < t2w1l2 && t2h1uwt2 < t2h1u2 && t2h1uwt2 < t2h1d2 && t2h1uwt2 < t2w1rwt2 && t2h1uwt2 < t2w1lwt2 && t2h1uwt2 < t2h1dwt2
  && t2h1uwt2 < t2w1r3 && t2h1uwt2 < t2w1l3 && t2h1uwt2 < t2h1u3 && t2h1uwt2 < t2h1d3 && t2h1uwt2 < t2w1rwt3 && t2h1uwt2 < t2w1lwt3 && t2h1uwt2 < t2h1uwt3 && t2h1uwt2 < t2h1dwt3
  && t2h1uwt2 < t2w1r4 && t2h1uwt2 < t2w1l4 && t2h1uwt2 < t2h1u4 && t2h1uwt2 < t2h1d4 && t2h1uwt2 < t2w1rwt4 && t2h1uwt2 < t2w1lwt4 && t2h1uwt2 < t2h1uwt4 && t2h1uwt2 < t2h1dwt4
  && t2h1uwt2 < t2w1r5 && t2h1uwt2 < t2w1l5 && t2h1uwt2 < t2h1u5 && t2h1uwt2 < t2h1d5 && t2h1uwt2 < t2w1rwt5 && t2h1uwt2 < t2w1lwt5 && t2h1uwt2 < t2h1uwt5 && t2h1uwt2 < t2h1dwt5
  && t2h1uwt2 < t2w1r6 && t2h1uwt2 < t2w1l6 && t2h1uwt2 < t2h1u6 && t2h1uwt2 < t2h1d6 && t2h1uwt2 < t2w1rwt6 && t2h1uwt2 < t2w1lwt6 && t2h1uwt2 < t2h1uwt6 && t2h1uwt2 < t2h1dwt6
  && t2h1uwt2 < t2w1r7 && t2h1uwt2 < t2w1l7 && t2h1uwt2 < t2h1u7 && t2h1uwt2 < t2h1d7 && t2h1uwt2 < t2w1rwt7 && t2h1uwt2 < t2w1lwt7 && t2h1uwt2 < t2h1uwt7 && t2h1uwt2 < t2h1dwt7
  && t2h1uwt2 < t2w1r8 && t2h1uwt2 < t2w1l8 && t2h1uwt2 < t2h1u8 && t2h1uwt2 < t2h1d8 && t2h1uwt2 < t2w1rwt8 && t2h1uwt2 < t2w1lwt8 && t2h1uwt2 < t2h1uwt8 && t2h1uwt2 < t2h1dwt8
  && t2h1uwt2 < t2w1r9 && t2h1uwt2 < t2w1l9 && t2h1uwt2 < t2h1u9 && t2h1uwt2 < t2h1d9 && t2h1uwt2 < t2w1rwt9 && t2h1uwt2 < t2w1lwt9 && t2h1uwt2 < t2h1uwt9 && t2h1uwt2 < t2h1dwt9
  && t2h1uwt2 < t2w1r10 && t2h1uwt2 < t2w1l10 && t2h1uwt2 < t2h1u10 && t2h1uwt2 < t2h1d10 && t2h1uwt2 < t2w1rwt10 && t2h1uwt2 < t2w1lwt10 && t2h1uwt2 < t2h1uwt10 && t2h1uwt2 < t2h1dwt10
  && (louthu2 !=0 && linhu2!=0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1uwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1uwt2+z))*(z0wr2+(vz*t2h1uwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1uwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1uwt2+z))*(z0wl2+(vz*t2h1uwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1uwt2+x;
  ytest=vy*t2w1lwt2+y;
  ylimitu=bhuwt2*sqrt(1-((vz*t2h1uwt2+z)+z0hu2)*((vz*t2h1uwt2+z)+z0hu2)/a2huwt2);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW2>0 ){
  i=108;
  }else{
  i=116;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW2!=-1 && t2h1uwt2 > 0 && t2h1uwt2 < t1 
  && t2h1uwt2 < t2w1r && t2h1uwt2 < t2w1l && t2h1uwt2 < t2h1u && t2h1uwt2 < t2h1d && t2h1uwt2 < t2w1rwt && t2h1uwt2 < t2w1lwt && t2h1uwt2 < t2h1uwt && t2h1uwt2 < t2h1dwt 
  && t2h1uwt2 < t2w1r1 && t2h1uwt2 < t2w1l1 && t2h1uwt2 < t2h1u1 && t2h1uwt2 < t2h1d1 && t2h1uwt2 < t2w1rwt1 && t2h1uwt2 < t2w1lwt1 && t2h1uwt2 < t2h1uwt1 && t2h1uwt2 < t2h1dwt1
  && t2h1uwt2 < t2w1r2 && t2h1uwt2 < t2w1l2 && t2h1uwt2 < t2h1u2 && t2h1uwt2 < t2h1d2 && t2h1uwt2 < t2w1rwt2 && t2h1uwt2 < t2w1lwt2 && t2h1uwt2 < t2h1dwt2
  && t2h1uwt2 < t2w1r3 && t2h1uwt2 < t2w1l3 && t2h1uwt2 < t2h1u3 && t2h1uwt2 < t2h1d3 && t2h1uwt2 < t2w1rwt3 && t2h1uwt2 < t2w1lwt3 && t2h1uwt2 < t2h1uwt3 && t2h1uwt2 < t2h1dwt3
  && t2h1uwt2 < t2w1r4 && t2h1uwt2 < t2w1l4 && t2h1uwt2 < t2h1u4 && t2h1uwt2 < t2h1d4 && t2h1uwt2 < t2w1rwt4 && t2h1uwt2 < t2w1lwt4 && t2h1uwt2 < t2h1uwt4 && t2h1uwt2 < t2h1dwt4
  && t2h1uwt2 < t2w1r5 && t2h1uwt2 < t2w1l5 && t2h1uwt2 < t2h1u5 && t2h1uwt2 < t2h1d5 && t2h1uwt2 < t2w1rwt5 && t2h1uwt2 < t2w1lwt5 && t2h1uwt2 < t2h1uwt5 && t2h1uwt2 < t2h1dwt5
  && t2h1uwt2 < t2w1r6 && t2h1uwt2 < t2w1l6 && t2h1uwt2 < t2h1u6 && t2h1uwt2 < t2h1d6 && t2h1uwt2 < t2w1rwt6 && t2h1uwt2 < t2w1lwt6 && t2h1uwt2 < t2h1uwt6 && t2h1uwt2 < t2h1dwt6
  && t2h1uwt2 < t2w1r7 && t2h1uwt2 < t2w1l7 && t2h1uwt2 < t2h1u7 && t2h1uwt2 < t2h1d7 && t2h1uwt2 < t2w1rwt7 && t2h1uwt2 < t2w1lwt7 && t2h1uwt2 < t2h1uwt7 && t2h1uwt2 < t2h1dwt7
  && t2h1uwt2 < t2w1r8 && t2h1uwt2 < t2w1l8 && t2h1uwt2 < t2h1u8 && t2h1uwt2 < t2h1d8 && t2h1uwt2 < t2w1rwt8 && t2h1uwt2 < t2w1lwt8 && t2h1uwt2 < t2h1uwt8 && t2h1uwt2 < t2h1dwt8
  && t2h1uwt2 < t2w1r9 && t2h1uwt2 < t2w1l9 && t2h1uwt2 < t2h1u9 && t2h1uwt2 < t2h1d9 && t2h1uwt2 < t2w1rwt9 && t2h1uwt2 < t2w1lwt9 && t2h1uwt2 < t2h1uwt9 && t2h1uwt2 < t2h1dwt9
  && t2h1uwt2 < t2w1r10 && t2h1uwt2 < t2w1l10 && t2h1uwt2 < t2h1u10 && t2h1uwt2 < t2h1d10 && t2h1uwt2 < t2w1rwt10 && t2h1uwt2 < t2w1lwt10 && t2h1uwt2 < t2h1uwt10 && t2h1uwt2 < t2h1dwt10
  && ((louthu2!=0 && linhu2==0) || (louthu2==0 && linhu2!=0))){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1uwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1uwt2+z))*(z0wr2+(vz*t2h1uwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1uwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1uwt2+z))*(z0wl2+(vz*t2h1uwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1uwt2+x;
  ytest=vy*t2w1lwt2+y;
  ylimitu=sqrt((pbhuwt2-(vz*t2h1uwt2+z))/pahuwt2);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW2>0){
  i=109;
  }else{
  i=116;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW2!=-1 && t2h1uwt2 > 0 && t2h1uwt2 < t1 
  && t2h1uwt2 < t2w1r && t2h1uwt2 < t2w1l && t2h1uwt2 < t2h1u && t2h1uwt2 < t2h1d && t2h1uwt2 < t2w1rwt && t2h1uwt2 < t2w1lwt && t2h1uwt2 < t2h1uwt && t2h1uwt2 < t2h1dwt 
  && t2h1uwt2 < t2w1r1 && t2h1uwt2 < t2w1l1 && t2h1uwt2 < t2h1u1 && t2h1uwt2 < t2h1d1 && t2h1uwt2 < t2w1rwt1 && t2h1uwt2 < t2w1lwt1 && t2h1uwt2 < t2h1uwt1 && t2h1uwt2 < t2h1dwt1
  && t2h1uwt2 < t2w1r2 && t2h1uwt2 < t2w1l2 && t2h1uwt2 < t2h1u2 && t2h1uwt2 < t2h1d2 && t2h1uwt2 < t2w1rwt2 && t2h1uwt2 < t2w1lwt2 && t2h1uwt2 < t2h1dwt2
  && t2h1uwt2 < t2w1r3 && t2h1uwt2 < t2w1l3 && t2h1uwt2 < t2h1u3 && t2h1uwt2 < t2h1d3 && t2h1uwt2 < t2w1rwt3 && t2h1uwt2 < t2w1lwt3 && t2h1uwt2 < t2h1uwt3 && t2h1uwt2 < t2h1dwt3
  && t2h1uwt2 < t2w1r4 && t2h1uwt2 < t2w1l4 && t2h1uwt2 < t2h1u4 && t2h1uwt2 < t2h1d4 && t2h1uwt2 < t2w1rwt4 && t2h1uwt2 < t2w1lwt4 && t2h1uwt2 < t2h1uwt4 && t2h1uwt2 < t2h1dwt4
  && t2h1uwt2 < t2w1r5 && t2h1uwt2 < t2w1l5 && t2h1uwt2 < t2h1u5 && t2h1uwt2 < t2h1d5 && t2h1uwt2 < t2w1rwt5 && t2h1uwt2 < t2w1lwt5 && t2h1uwt2 < t2h1uwt5 && t2h1uwt2 < t2h1dwt5
  && t2h1uwt2 < t2w1r6 && t2h1uwt2 < t2w1l6 && t2h1uwt2 < t2h1u6 && t2h1uwt2 < t2h1d6 && t2h1uwt2 < t2w1rwt6 && t2h1uwt2 < t2w1lwt6 && t2h1uwt2 < t2h1uwt6 && t2h1uwt2 < t2h1dwt6
  && t2h1uwt2 < t2w1r7 && t2h1uwt2 < t2w1l7 && t2h1uwt2 < t2h1u7 && t2h1uwt2 < t2h1d7 && t2h1uwt2 < t2w1rwt7 && t2h1uwt2 < t2w1lwt7 && t2h1uwt2 < t2h1uwt7 && t2h1uwt2 < t2h1dwt7
  && t2h1uwt2 < t2w1r8 && t2h1uwt2 < t2w1l8 && t2h1uwt2 < t2h1u8 && t2h1uwt2 < t2h1d8 && t2h1uwt2 < t2w1rwt8 && t2h1uwt2 < t2w1lwt8 && t2h1uwt2 < t2h1uwt8 && t2h1uwt2 < t2h1dwt8
  && t2h1uwt2 < t2w1r9 && t2h1uwt2 < t2w1l9 && t2h1uwt2 < t2h1u9 && t2h1uwt2 < t2h1d9 && t2h1uwt2 < t2w1rwt9 && t2h1uwt2 < t2w1lwt9 && t2h1uwt2 < t2h1uwt9 && t2h1uwt2 < t2h1dwt9
  && t2h1uwt2 < t2w1r10 && t2h1uwt2 < t2w1l10 && t2h1uwt2 < t2h1u10 && t2h1uwt2 < t2h1d10 && t2h1uwt2 < t2w1rwt10 && t2h1uwt2 < t2w1lwt10 && t2h1uwt2 < t2h1uwt10 && t2h1uwt2 < t2h1dwt10
  && (louthu2 == 0 && linhu2 == 0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1uwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1uwt2+z))*(z0wr2+(vz*t2h1uwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1uwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1uwt2+z))*(z0wl2+(vz*t2h1uwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1uwt2+x;
  ytest=vy*t2w1lwt2+y;
  ylimitu=(h2u2-h1u2)*(vz*t2h1uwt2+z)/l+h1uwt2;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW2>0 ){
  i=110;
  }else{
  i=116;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW2!=-1 && t2h1dwt2 > 0 && t2h1dwt2 < t1 
  && t2h1dwt2 < t2w1r && t2h1dwt2 < t2w1l && t2h1dwt2 < t2h1u && t2h1dwt2 < t2h1d && t2h1dwt2 < t2w1rwt && t2h1dwt2 < t2w1lwt && t2h1dwt2 < t2h1uwt && t2h1dwt2 < t2h1dwt 
  && t2h1dwt2 < t2w1r1 && t2h1dwt2 < t2w1l1 && t2h1dwt2 < t2h1u1 && t2h1dwt2 < t2h1d1 && t2h1dwt2 < t2w1rwt1 && t2h1dwt2 < t2w1lwt1 && t2h1dwt2 < t2h1uwt1 && t2h1dwt2 < t2h1dwt1
  && t2h1dwt2 < t2w1r2 && t2h1dwt2 < t2w1l2 && t2h1dwt2 < t2h1u2 && t2h1dwt2 < t2h1d2 && t2h1dwt2 < t2w1rwt2 && t2h1dwt2 < t2w1lwt2 && t2h1dwt2 < t2h1uwt2  
  && t2h1dwt2 < t2w1r3 && t2h1dwt2 < t2w1l3 && t2h1dwt2 < t2h1u3 && t2h1dwt2 < t2h1d3 && t2h1dwt2 < t2w1rwt3 && t2h1dwt2 < t2w1lwt3 && t2h1dwt2 < t2h1uwt3 && t2h1dwt2 < t2h1dwt3
  && t2h1dwt2 < t2w1r4 && t2h1dwt2 < t2w1l4 && t2h1dwt2 < t2h1u4 && t2h1dwt2 < t2h1d4 && t2h1dwt2 < t2w1rwt4 && t2h1dwt2 < t2w1lwt4 && t2h1dwt2 < t2h1uwt4 && t2h1dwt2 < t2h1dwt4
  && t2h1dwt2 < t2w1r5 && t2h1dwt2 < t2w1l5 && t2h1dwt2 < t2h1u5 && t2h1dwt2 < t2h1d5 && t2h1dwt2 < t2w1rwt5 && t2h1dwt2 < t2w1lwt5 && t2h1dwt2 < t2h1uwt5 && t2h1dwt2 < t2h1dwt5
  && t2h1dwt2 < t2w1r6 && t2h1dwt2 < t2w1l6 && t2h1dwt2 < t2h1u6 && t2h1dwt2 < t2h1d6 && t2h1dwt2 < t2w1rwt6 && t2h1dwt2 < t2w1lwt6 && t2h1dwt2 < t2h1uwt6 && t2h1dwt2 < t2h1dwt6
  && t2h1dwt2 < t2w1r7 && t2h1dwt2 < t2w1l7 && t2h1dwt2 < t2h1u7 && t2h1dwt2 < t2h1d7 && t2h1dwt2 < t2w1rwt7 && t2h1dwt2 < t2w1lwt7 && t2h1dwt2 < t2h1uwt7 && t2h1dwt2 < t2h1dwt7 
  && t2h1dwt2 < t2w1r8 && t2h1dwt2 < t2w1l8 && t2h1dwt2 < t2h1u8 && t2h1dwt2 < t2h1d8 && t2h1dwt2 < t2w1rwt8 && t2h1dwt2 < t2w1lwt8 && t2h1dwt2 < t2h1uwt8 && t2h1dwt2 < t2h1dwt8
  && t2h1dwt2 < t2w1r9 && t2h1dwt2 < t2w1l9 && t2h1dwt2 < t2h1u9 && t2h1dwt2 < t2h1d9 && t2h1dwt2 < t2w1rwt9 && t2h1dwt2 < t2w1lwt9 && t2h1dwt2 < t2h1uwt9 && t2h1dwt2 < t2h1dwt9 
  && t2h1dwt2 < t2w1r10 && t2h1dwt2 < t2w1l10 && t2h1dwt2 < t2h1u10 && t2h1dwt2 < t2h1d10 && t2h1dwt2 < t2w1rwt10 && t2h1dwt2 < t2w1lwt10 && t2h1dwt2 < t2h1uwt10 && t2h1dwt2 < t2h1dwt10
  && (louthd2 !=0 && linhd2!=0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1dwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1dwt2+z))*(z0wr2+(vz*t2h1dwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1dwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1dwt2+z))*(z0wl2+(vz*t2h1dwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1dwt2+x;
  ytest=vy*t2w1lwt2+y;
  ylimitd=-bhdwt2*sqrt(1-((vz*t2h1dwt2+z)+z0hd2)*((vz*t2h1dwt2+z)+z0hd2)/a2hdwt2);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW2>0){
  i=111;
  }else{
  i=117;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW2!=-1 && t2h1dwt2 > 0 && t2h1dwt2 < t1 
  && t2h1dwt2 < t2w1r && t2h1dwt2 < t2w1l && t2h1dwt2 < t2h1u && t2h1dwt2 < t2h1d && t2h1dwt2 < t2w1rwt && t2h1dwt2 < t2w1lwt && t2h1dwt2 < t2h1uwt && t2h1dwt2 < t2h1dwt 
  && t2h1dwt2 < t2w1r1 && t2h1dwt2 < t2w1l1 && t2h1dwt2 < t2h1u1 && t2h1dwt2 < t2h1d1 && t2h1dwt2 < t2w1rwt1 && t2h1dwt2 < t2w1lwt1 && t2h1dwt2 < t2h1uwt1 && t2h1dwt2 < t2h1dwt1
  && t2h1dwt2 < t2w1r2 && t2h1dwt2 < t2w1l2 && t2h1dwt2 < t2h1u2 && t2h1dwt2 < t2h1d2 && t2h1dwt2 < t2w1rwt2 && t2h1dwt2 < t2w1lwt2 && t2h1dwt2 < t2h1uwt2  
  && t2h1dwt2 < t2w1r3 && t2h1dwt2 < t2w1l3 && t2h1dwt2 < t2h1u3 && t2h1dwt2 < t2h1d3 && t2h1dwt2 < t2w1rwt3 && t2h1dwt2 < t2w1lwt3 && t2h1dwt2 < t2h1uwt3 && t2h1dwt2 < t2h1dwt3
  && t2h1dwt2 < t2w1r4 && t2h1dwt2 < t2w1l4 && t2h1dwt2 < t2h1u4 && t2h1dwt2 < t2h1d4 && t2h1dwt2 < t2w1rwt4 && t2h1dwt2 < t2w1lwt4 && t2h1dwt2 < t2h1uwt4 && t2h1dwt2 < t2h1dwt4
  && t2h1dwt2 < t2w1r5 && t2h1dwt2 < t2w1l5 && t2h1dwt2 < t2h1u5 && t2h1dwt2 < t2h1d5 && t2h1dwt2 < t2w1rwt5 && t2h1dwt2 < t2w1lwt5 && t2h1dwt2 < t2h1uwt5 && t2h1dwt2 < t2h1dwt5
  && t2h1dwt2 < t2w1r6 && t2h1dwt2 < t2w1l6 && t2h1dwt2 < t2h1u6 && t2h1dwt2 < t2h1d6 && t2h1dwt2 < t2w1rwt6 && t2h1dwt2 < t2w1lwt6 && t2h1dwt2 < t2h1uwt6 && t2h1dwt2 < t2h1dwt6
  && t2h1dwt2 < t2w1r7 && t2h1dwt2 < t2w1l7 && t2h1dwt2 < t2h1u7 && t2h1dwt2 < t2h1d7 && t2h1dwt2 < t2w1rwt7 && t2h1dwt2 < t2w1lwt7 && t2h1dwt2 < t2h1uwt7 && t2h1dwt2 < t2h1dwt7 
  && t2h1dwt2 < t2w1r8 && t2h1dwt2 < t2w1l8 && t2h1dwt2 < t2h1u8 && t2h1dwt2 < t2h1d8 && t2h1dwt2 < t2w1rwt8 && t2h1dwt2 < t2w1lwt8 && t2h1dwt2 < t2h1uwt8 && t2h1dwt2 < t2h1dwt8
  && t2h1dwt2 < t2w1r9 && t2h1dwt2 < t2w1l9 && t2h1dwt2 < t2h1u9 && t2h1dwt2 < t2h1d9 && t2h1dwt2 < t2w1rwt9 && t2h1dwt2 < t2w1lwt9 && t2h1dwt2 < t2h1uwt9 && t2h1dwt2 < t2h1dwt9 
  && t2h1dwt2 < t2w1r10 && t2h1dwt2 < t2w1l10 && t2h1dwt2 < t2h1u10 && t2h1dwt2 < t2h1d10 && t2h1dwt2 < t2w1rwt10 && t2h1dwt2 < t2w1lwt10 && t2h1dwt2 < t2h1uwt10 && t2h1dwt2 < t2h1dwt10
  && ((louthd2 !=0 && linhd2==0) || (louthd2 ==0 && linhd2!=0))){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1dwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1dwt2+z))*(z0wr2+(vz*t2h1dwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
     xlimitl=(w2l2-w1l2)/l*(vz*t2h1dwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1dwt2+z))*(z0wl2+(vz*t2h1dwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1dwt2+x;
  ytest=vy*t2w1lwt2+y;
  ylimitd=-sqrt((pbhdwt2-(vz*t2h1dwt2+z))/pahdwt2);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW2>0 ){
  i=112;
  }else{
  i=117;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW2!=-1 && t2h1dwt2 > 0 && t2h1dwt2 < t1 
  && t2h1dwt2 < t2w1r && t2h1dwt2 < t2w1l && t2h1dwt2 < t2h1u && t2h1dwt2 < t2h1d && t2h1dwt2 < t2w1rwt && t2h1dwt2 < t2w1lwt && t2h1dwt2 < t2h1uwt && t2h1dwt2 < t2h1dwt 
  && t2h1dwt2 < t2w1r1 && t2h1dwt2 < t2w1l1 && t2h1dwt2 < t2h1u1 && t2h1dwt2 < t2h1d1 && t2h1dwt2 < t2w1rwt1 && t2h1dwt2 < t2w1lwt1 && t2h1dwt2 < t2h1uwt1 && t2h1dwt2 < t2h1dwt1
  && t2h1dwt2 < t2w1r2 && t2h1dwt2 < t2w1l2 && t2h1dwt2 < t2h1u2 && t2h1dwt2 < t2h1d2 && t2h1dwt2 < t2w1rwt2 && t2h1dwt2 < t2w1lwt2 && t2h1dwt2 < t2h1uwt2  
  && t2h1dwt2 < t2w1r3 && t2h1dwt2 < t2w1l3 && t2h1dwt2 < t2h1u3 && t2h1dwt2 < t2h1d3 && t2h1dwt2 < t2w1rwt3 && t2h1dwt2 < t2w1lwt3 && t2h1dwt2 < t2h1uwt3 && t2h1dwt2 < t2h1dwt3
  && t2h1dwt2 < t2w1r4 && t2h1dwt2 < t2w1l4 && t2h1dwt2 < t2h1u4 && t2h1dwt2 < t2h1d4 && t2h1dwt2 < t2w1rwt4 && t2h1dwt2 < t2w1lwt4 && t2h1dwt2 < t2h1uwt4 && t2h1dwt2 < t2h1dwt4
  && t2h1dwt2 < t2w1r5 && t2h1dwt2 < t2w1l5 && t2h1dwt2 < t2h1u5 && t2h1dwt2 < t2h1d5 && t2h1dwt2 < t2w1rwt5 && t2h1dwt2 < t2w1lwt5 && t2h1dwt2 < t2h1uwt5 && t2h1dwt2 < t2h1dwt5
  && t2h1dwt2 < t2w1r6 && t2h1dwt2 < t2w1l6 && t2h1dwt2 < t2h1u6 && t2h1dwt2 < t2h1d6 && t2h1dwt2 < t2w1rwt6 && t2h1dwt2 < t2w1lwt6 && t2h1dwt2 < t2h1uwt6 && t2h1dwt2 < t2h1dwt6
  && t2h1dwt2 < t2w1r7 && t2h1dwt2 < t2w1l7 && t2h1dwt2 < t2h1u7 && t2h1dwt2 < t2h1d7 && t2h1dwt2 < t2w1rwt7 && t2h1dwt2 < t2w1lwt7 && t2h1dwt2 < t2h1uwt7 && t2h1dwt2 < t2h1dwt7 
  && t2h1dwt2 < t2w1r8 && t2h1dwt2 < t2w1l8 && t2h1dwt2 < t2h1u8 && t2h1dwt2 < t2h1d8 && t2h1dwt2 < t2w1rwt8 && t2h1dwt2 < t2w1lwt8 && t2h1dwt2 < t2h1uwt8 && t2h1dwt2 < t2h1dwt8
  && t2h1dwt2 < t2w1r9 && t2h1dwt2 < t2w1l9 && t2h1dwt2 < t2h1u9 && t2h1dwt2 < t2h1d9 && t2h1dwt2 < t2w1rwt9 && t2h1dwt2 < t2w1lwt9 && t2h1dwt2 < t2h1uwt9 && t2h1dwt2 < t2h1dwt9 
  && t2h1dwt2 < t2w1r10 && t2h1dwt2 < t2w1l10 && t2h1dwt2 < t2h1u10 && t2h1dwt2 < t2h1d10 && t2h1dwt2 < t2w1rwt10 && t2h1dwt2 < t2w1lwt10 && t2h1dwt2 < t2h1uwt10 && t2h1dwt2 < t2h1dwt10
  && (louthd2 == 0 && linhd2 == 0)){
  if(linwr2==0 && loutwr2==0)
  {
    xlimitr=(-w2r2+w1r2)/l*(vz*t2h1dwt2+z)-w1rwt2;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xlimitr=-bwrwt2*sqrt(1-((z0wr2+(vz*t2h1dwt2+z))*(z0wr2+(vz*t2h1dwt2+z)))/a2wrwt2);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt2+z)-pbwrwt2)/-pawrwt2);
    }
  }
  if(linwl2==0 && loutwl2 == 0)
   {
      xlimitl=(w2l2-w1l2)/l*(vz*t2h1dwt2+z)+w1lwt2;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xlimitl=bwlwt2*sqrt(1-((z0wl2+(vz*t2h1dwt2+z))*(z0wl2+(vz*t2h1dwt2+z)))/a2wlwt2);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt2+z)-pbwlwt2)/-pawlwt2);
      }
   }
  xtest=vx*t2h1dwt2+x;
  ytest=vy*t2w1lwt2+y;
  ylimitd=(-h2d2+h1d2)*(vz*t2h1dwt2+z)/l-h1dwt2;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW2>0 ){
  i=113;
  }else{
  i=117;
  }
  }


  if (mxrOW2==-1 && t2w1rwt2 > 0 && t2w1rwt2 < t1 
  && t2w1rwt2 < t2w1r && t2w1rwt2 < t2w1l && t2w1rwt2 < t2h1u && t2w1rwt2 < t2h1d && t2w1rwt2 <t2w1rwt && t2w1rwt2 <t2w1lwt && t2w1rwt2 < t2h1uwt && t2w1rwt2 < t2h1dwt
  && t2w1rwt2 < t2w1r1 && t2w1rwt2 < t2w1l1 && t2w1rwt2 < t2h1u1 && t2w1rwt2 < t2h1d1 && t2w1rwt2 <t2w1rwt1 && t2w1rwt2 <t2w1lwt1 && t2w1rwt2 < t2h1uwt1 && t2w1rwt2 < t2h1dwt1
  && t2w1rwt2 < t2w1r2 && t2w1rwt2 < t2w1l2 && t2w1rwt2 < t2h1u2 && t2w1rwt2 < t2h1d2 && t2w1rwt2 <t2w1lwt2 && t2w1rwt2 < t2h1uwt2 && t2w1rwt2 < t2h1dwt2
  && t2w1rwt2 < t2w1r3 && t2w1rwt2 < t2w1l3 && t2w1rwt2 < t2h1u3 && t2w1rwt2 < t2h1d3 && t2w1rwt2 <t2w1rwt3 && t2w1rwt2 <t2w1lwt3 && t2w1rwt2 < t2h1uwt3 && t2w1rwt2 < t2h1dwt3
  && t2w1rwt2 < t2w1r4 && t2w1rwt2 < t2w1l4 && t2w1rwt2 < t2h1u4 && t2w1rwt2 < t2h1d4 && t2w1rwt2 <t2w1rwt4 && t2w1rwt2 <t2w1lwt4 && t2w1rwt2 < t2h1uwt4 && t2w1rwt2 < t2h1dwt4
  && t2w1rwt2 < t2w1r5 && t2w1rwt2 < t2w1l5 && t2w1rwt2 < t2h1u5 && t2w1rwt2 < t2h1d5 && t2w1rwt2 <t2w1rwt5 && t2w1rwt2 <t2w1lwt5 && t2w1rwt2 < t2h1uwt5 && t2w1rwt2 < t2h1dwt5
  && t2w1rwt2 < t2w1r6 && t2w1rwt2 < t2w1l6 && t2w1rwt2 < t2h1u6 && t2w1rwt2 < t2h1d6 && t2w1rwt2 <t2w1rwt6 && t2w1rwt2 <t2w1lwt6 && t2w1rwt2 < t2h1uwt6 && t2w1rwt2 < t2h1dwt6
  && t2w1rwt2 < t2w1r7 && t2w1rwt2 < t2w1l7 && t2w1rwt2 < t2h1u7 && t2w1rwt2 < t2h1d7 && t2w1rwt2 <t2w1rwt7 && t2w1rwt2 <t2w1lwt7 && t2w1rwt2 < t2h1uwt7 && t2w1rwt2 < t2h1dwt7
  && t2w1rwt2 < t2w1r8 && t2w1rwt2 < t2w1l8 && t2w1rwt2 < t2h1u8 && t2w1rwt2 < t2h1d8 && t2w1rwt2 <t2w1rwt8 && t2w1rwt2 <t2w1lwt8 && t2w1rwt2 < t2h1uwt8 && t2w1rwt2 < t2h1dwt8
  && t2w1rwt2 < t2w1r9 && t2w1rwt2 < t2w1l9 && t2w1rwt2 < t2h1u9 && t2w1rwt2 < t2h1d9 && t2w1rwt2 <t2w1rwt9 && t2w1rwt2 <t2w1lwt9 && t2w1rwt2 < t2h1uwt9 && t2w1rwt2 < t2h1dwt9
  && t2w1rwt2 < t2w1r10 && t2w1rwt2 < t2w1l10 && t2w1rwt2 < t2h1u10 && t2w1rwt2 < t2h1d10 && t2w1rwt2 <t2w1rwt10 && t2w1rwt2 <t2w1lwt10 && t2w1rwt2 < t2h1uwt10 && t2w1rwt2 < t2h1dwt10
  &&  ((linwr2!=0) && (loutwr2!=0) )) {
  i=118;
  }

  if (mxrOW2==-1 && t2w1rwt2 > 0 && t2w1rwt2 < t1 
  && t2w1rwt2 < t2w1r && t2w1rwt2 < t2w1l && t2w1rwt2 < t2h1u && t2w1rwt2 < t2h1d && t2w1rwt2 <t2w1rwt && t2w1rwt2 <t2w1lwt && t2w1rwt2 < t2h1uwt && t2w1rwt2 < t2h1dwt
  && t2w1rwt2 < t2w1r1 && t2w1rwt2 < t2w1l1 && t2w1rwt2 < t2h1u1 && t2w1rwt2 < t2h1d1 && t2w1rwt2 <t2w1rwt1 && t2w1rwt2 <t2w1lwt1 && t2w1rwt2 < t2h1uwt1 && t2w1rwt2 < t2h1dwt1
  && t2w1rwt2 < t2w1r2 && t2w1rwt2 < t2w1l2 && t2w1rwt2 < t2h1u2 && t2w1rwt2 < t2h1d2 && t2w1rwt2 <t2w1lwt2 && t2w1rwt2 < t2h1uwt2 && t2w1rwt2 < t2h1dwt2
  && t2w1rwt2 < t2w1r3 && t2w1rwt2 < t2w1l3 && t2w1rwt2 < t2h1u3 && t2w1rwt2 < t2h1d3 && t2w1rwt2 <t2w1rwt3 && t2w1rwt2 <t2w1lwt3 && t2w1rwt2 < t2h1uwt3 && t2w1rwt2 < t2h1dwt3
  && t2w1rwt2 < t2w1r4 && t2w1rwt2 < t2w1l4 && t2w1rwt2 < t2h1u4 && t2w1rwt2 < t2h1d4 && t2w1rwt2 <t2w1rwt4 && t2w1rwt2 <t2w1lwt4 && t2w1rwt2 < t2h1uwt4 && t2w1rwt2 < t2h1dwt4
  && t2w1rwt2 < t2w1r5 && t2w1rwt2 < t2w1l5 && t2w1rwt2 < t2h1u5 && t2w1rwt2 < t2h1d5 && t2w1rwt2 <t2w1rwt5 && t2w1rwt2 <t2w1lwt5 && t2w1rwt2 < t2h1uwt5 && t2w1rwt2 < t2h1dwt5
  && t2w1rwt2 < t2w1r6 && t2w1rwt2 < t2w1l6 && t2w1rwt2 < t2h1u6 && t2w1rwt2 < t2h1d6 && t2w1rwt2 <t2w1rwt6 && t2w1rwt2 <t2w1lwt6 && t2w1rwt2 < t2h1uwt6 && t2w1rwt2 < t2h1dwt6
  && t2w1rwt2 < t2w1r7 && t2w1rwt2 < t2w1l7 && t2w1rwt2 < t2h1u7 && t2w1rwt2 < t2h1d7 && t2w1rwt2 <t2w1rwt7 && t2w1rwt2 <t2w1lwt7 && t2w1rwt2 < t2h1uwt7 && t2w1rwt2 < t2h1dwt7
  && t2w1rwt2 < t2w1r8 && t2w1rwt2 < t2w1l8 && t2w1rwt2 < t2h1u8 && t2w1rwt2 < t2h1d8 && t2w1rwt2 <t2w1rwt8 && t2w1rwt2 <t2w1lwt8 && t2w1rwt2 < t2h1uwt8 && t2w1rwt2 < t2h1dwt8
  && t2w1rwt2 < t2w1r9 && t2w1rwt2 < t2w1l9 && t2w1rwt2 < t2h1u9 && t2w1rwt2 < t2h1d9 && t2w1rwt2 <t2w1rwt9 && t2w1rwt2 <t2w1lwt9 && t2w1rwt2 < t2h1uwt9 && t2w1rwt2 < t2h1dwt9
  && t2w1rwt2 < t2w1r10 && t2w1rwt2 < t2w1l10 && t2w1rwt2 < t2h1u10 && t2w1rwt2 < t2h1d10 && t2w1rwt2 <t2w1rwt10 && t2w1rwt2 <t2w1lwt10 && t2w1rwt2 < t2h1uwt10 && t2w1rwt2 < t2h1dwt10
  &&  ((loutwr2!=0 && linwr2==0) || (loutwr2==0 && linwr2!=0))){
  i=118;
  }

  if (mxrOW2==-1 && t2w1rwt2 > 0 && t2w1rwt2 < t1 
  && t2w1rwt2 < t2w1r && t2w1rwt2 < t2w1l && t2w1rwt2 < t2h1u && t2w1rwt2 < t2h1d && t2w1rwt2 <t2w1rwt && t2w1rwt2 <t2w1lwt && t2w1rwt2 < t2h1uwt && t2w1rwt2 < t2h1dwt
  && t2w1rwt2 < t2w1r1 && t2w1rwt2 < t2w1l1 && t2w1rwt2 < t2h1u1 && t2w1rwt2 < t2h1d1 && t2w1rwt2 <t2w1rwt1 && t2w1rwt2 <t2w1lwt1 && t2w1rwt2 < t2h1uwt1 && t2w1rwt2 < t2h1dwt1
  && t2w1rwt2 < t2w1r2 && t2w1rwt2 < t2w1l2 && t2w1rwt2 < t2h1u2 && t2w1rwt2 < t2h1d2 && t2w1rwt2 <t2w1lwt2 && t2w1rwt2 < t2h1uwt2 && t2w1rwt2 < t2h1dwt2
  && t2w1rwt2 < t2w1r3 && t2w1rwt2 < t2w1l3 && t2w1rwt2 < t2h1u3 && t2w1rwt2 < t2h1d3 && t2w1rwt2 <t2w1rwt3 && t2w1rwt2 <t2w1lwt3 && t2w1rwt2 < t2h1uwt3 && t2w1rwt2 < t2h1dwt3
  && t2w1rwt2 < t2w1r4 && t2w1rwt2 < t2w1l4 && t2w1rwt2 < t2h1u4 && t2w1rwt2 < t2h1d4 && t2w1rwt2 <t2w1rwt4 && t2w1rwt2 <t2w1lwt4 && t2w1rwt2 < t2h1uwt4 && t2w1rwt2 < t2h1dwt4
  && t2w1rwt2 < t2w1r5 && t2w1rwt2 < t2w1l5 && t2w1rwt2 < t2h1u5 && t2w1rwt2 < t2h1d5 && t2w1rwt2 <t2w1rwt5 && t2w1rwt2 <t2w1lwt5 && t2w1rwt2 < t2h1uwt5 && t2w1rwt2 < t2h1dwt5
  && t2w1rwt2 < t2w1r6 && t2w1rwt2 < t2w1l6 && t2w1rwt2 < t2h1u6 && t2w1rwt2 < t2h1d6 && t2w1rwt2 <t2w1rwt6 && t2w1rwt2 <t2w1lwt6 && t2w1rwt2 < t2h1uwt6 && t2w1rwt2 < t2h1dwt6
  && t2w1rwt2 < t2w1r7 && t2w1rwt2 < t2w1l7 && t2w1rwt2 < t2h1u7 && t2w1rwt2 < t2h1d7 && t2w1rwt2 <t2w1rwt7 && t2w1rwt2 <t2w1lwt7 && t2w1rwt2 < t2h1uwt7 && t2w1rwt2 < t2h1dwt7
  && t2w1rwt2 < t2w1r8 && t2w1rwt2 < t2w1l8 && t2w1rwt2 < t2h1u8 && t2w1rwt2 < t2h1d8 && t2w1rwt2 <t2w1rwt8 && t2w1rwt2 <t2w1lwt8 && t2w1rwt2 < t2h1uwt8 && t2w1rwt2 < t2h1dwt8
  && t2w1rwt2 < t2w1r9 && t2w1rwt2 < t2w1l9 && t2w1rwt2 < t2h1u9 && t2w1rwt2 < t2h1d9 && t2w1rwt2 <t2w1rwt9 && t2w1rwt2 <t2w1lwt9 && t2w1rwt2 < t2h1uwt9 && t2w1rwt2 < t2h1dwt9
  && t2w1rwt2 < t2w1r10 && t2w1rwt2 < t2w1l10 && t2w1rwt2 < t2h1u10 && t2w1rwt2 < t2h1d10 && t2w1rwt2 <t2w1rwt10 && t2w1rwt2 <t2w1lwt10 && t2w1rwt2 < t2h1uwt10 && t2w1rwt2 < t2h1dwt10
  && (loutwr2==0 && linwr2==0)){
  i=118;
  }

  if (mxlOW2==-1 && t2w1lwt2 > 0 && t2w1lwt2 < t1 
  && t2w1lwt2 < t2w1r && t2w1lwt2 < t2w1l && t2w1lwt2 < t2h1u && t2w1lwt2 < t2h1d && t2w1lwt2 <t2w1rwt && t2w1lwt2 <t2w1lwt && t2w1lwt2 < t2h1uwt && t2w1lwt2 < t2h1dwt
  && t2w1lwt2 < t2w1r1 && t2w1lwt2 < t2w1l1 && t2w1lwt2 < t2h1u1 && t2w1lwt2 < t2h1d1 && t2w1lwt2 <t2w1rwt1 && t2w1lwt2 <t2w1lwt1 && t2w1lwt2 < t2h1uwt1 && t2w1lwt2 < t2h1dwt1
  && t2w1lwt2 < t2w1r2 && t2w1lwt2 < t2w1l2 && t2w1lwt2 < t2h1u2 && t2w1lwt2 < t2h1d2 && t2w1lwt2 <t2w1rwt2 && t2w1lwt2 < t2h1uwt2 && t2w1lwt2 < t2h1dwt2
  && t2w1lwt2 < t2w1r3 && t2w1lwt2 < t2w1l3 && t2w1lwt2 < t2h1u3 && t2w1lwt2 < t2h1d3 && t2w1lwt2 <t2w1rwt3 && t2w1lwt2 <t2w1lwt3 && t2w1lwt2 < t2h1uwt3 && t2w1lwt2 < t2h1dwt3
  && t2w1lwt2 < t2w1r4 && t2w1lwt2 < t2w1l4 && t2w1lwt2 < t2h1u4 && t2w1lwt2 < t2h1d4 && t2w1lwt2 <t2w1rwt4 && t2w1lwt2 <t2w1lwt4 && t2w1lwt2 < t2h1uwt4 && t2w1lwt2 < t2h1dwt4
  && t2w1lwt2 < t2w1r5 && t2w1lwt2 < t2w1l5 && t2w1lwt2 < t2h1u5 && t2w1lwt2 < t2h1d5 && t2w1lwt2 <t2w1rwt5 && t2w1lwt2 <t2w1lwt5 && t2w1lwt2 < t2h1uwt5 && t2w1lwt2 < t2h1dwt5
  && t2w1lwt2 < t2w1r6 && t2w1lwt2 < t2w1l6 && t2w1lwt2 < t2h1u6 && t2w1lwt2 < t2h1d6 && t2w1lwt2 <t2w1rwt6 && t2w1lwt2 <t2w1lwt6 && t2w1lwt2 < t2h1uwt6 && t2w1lwt2 < t2h1dwt6
  && t2w1lwt2 < t2w1r7 && t2w1lwt2 < t2w1l7 && t2w1lwt2 < t2h1u7 && t2w1lwt2 < t2h1d7 && t2w1lwt2 <t2w1rwt7 && t2w1lwt2 <t2w1lwt7 && t2w1lwt2 < t2h1uwt7 && t2w1lwt2 < t2h1dwt7
  && t2w1lwt2 < t2w1r8 && t2w1lwt2 < t2w1l8 && t2w1lwt2 < t2h1u8 && t2w1lwt2 < t2h1d8 && t2w1lwt2 <t2w1rwt8 && t2w1lwt2 <t2w1lwt8 && t2w1lwt2 < t2h1uwt8 && t2w1lwt2 < t2h1dwt8
  && t2w1lwt2 < t2w1r9 && t2w1lwt2 < t2w1l9 && t2w1lwt2 < t2h1u9 && t2w1lwt2 < t2h1d9 && t2w1lwt2 <t2w1rwt9 && t2w1lwt2 <t2w1lwt9 && t2w1lwt2 < t2h1uwt9 && t2w1lwt2 < t2h1dwt9
  && t2w1lwt2 < t2w1r10 && t2w1lwt2 < t2w1l10 && t2w1lwt2 < t2h1u10 && t2w1lwt2 < t2h1d10 && t2w1lwt2 <t2w1rwt10 && t2w1lwt2 <t2w1lwt10 && t2w1lwt2 < t2h1uwt10 && t2w1lwt2 < t2h1dwt10
  && ((linwl2!=0) && (loutwl2!=0) )){
  i=119;
  }

  if (mxlOW2==-1 && t2w1lwt2 > 0 && t2w1lwt2 < t1 
  && t2w1lwt2 < t2w1r && t2w1lwt2 < t2w1l && t2w1lwt2 < t2h1u && t2w1lwt2 < t2h1d && t2w1lwt2 <t2w1rwt && t2w1lwt2 <t2w1lwt && t2w1lwt2 < t2h1uwt && t2w1lwt2 < t2h1dwt
  && t2w1lwt2 < t2w1r1 && t2w1lwt2 < t2w1l1 && t2w1lwt2 < t2h1u1 && t2w1lwt2 < t2h1d1 && t2w1lwt2 <t2w1rwt1 && t2w1lwt2 <t2w1lwt1 && t2w1lwt2 < t2h1uwt1 && t2w1lwt2 < t2h1dwt1
  && t2w1lwt2 < t2w1r2 && t2w1lwt2 < t2w1l2 && t2w1lwt2 < t2h1u2 && t2w1lwt2 < t2h1d2 && t2w1lwt2 <t2w1rwt2 && t2w1lwt2 < t2h1uwt2 && t2w1lwt2 < t2h1dwt2
  && t2w1lwt2 < t2w1r3 && t2w1lwt2 < t2w1l3 && t2w1lwt2 < t2h1u3 && t2w1lwt2 < t2h1d3 && t2w1lwt2 <t2w1rwt3 && t2w1lwt2 <t2w1lwt3 && t2w1lwt2 < t2h1uwt3 && t2w1lwt2 < t2h1dwt3
  && t2w1lwt2 < t2w1r4 && t2w1lwt2 < t2w1l4 && t2w1lwt2 < t2h1u4 && t2w1lwt2 < t2h1d4 && t2w1lwt2 <t2w1rwt4 && t2w1lwt2 <t2w1lwt4 && t2w1lwt2 < t2h1uwt4 && t2w1lwt2 < t2h1dwt4
  && t2w1lwt2 < t2w1r5 && t2w1lwt2 < t2w1l5 && t2w1lwt2 < t2h1u5 && t2w1lwt2 < t2h1d5 && t2w1lwt2 <t2w1rwt5 && t2w1lwt2 <t2w1lwt5 && t2w1lwt2 < t2h1uwt5 && t2w1lwt2 < t2h1dwt5
  && t2w1lwt2 < t2w1r6 && t2w1lwt2 < t2w1l6 && t2w1lwt2 < t2h1u6 && t2w1lwt2 < t2h1d6 && t2w1lwt2 <t2w1rwt6 && t2w1lwt2 <t2w1lwt6 && t2w1lwt2 < t2h1uwt6 && t2w1lwt2 < t2h1dwt6
  && t2w1lwt2 < t2w1r7 && t2w1lwt2 < t2w1l7 && t2w1lwt2 < t2h1u7 && t2w1lwt2 < t2h1d7 && t2w1lwt2 <t2w1rwt7 && t2w1lwt2 <t2w1lwt7 && t2w1lwt2 < t2h1uwt7 && t2w1lwt2 < t2h1dwt7
  && t2w1lwt2 < t2w1r8 && t2w1lwt2 < t2w1l8 && t2w1lwt2 < t2h1u8 && t2w1lwt2 < t2h1d8 && t2w1lwt2 <t2w1rwt8 && t2w1lwt2 <t2w1lwt8 && t2w1lwt2 < t2h1uwt8 && t2w1lwt2 < t2h1dwt8
  && t2w1lwt2 < t2w1r9 && t2w1lwt2 < t2w1l9 && t2w1lwt2 < t2h1u9 && t2w1lwt2 < t2h1d9 && t2w1lwt2 <t2w1rwt9 && t2w1lwt2 <t2w1lwt9 && t2w1lwt2 < t2h1uwt9 && t2w1lwt2 < t2h1dwt9
  && t2w1lwt2 < t2w1r10 && t2w1lwt2 < t2w1l10 && t2w1lwt2 < t2h1u10 && t2w1lwt2 < t2h1d10 && t2w1lwt2 <t2w1rwt10 && t2w1lwt2 <t2w1lwt10 && t2w1lwt2 < t2h1uwt10 && t2w1lwt2 < t2h1dwt10
  &&  ((loutwl2!=0 && linwl2==0) || (loutwl2==0 && linwl2!=0))){
  i=119;
  }

  if (mxlOW2==-1 && t2w1lwt2 > 0 && t2w1lwt2 < t1 
  && t2w1lwt2 < t2w1r && t2w1lwt2 < t2w1l && t2w1lwt2 < t2h1u && t2w1lwt2 < t2h1d && t2w1lwt2 <t2w1rwt && t2w1lwt2 <t2w1lwt && t2w1lwt2 < t2h1uwt && t2w1lwt2 < t2h1dwt
  && t2w1lwt2 < t2w1r1 && t2w1lwt2 < t2w1l1 && t2w1lwt2 < t2h1u1 && t2w1lwt2 < t2h1d1 && t2w1lwt2 <t2w1rwt1 && t2w1lwt2 <t2w1lwt1 && t2w1lwt2 < t2h1uwt1 && t2w1lwt2 < t2h1dwt1
  && t2w1lwt2 < t2w1r2 && t2w1lwt2 < t2w1l2 && t2w1lwt2 < t2h1u2 && t2w1lwt2 < t2h1d2 && t2w1lwt2 <t2w1rwt2 && t2w1lwt2 < t2h1uwt2 && t2w1lwt2 < t2h1dwt2
  && t2w1lwt2 < t2w1r3 && t2w1lwt2 < t2w1l3 && t2w1lwt2 < t2h1u3 && t2w1lwt2 < t2h1d3 && t2w1lwt2 <t2w1rwt3 && t2w1lwt2 <t2w1lwt3 && t2w1lwt2 < t2h1uwt3 && t2w1lwt2 < t2h1dwt3
  && t2w1lwt2 < t2w1r4 && t2w1lwt2 < t2w1l4 && t2w1lwt2 < t2h1u4 && t2w1lwt2 < t2h1d4 && t2w1lwt2 <t2w1rwt4 && t2w1lwt2 <t2w1lwt4 && t2w1lwt2 < t2h1uwt4 && t2w1lwt2 < t2h1dwt4
  && t2w1lwt2 < t2w1r5 && t2w1lwt2 < t2w1l5 && t2w1lwt2 < t2h1u5 && t2w1lwt2 < t2h1d5 && t2w1lwt2 <t2w1rwt5 && t2w1lwt2 <t2w1lwt5 && t2w1lwt2 < t2h1uwt5 && t2w1lwt2 < t2h1dwt5
  && t2w1lwt2 < t2w1r6 && t2w1lwt2 < t2w1l6 && t2w1lwt2 < t2h1u6 && t2w1lwt2 < t2h1d6 && t2w1lwt2 <t2w1rwt6 && t2w1lwt2 <t2w1lwt6 && t2w1lwt2 < t2h1uwt6 && t2w1lwt2 < t2h1dwt6
  && t2w1lwt2 < t2w1r7 && t2w1lwt2 < t2w1l7 && t2w1lwt2 < t2h1u7 && t2w1lwt2 < t2h1d7 && t2w1lwt2 <t2w1rwt7 && t2w1lwt2 <t2w1lwt7 && t2w1lwt2 < t2h1uwt7 && t2w1lwt2 < t2h1dwt7
  && t2w1lwt2 < t2w1r8 && t2w1lwt2 < t2w1l8 && t2w1lwt2 < t2h1u8 && t2w1lwt2 < t2h1d8 && t2w1lwt2 <t2w1rwt8 && t2w1lwt2 <t2w1lwt8 && t2w1lwt2 < t2h1uwt8 && t2w1lwt2 < t2h1dwt8
  && t2w1lwt2 < t2w1r9 && t2w1lwt2 < t2w1l9 && t2w1lwt2 < t2h1u9 && t2w1lwt2 < t2h1d9 && t2w1lwt2 <t2w1rwt9 && t2w1lwt2 <t2w1lwt9 && t2w1lwt2 < t2h1uwt9 && t2w1lwt2 < t2h1dwt9
  && t2w1lwt2 < t2w1r10 && t2w1lwt2 < t2w1l10 && t2w1lwt2 < t2h1u10 && t2w1lwt2 < t2h1d10 && t2w1lwt2 <t2w1rwt10 && t2w1lwt2 <t2w1lwt10 && t2w1lwt2 < t2h1uwt10 && t2w1lwt2 < t2h1dwt10
  && (loutwl2==0 && linwl2==0)){
  i=119;
  }

  if (myuOW2==-1 && t2h1uwt2 > 0 && t2h1uwt2 < t1 
  && t2h1uwt2 < t2w1r && t2h1uwt2 < t2w1l && t2h1uwt2 < t2h1u && t2h1uwt2 < t2h1d && t2h1uwt2 < t2w1rwt && t2h1uwt2 < t2w1lwt && t2h1uwt2 < t2h1uwt && t2h1uwt2 < t2h1dwt 
  && t2h1uwt2 < t2w1r1 && t2h1uwt2 < t2w1l1 && t2h1uwt2 < t2h1u1 && t2h1uwt2 < t2h1d1 && t2h1uwt2 < t2w1rwt1 && t2h1uwt2 < t2w1lwt1 && t2h1uwt2 < t2h1uwt1 && t2h1uwt2 < t2h1dwt1
  && t2h1uwt2 < t2w1r2 && t2h1uwt2 < t2w1l2 && t2h1uwt2 < t2h1u2 && t2h1uwt2 < t2h1d2 && t2h1uwt2 < t2w1rwt2 && t2h1uwt2 < t2w1lwt2 && t2h1uwt2 < t2h1dwt2
  && t2h1uwt2 < t2w1r3 && t2h1uwt2 < t2w1l3 && t2h1uwt2 < t2h1u3 && t2h1uwt2 < t2h1d3 && t2h1uwt2 < t2w1rwt3 && t2h1uwt2 < t2w1lwt3 && t2h1uwt2 < t2h1uwt3 && t2h1uwt2 < t2h1dwt3
  && t2h1uwt2 < t2w1r4 && t2h1uwt2 < t2w1l4 && t2h1uwt2 < t2h1u4 && t2h1uwt2 < t2h1d4 && t2h1uwt2 < t2w1rwt4 && t2h1uwt2 < t2w1lwt4 && t2h1uwt2 < t2h1uwt4 && t2h1uwt2 < t2h1dwt4
  && t2h1uwt2 < t2w1r5 && t2h1uwt2 < t2w1l5 && t2h1uwt2 < t2h1u5 && t2h1uwt2 < t2h1d5 && t2h1uwt2 < t2w1rwt5 && t2h1uwt2 < t2w1lwt5 && t2h1uwt2 < t2h1uwt5 && t2h1uwt2 < t2h1dwt5
  && t2h1uwt2 < t2w1r6 && t2h1uwt2 < t2w1l6 && t2h1uwt2 < t2h1u6 && t2h1uwt2 < t2h1d6 && t2h1uwt2 < t2w1rwt6 && t2h1uwt2 < t2w1lwt6 && t2h1uwt2 < t2h1uwt6 && t2h1uwt2 < t2h1dwt6
  && t2h1uwt2 < t2w1r7 && t2h1uwt2 < t2w1l7 && t2h1uwt2 < t2h1u7 && t2h1uwt2 < t2h1d7 && t2h1uwt2 < t2w1rwt7 && t2h1uwt2 < t2w1lwt7 && t2h1uwt2 < t2h1uwt7 && t2h1uwt2 < t2h1dwt7
  && t2h1uwt2 < t2w1r8 && t2h1uwt2 < t2w1l8 && t2h1uwt2 < t2h1u8 && t2h1uwt2 < t2h1d8 && t2h1uwt2 < t2w1rwt8 && t2h1uwt2 < t2w1lwt8 && t2h1uwt2 < t2h1uwt8 && t2h1uwt2 < t2h1dwt8
  && t2h1uwt2 < t2w1r9 && t2h1uwt2 < t2w1l9 && t2h1uwt2 < t2h1u9 && t2h1uwt2 < t2h1d9 && t2h1uwt2 < t2w1rwt9 && t2h1uwt2 < t2w1lwt9 && t2h1uwt2 < t2h1uwt9 && t2h1uwt2 < t2h1dwt9
  && t2h1uwt2 < t2w1r10 && t2h1uwt2 < t2w1l10 && t2h1uwt2 < t2h1u10 && t2h1uwt2 < t2h1d10 && t2h1uwt2 < t2w1rwt10 && t2h1uwt2 < t2w1lwt10 && t2h1uwt2 < t2h1uwt10 && t2h1uwt2 < t2h1dwt10
  && (louthu2 !=0 && linhu2!=0)){
  i=120;
  }

  if (myuOW2==-1 && t2h1uwt2 > 0 && t2h1uwt2 < t1 
  && t2h1uwt2 < t2w1r && t2h1uwt2 < t2w1l && t2h1uwt2 < t2h1u && t2h1uwt2 < t2h1d && t2h1uwt2 < t2w1rwt && t2h1uwt2 < t2w1lwt && t2h1uwt2 < t2h1uwt && t2h1uwt2 < t2h1dwt 
  && t2h1uwt2 < t2w1r1 && t2h1uwt2 < t2w1l1 && t2h1uwt2 < t2h1u1 && t2h1uwt2 < t2h1d1 && t2h1uwt2 < t2w1rwt1 && t2h1uwt2 < t2w1lwt1 && t2h1uwt2 < t2h1uwt1 && t2h1uwt2 < t2h1dwt1
  && t2h1uwt2 < t2w1r2 && t2h1uwt2 < t2w1l2 && t2h1uwt2 < t2h1u2 && t2h1uwt2 < t2h1d2 && t2h1uwt2 < t2w1rwt2 && t2h1uwt2 < t2w1lwt2 && t2h1uwt2 < t2h1dwt2
  && t2h1uwt2 < t2w1r3 && t2h1uwt2 < t2w1l3 && t2h1uwt2 < t2h1u3 && t2h1uwt2 < t2h1d3 && t2h1uwt2 < t2w1rwt3 && t2h1uwt2 < t2w1lwt3 && t2h1uwt2 < t2h1uwt3 && t2h1uwt2 < t2h1dwt3
  && t2h1uwt2 < t2w1r4 && t2h1uwt2 < t2w1l4 && t2h1uwt2 < t2h1u4 && t2h1uwt2 < t2h1d4 && t2h1uwt2 < t2w1rwt4 && t2h1uwt2 < t2w1lwt4 && t2h1uwt2 < t2h1uwt4 && t2h1uwt2 < t2h1dwt4
  && t2h1uwt2 < t2w1r5 && t2h1uwt2 < t2w1l5 && t2h1uwt2 < t2h1u5 && t2h1uwt2 < t2h1d5 && t2h1uwt2 < t2w1rwt5 && t2h1uwt2 < t2w1lwt5 && t2h1uwt2 < t2h1uwt5 && t2h1uwt2 < t2h1dwt5
  && t2h1uwt2 < t2w1r6 && t2h1uwt2 < t2w1l6 && t2h1uwt2 < t2h1u6 && t2h1uwt2 < t2h1d6 && t2h1uwt2 < t2w1rwt6 && t2h1uwt2 < t2w1lwt6 && t2h1uwt2 < t2h1uwt6 && t2h1uwt2 < t2h1dwt6
  && t2h1uwt2 < t2w1r7 && t2h1uwt2 < t2w1l7 && t2h1uwt2 < t2h1u7 && t2h1uwt2 < t2h1d7 && t2h1uwt2 < t2w1rwt7 && t2h1uwt2 < t2w1lwt7 && t2h1uwt2 < t2h1uwt7 && t2h1uwt2 < t2h1dwt7
  && t2h1uwt2 < t2w1r8 && t2h1uwt2 < t2w1l8 && t2h1uwt2 < t2h1u8 && t2h1uwt2 < t2h1d8 && t2h1uwt2 < t2w1rwt8 && t2h1uwt2 < t2w1lwt8 && t2h1uwt2 < t2h1uwt8 && t2h1uwt2 < t2h1dwt8
  && t2h1uwt2 < t2w1r9 && t2h1uwt2 < t2w1l9 && t2h1uwt2 < t2h1u9 && t2h1uwt2 < t2h1d9 && t2h1uwt2 < t2w1rwt9 && t2h1uwt2 < t2w1lwt9 && t2h1uwt2 < t2h1uwt9 && t2h1uwt2 < t2h1dwt9
  && t2h1uwt2 < t2w1r10 && t2h1uwt2 < t2w1l10 && t2h1uwt2 < t2h1u10 && t2h1uwt2 < t2h1d10 && t2h1uwt2 < t2w1rwt10 && t2h1uwt2 < t2w1lwt10 && t2h1uwt2 < t2h1uwt10 && t2h1uwt2 < t2h1dwt10
  && ((louthu2 !=0 && linhu2==0) || (louthu2 ==0 && linhu2!=0))) {
  i=120;
  }

  if (myuOW2==-1 && t2h1uwt2 > 0 && t2h1uwt2 < t1 
  && t2h1uwt2 < t2w1r && t2h1uwt2 < t2w1l && t2h1uwt2 < t2h1u && t2h1uwt2 < t2h1d && t2h1uwt2 < t2w1rwt && t2h1uwt2 < t2w1lwt && t2h1uwt2 < t2h1uwt && t2h1uwt2 < t2h1dwt 
  && t2h1uwt2 < t2w1r1 && t2h1uwt2 < t2w1l1 && t2h1uwt2 < t2h1u1 && t2h1uwt2 < t2h1d1 && t2h1uwt2 < t2w1rwt1 && t2h1uwt2 < t2w1lwt1 && t2h1uwt2 < t2h1uwt1 && t2h1uwt2 < t2h1dwt1
  && t2h1uwt2 < t2w1r2 && t2h1uwt2 < t2w1l2 && t2h1uwt2 < t2h1u2 && t2h1uwt2 < t2h1d2 && t2h1uwt2 < t2w1rwt2 && t2h1uwt2 < t2w1lwt2 && t2h1uwt2 < t2h1dwt2
  && t2h1uwt2 < t2w1r3 && t2h1uwt2 < t2w1l3 && t2h1uwt2 < t2h1u3 && t2h1uwt2 < t2h1d3 && t2h1uwt2 < t2w1rwt3 && t2h1uwt2 < t2w1lwt3 && t2h1uwt2 < t2h1uwt3 && t2h1uwt2 < t2h1dwt3
  && t2h1uwt2 < t2w1r4 && t2h1uwt2 < t2w1l4 && t2h1uwt2 < t2h1u4 && t2h1uwt2 < t2h1d4 && t2h1uwt2 < t2w1rwt4 && t2h1uwt2 < t2w1lwt4 && t2h1uwt2 < t2h1uwt4 && t2h1uwt2 < t2h1dwt4
  && t2h1uwt2 < t2w1r5 && t2h1uwt2 < t2w1l5 && t2h1uwt2 < t2h1u5 && t2h1uwt2 < t2h1d5 && t2h1uwt2 < t2w1rwt5 && t2h1uwt2 < t2w1lwt5 && t2h1uwt2 < t2h1uwt5 && t2h1uwt2 < t2h1dwt5
  && t2h1uwt2 < t2w1r6 && t2h1uwt2 < t2w1l6 && t2h1uwt2 < t2h1u6 && t2h1uwt2 < t2h1d6 && t2h1uwt2 < t2w1rwt6 && t2h1uwt2 < t2w1lwt6 && t2h1uwt2 < t2h1uwt6 && t2h1uwt2 < t2h1dwt6
  && t2h1uwt2 < t2w1r7 && t2h1uwt2 < t2w1l7 && t2h1uwt2 < t2h1u7 && t2h1uwt2 < t2h1d7 && t2h1uwt2 < t2w1rwt7 && t2h1uwt2 < t2w1lwt7 && t2h1uwt2 < t2h1uwt7 && t2h1uwt2 < t2h1dwt7
  && t2h1uwt2 < t2w1r8 && t2h1uwt2 < t2w1l8 && t2h1uwt2 < t2h1u8 && t2h1uwt2 < t2h1d8 && t2h1uwt2 < t2w1rwt8 && t2h1uwt2 < t2w1lwt8 && t2h1uwt2 < t2h1uwt8 && t2h1uwt2 < t2h1dwt8
  && t2h1uwt2 < t2w1r9 && t2h1uwt2 < t2w1l9 && t2h1uwt2 < t2h1u9 && t2h1uwt2 < t2h1d9 && t2h1uwt2 < t2w1rwt9 && t2h1uwt2 < t2w1lwt9 && t2h1uwt2 < t2h1uwt9 && t2h1uwt2 < t2h1dwt9
  && t2h1uwt2 < t2w1r10 && t2h1uwt2 < t2w1l10 && t2h1uwt2 < t2h1u10 && t2h1uwt2 < t2h1d10 && t2h1uwt2 < t2w1rwt10 && t2h1uwt2 < t2w1lwt10 && t2h1uwt2 < t2h1uwt10 && t2h1uwt2 < t2h1dwt10
  && (louthu2 == 0 && linhu2 == 0)){
  i=120;
  }

  if (mydOW2==-1 && t2h1dwt2 > 0 && t2h1dwt2 < t1 
  && t2h1dwt2 < t2w1r && t2h1dwt2 < t2w1l && t2h1dwt2 < t2h1u && t2h1dwt2 < t2h1d && t2h1dwt2 < t2w1rwt && t2h1dwt2 < t2w1lwt && t2h1dwt2 < t2h1uwt && t2h1dwt2 < t2h1dwt 
  && t2h1dwt2 < t2w1r1 && t2h1dwt2 < t2w1l1 && t2h1dwt2 < t2h1u1 && t2h1dwt2 < t2h1d1 && t2h1dwt2 < t2w1rwt1 && t2h1dwt2 < t2w1lwt1 && t2h1dwt2 < t2h1uwt1 && t2h1dwt2 < t2h1dwt1
  && t2h1dwt2 < t2w1r2 && t2h1dwt2 < t2w1l2 && t2h1dwt2 < t2h1u2 && t2h1dwt2 < t2h1d2 && t2h1dwt2 < t2w1rwt2 && t2h1dwt2 < t2w1lwt2 && t2h1dwt2 < t2h1uwt2  
  && t2h1dwt2 < t2w1r3 && t2h1dwt2 < t2w1l3 && t2h1dwt2 < t2h1u3 && t2h1dwt2 < t2h1d3 && t2h1dwt2 < t2w1rwt3 && t2h1dwt2 < t2w1lwt3 && t2h1dwt2 < t2h1uwt3 && t2h1dwt2 < t2h1dwt3
  && t2h1dwt2 < t2w1r4 && t2h1dwt2 < t2w1l4 && t2h1dwt2 < t2h1u4 && t2h1dwt2 < t2h1d4 && t2h1dwt2 < t2w1rwt4 && t2h1dwt2 < t2w1lwt4 && t2h1dwt2 < t2h1uwt4 && t2h1dwt2 < t2h1dwt4
  && t2h1dwt2 < t2w1r5 && t2h1dwt2 < t2w1l5 && t2h1dwt2 < t2h1u5 && t2h1dwt2 < t2h1d5 && t2h1dwt2 < t2w1rwt5 && t2h1dwt2 < t2w1lwt5 && t2h1dwt2 < t2h1uwt5 && t2h1dwt2 < t2h1dwt5
  && t2h1dwt2 < t2w1r6 && t2h1dwt2 < t2w1l6 && t2h1dwt2 < t2h1u6 && t2h1dwt2 < t2h1d6 && t2h1dwt2 < t2w1rwt6 && t2h1dwt2 < t2w1lwt6 && t2h1dwt2 < t2h1uwt6 && t2h1dwt2 < t2h1dwt6
  && t2h1dwt2 < t2w1r7 && t2h1dwt2 < t2w1l7 && t2h1dwt2 < t2h1u7 && t2h1dwt2 < t2h1d7 && t2h1dwt2 < t2w1rwt7 && t2h1dwt2 < t2w1lwt7 && t2h1dwt2 < t2h1uwt7 && t2h1dwt2 < t2h1dwt7 
  && t2h1dwt2 < t2w1r8 && t2h1dwt2 < t2w1l8 && t2h1dwt2 < t2h1u8 && t2h1dwt2 < t2h1d8 && t2h1dwt2 < t2w1rwt8 && t2h1dwt2 < t2w1lwt8 && t2h1dwt2 < t2h1uwt8 && t2h1dwt2 < t2h1dwt8
  && t2h1dwt2 < t2w1r9 && t2h1dwt2 < t2w1l9 && t2h1dwt2 < t2h1u9 && t2h1dwt2 < t2h1d9 && t2h1dwt2 < t2w1rwt9 && t2h1dwt2 < t2w1lwt9 && t2h1dwt2 < t2h1uwt9 && t2h1dwt2 < t2h1dwt9 
  && t2h1dwt2 < t2w1r10 && t2h1dwt2 < t2w1l10 && t2h1dwt2 < t2h1u10 && t2h1dwt2 < t2h1d10 && t2h1dwt2 < t2w1rwt10 && t2h1dwt2 < t2w1lwt10 && t2h1dwt2 < t2h1uwt10 && t2h1dwt2 < t2h1dwt10
  && (louthd2 !=0 && linhd2!=0)){
  i=121;
  }

  if (mydOW2==-1 && t2h1dwt2 > 0 && t2h1dwt2 < t1 
  && t2h1dwt2 < t2w1r && t2h1dwt2 < t2w1l && t2h1dwt2 < t2h1u && t2h1dwt2 < t2h1d && t2h1dwt2 < t2w1rwt && t2h1dwt2 < t2w1lwt && t2h1dwt2 < t2h1uwt && t2h1dwt2 < t2h1dwt 
  && t2h1dwt2 < t2w1r1 && t2h1dwt2 < t2w1l1 && t2h1dwt2 < t2h1u1 && t2h1dwt2 < t2h1d1 && t2h1dwt2 < t2w1rwt1 && t2h1dwt2 < t2w1lwt1 && t2h1dwt2 < t2h1uwt1 && t2h1dwt2 < t2h1dwt1
  && t2h1dwt2 < t2w1r2 && t2h1dwt2 < t2w1l2 && t2h1dwt2 < t2h1u2 && t2h1dwt2 < t2h1d2 && t2h1dwt2 < t2w1rwt2 && t2h1dwt2 < t2w1lwt2 && t2h1dwt2 < t2h1uwt2  
  && t2h1dwt2 < t2w1r3 && t2h1dwt2 < t2w1l3 && t2h1dwt2 < t2h1u3 && t2h1dwt2 < t2h1d3 && t2h1dwt2 < t2w1rwt3 && t2h1dwt2 < t2w1lwt3 && t2h1dwt2 < t2h1uwt3 && t2h1dwt2 < t2h1dwt3
  && t2h1dwt2 < t2w1r4 && t2h1dwt2 < t2w1l4 && t2h1dwt2 < t2h1u4 && t2h1dwt2 < t2h1d4 && t2h1dwt2 < t2w1rwt4 && t2h1dwt2 < t2w1lwt4 && t2h1dwt2 < t2h1uwt4 && t2h1dwt2 < t2h1dwt4
  && t2h1dwt2 < t2w1r5 && t2h1dwt2 < t2w1l5 && t2h1dwt2 < t2h1u5 && t2h1dwt2 < t2h1d5 && t2h1dwt2 < t2w1rwt5 && t2h1dwt2 < t2w1lwt5 && t2h1dwt2 < t2h1uwt5 && t2h1dwt2 < t2h1dwt5
  && t2h1dwt2 < t2w1r6 && t2h1dwt2 < t2w1l6 && t2h1dwt2 < t2h1u6 && t2h1dwt2 < t2h1d6 && t2h1dwt2 < t2w1rwt6 && t2h1dwt2 < t2w1lwt6 && t2h1dwt2 < t2h1uwt6 && t2h1dwt2 < t2h1dwt6
  && t2h1dwt2 < t2w1r7 && t2h1dwt2 < t2w1l7 && t2h1dwt2 < t2h1u7 && t2h1dwt2 < t2h1d7 && t2h1dwt2 < t2w1rwt7 && t2h1dwt2 < t2w1lwt7 && t2h1dwt2 < t2h1uwt7 && t2h1dwt2 < t2h1dwt7 
  && t2h1dwt2 < t2w1r8 && t2h1dwt2 < t2w1l8 && t2h1dwt2 < t2h1u8 && t2h1dwt2 < t2h1d8 && t2h1dwt2 < t2w1rwt8 && t2h1dwt2 < t2w1lwt8 && t2h1dwt2 < t2h1uwt8 && t2h1dwt2 < t2h1dwt8
  && t2h1dwt2 < t2w1r9 && t2h1dwt2 < t2w1l9 && t2h1dwt2 < t2h1u9 && t2h1dwt2 < t2h1d9 && t2h1dwt2 < t2w1rwt9 && t2h1dwt2 < t2w1lwt9 && t2h1dwt2 < t2h1uwt9 && t2h1dwt2 < t2h1dwt9 
  && t2h1dwt2 < t2w1r10 && t2h1dwt2 < t2w1l10 && t2h1dwt2 < t2h1u10 && t2h1dwt2 < t2h1d10 && t2h1dwt2 < t2w1rwt10 && t2h1dwt2 < t2w1lwt10 && t2h1dwt2 < t2h1uwt10 && t2h1dwt2 < t2h1dwt10
  && ((louthd2 !=0 && linhd2==0) || (louthd2 ==0 && linhd2!=0))){
  i=121;
  }

  if (mydOW2==-1 && t2h1dwt2 > 0 && t2h1dwt2 < t1 
  && t2h1dwt2 < t2w1r && t2h1dwt2 < t2w1l && t2h1dwt2 < t2h1u && t2h1dwt2 < t2h1d && t2h1dwt2 < t2w1rwt && t2h1dwt2 < t2w1lwt && t2h1dwt2 < t2h1uwt && t2h1dwt2 < t2h1dwt 
  && t2h1dwt2 < t2w1r1 && t2h1dwt2 < t2w1l1 && t2h1dwt2 < t2h1u1 && t2h1dwt2 < t2h1d1 && t2h1dwt2 < t2w1rwt1 && t2h1dwt2 < t2w1lwt1 && t2h1dwt2 < t2h1uwt1 && t2h1dwt2 < t2h1dwt1
  && t2h1dwt2 < t2w1r2 && t2h1dwt2 < t2w1l2 && t2h1dwt2 < t2h1u2 && t2h1dwt2 < t2h1d2 && t2h1dwt2 < t2w1rwt2 && t2h1dwt2 < t2w1lwt2 && t2h1dwt2 < t2h1uwt2  
  && t2h1dwt2 < t2w1r3 && t2h1dwt2 < t2w1l3 && t2h1dwt2 < t2h1u3 && t2h1dwt2 < t2h1d3 && t2h1dwt2 < t2w1rwt3 && t2h1dwt2 < t2w1lwt3 && t2h1dwt2 < t2h1uwt3 && t2h1dwt2 < t2h1dwt3
  && t2h1dwt2 < t2w1r4 && t2h1dwt2 < t2w1l4 && t2h1dwt2 < t2h1u4 && t2h1dwt2 < t2h1d4 && t2h1dwt2 < t2w1rwt4 && t2h1dwt2 < t2w1lwt4 && t2h1dwt2 < t2h1uwt4 && t2h1dwt2 < t2h1dwt4
  && t2h1dwt2 < t2w1r5 && t2h1dwt2 < t2w1l5 && t2h1dwt2 < t2h1u5 && t2h1dwt2 < t2h1d5 && t2h1dwt2 < t2w1rwt5 && t2h1dwt2 < t2w1lwt5 && t2h1dwt2 < t2h1uwt5 && t2h1dwt2 < t2h1dwt5
  && t2h1dwt2 < t2w1r6 && t2h1dwt2 < t2w1l6 && t2h1dwt2 < t2h1u6 && t2h1dwt2 < t2h1d6 && t2h1dwt2 < t2w1rwt6 && t2h1dwt2 < t2w1lwt6 && t2h1dwt2 < t2h1uwt6 && t2h1dwt2 < t2h1dwt6
  && t2h1dwt2 < t2w1r7 && t2h1dwt2 < t2w1l7 && t2h1dwt2 < t2h1u7 && t2h1dwt2 < t2h1d7 && t2h1dwt2 < t2w1rwt7 && t2h1dwt2 < t2w1lwt7 && t2h1dwt2 < t2h1uwt7 && t2h1dwt2 < t2h1dwt7 
  && t2h1dwt2 < t2w1r8 && t2h1dwt2 < t2w1l8 && t2h1dwt2 < t2h1u8 && t2h1dwt2 < t2h1d8 && t2h1dwt2 < t2w1rwt8 && t2h1dwt2 < t2w1lwt8 && t2h1dwt2 < t2h1uwt8 && t2h1dwt2 < t2h1dwt8
  && t2h1dwt2 < t2w1r9 && t2h1dwt2 < t2w1l9 && t2h1dwt2 < t2h1u9 && t2h1dwt2 < t2h1d9 && t2h1dwt2 < t2w1rwt9 && t2h1dwt2 < t2w1lwt9 && t2h1dwt2 < t2h1uwt9 && t2h1dwt2 < t2h1dwt9 
  && t2h1dwt2 < t2w1r10 && t2h1dwt2 < t2w1l10 && t2h1dwt2 < t2h1u10 && t2h1dwt2 < t2h1d10 && t2h1dwt2 < t2w1rwt10 && t2h1dwt2 < t2w1lwt10 && t2h1dwt2 < t2h1uwt10 && t2h1dwt2 < t2h1dwt10
  && (louthd2 == 0 && linhd2 == 0)){
  i=121;
  }

										/*   THIRD SHELL  */



  if (t1 < t2w1r && t1 < t2w1l && t1 < t2h1u && t1 < t2h1d && t1 < t2w1rwt && t1 < t2w1lwt && t1 < t2h1uwt && t1 < t2h1dwt && t1 < t2w1r1 && t1 < t2w1l1 && t1 < t2h1u1 && t1 < t2h1d1 && t1 < t2w1rwt1 && t1 < t2w1lwt1 && t1 < t2h1uwt1 && t1 < t2h1dwt1 && t1 < t2w1r2 && t1 < t2w1l2 && t1 < t2h1u2 && t1 < t2h1d2 && t1 < t2w1rwt2 && t1 < t2w1lwt2 && t1 < t2h1uwt2 && t1 < t2h1dwt2 && t1 < t2w1r3 && t1 < t2w1l3 && t1 < t2h1u3 && t1 < t2h1d3 && t1 < t2w1rwt3 && t1 < t2w1lwt3 && t1 < t2h1uwt3 && t1 < t2h1dwt3 && t1 < t2w1r4 && t1 < t2w1l4 && t1 < t2h1u4 && t1 < t2h1d4 && t1 < t2w1rwt4 && t1 < t2w1lwt4 && t1 < t2h1uwt4 && t1 < t2h1dwt4 && t1 < t2w1r5 && t1 < t2w1l5 && t1 < t2h1u5 && t1 < t2h1d5 && t1 < t2w1rwt5 && t1 < t2w1lwt5 && t1 < t2h1uwt5 && t1 < t2h1dwt5 && t1 < t2w1r6 && t1 < t2w1l6 && t1 < t2h1u6 && t1 < t2h1d6 && t1 < t2w1rwt6 && t1 < t2w1lwt6 && t1 < t2h1uwt6 && t1 < t2h1dwt6 && t1 < t2w1r7 && t1 < t2w1l7 && t1 < t2h1u7 && t1 < t2h1d7 && t1 < t2w1rwt7 && t1 < t2w1lwt7 && t1 < t2h1uwt7 && t1 < t2h1dwt7 && t1 < t2w1r8 && t1 < t2w1l8 && t1 < t2h1u8 && t1 < t2h1d8 && t1 < t2w1rwt8 && t1 < t2w1lwt8 && t1 < t2h1uwt8 && t1 < t2h1dwt8 && t1 < t2w1r9 && t1 < t2w1l9 && t1 < t2h1u9 && t1 < t2h1d9 && t1 < t2w1rwt9 && t1 < t2w1lwt9 && t1 < t2h1uwt9 && t1 < t2h1dwt9 && t1 < t2w1r10 && t1 < t2w1l10 && t1 < t2h1u10 && t1 < t2h1d10 && t1 < t2w1rwt10 && t1 < t2w1lwt10 && t1 < t2h1uwt10 && t1 < t2h1dwt10){
  i=1;
  }

							/* neutron interacts with the INNER elliptic right wall and this wall is NOT transparent*/

  if (mxr3!=-1 && t2w1r3 > 0 && t2w1r3 < t1 
     && t2w1r3 < t2w1r && t2w1r3 < t2w1l && t2w1r3 < t2h1u && t2w1r3 < t2h1d && t2w1r3 < t2w1rwt && t2w1r3 < t2w1lwt && t2w1r3 < t2h1uwt && t2w1r3 < t2h1dwt
     && t2w1r3 < t2w1r1 && t2w1r3 < t2w1l1 && t2w1r3 < t2h1u1 && t2w1r3 < t2h1d1 && t2w1r3 < t2w1rwt1 && t2w1r3 < t2w1lwt1 && t2w1r3 < t2h1uwt1 && t2w1r3 < t2h1dwt1
     && t2w1r3 < t2w1r2 && t2w1r3 < t2w1l2 && t2w1r3 < t2h1u2 && t2w1r3 < t2h1d2 && t2w1r3 < t2w1rwt2 && t2w1r3 < t2w1lwt2 && t2w1r3 < t2h1uwt2 && t2w1r3 < t2h1dwt2 
     && t2w1r3 < t2w1l3 && t2w1r3 < t2h1u3 && t2w1r3 < t2h1d3 && t2w1r3 < t2w1rwt3 && t2w1r3 < t2w1lwt3 && t2w1r3 < t2h1uwt3 && t2w1r3 < t2h1dwt3
     && t2w1r3 < t2w1r4 && t2w1r3 < t2w1l4 && t2w1r3 < t2h1u4 && t2w1r3 < t2h1d4 && t2w1r3 < t2w1rwt4 && t2w1r3 < t2w1lwt4 && t2w1r3 < t2h1uwt4 && t2w1r3 < t2h1dwt4
     && t2w1r3 < t2w1r5 && t2w1r3 < t2w1l5 && t2w1r3 < t2h1u5 && t2w1r3 < t2h1d5 && t2w1r3 < t2w1rwt5 && t2w1r3 < t2w1lwt5 && t2w1r3 < t2h1uwt5 && t2w1r3 < t2h1dwt5
     && t2w1r3 < t2w1r6 && t2w1r3 < t2w1l6 && t2w1r3 < t2h1u6 && t2w1r3 < t2h1d6 && t2w1r3 < t2w1rwt6 && t2w1r3 < t2w1lwt6 && t2w1r3 < t2h1uwt6 && t2w1r3 < t2h1dwt6
     && t2w1r3 < t2w1r7 && t2w1r3 < t2w1l7 && t2w1r3 < t2h1u7 && t2w1r3 < t2h1d7 && t2w1r3 < t2w1rwt7 && t2w1r3 < t2w1lwt7 && t2w1r3 < t2h1uwt7 && t2w1r3 < t2h1dwt7
     && t2w1r3 < t2w1r8 && t2w1r3 < t2w1l8 && t2w1r3 < t2h1u8 && t2w1r3 < t2h1d8 && t2w1r3 < t2w1rwt8 && t2w1r3 < t2w1lwt8 && t2w1r3 < t2h1uwt8 && t2w1r3 < t2h1dwt8
     && t2w1r3 < t2w1r9 && t2w1r3 < t2w1l9 && t2w1r3 < t2h1u9 && t2w1r3 < t2h1d9 && t2w1r3 < t2w1rwt9 && t2w1r3 < t2w1lwt9 && t2w1r3 < t2h1uwt9 && t2w1r3 < t2h1dwt9
     && t2w1r3 < t2w1r10 && t2w1r3 < t2w1l10 && t2w1r3 < t2h1u10 && t2w1r3 < t2h1d10 && t2w1r3 < t2w1rwt10 && t2w1r3 < t2w1lwt10 && t2w1r3 < t2h1uwt10 && t2w1r3 < t2h1dwt10
     && ((linwr3!=0) && (loutwr3!=0) )) {	
    if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1r3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1r3+z))*(z0hd3+(vz*t2w1r3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1r3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1r3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1r3+z))*(z0hu3+(vz*t2w1r3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1r3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1r3+y;
  xlimitr=bwr3*sqrt(1-((vz*t2w1r3+z)+z0wr3)*((vz*t2w1r3+z)+z0wr3)/a2wr3);
  xtest=vx*t2w1r3+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr3 > 0){
  i=122;
  }else{
  i=138;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr3!=-1 && t2w1r3 > 0 && t2w1r3 < t1 
     && t2w1r3 < t2w1r && t2w1r3 < t2w1l && t2w1r3 < t2h1u && t2w1r3 < t2h1d && t2w1r3 < t2w1rwt && t2w1r3 < t2w1lwt && t2w1r3 < t2h1uwt && t2w1r3 < t2h1dwt
     && t2w1r3 < t2w1r1 && t2w1r3 < t2w1l1 && t2w1r3 < t2h1u1 && t2w1r3 < t2h1d1 && t2w1r3 < t2w1rwt1 && t2w1r3 < t2w1lwt1 && t2w1r3 < t2h1uwt1 && t2w1r3 < t2h1dwt1
     && t2w1r3 < t2w1r2 && t2w1r3 < t2w1l2 && t2w1r3 < t2h1u2 && t2w1r3 < t2h1d2 && t2w1r3 < t2w1rwt2 && t2w1r3 < t2w1lwt2 && t2w1r3 < t2h1uwt2 && t2w1r3 < t2h1dwt2 
     && t2w1r3 < t2w1l3 && t2w1r3 < t2h1u3 && t2w1r3 < t2h1d3 && t2w1r3 < t2w1rwt3 && t2w1r3 < t2w1lwt3 && t2w1r3 < t2h1uwt3 && t2w1r3 < t2h1dwt3
     && t2w1r3 < t2w1r4 && t2w1r3 < t2w1l4 && t2w1r3 < t2h1u4 && t2w1r3 < t2h1d4 && t2w1r3 < t2w1rwt4 && t2w1r3 < t2w1lwt4 && t2w1r3 < t2h1uwt4 && t2w1r3 < t2h1dwt4
     && t2w1r3 < t2w1r5 && t2w1r3 < t2w1l5 && t2w1r3 < t2h1u5 && t2w1r3 < t2h1d5 && t2w1r3 < t2w1rwt5 && t2w1r3 < t2w1lwt5 && t2w1r3 < t2h1uwt5 && t2w1r3 < t2h1dwt5
     && t2w1r3 < t2w1r6 && t2w1r3 < t2w1l6 && t2w1r3 < t2h1u6 && t2w1r3 < t2h1d6 && t2w1r3 < t2w1rwt6 && t2w1r3 < t2w1lwt6 && t2w1r3 < t2h1uwt6 && t2w1r3 < t2h1dwt6
     && t2w1r3 < t2w1r7 && t2w1r3 < t2w1l7 && t2w1r3 < t2h1u7 && t2w1r3 < t2h1d7 && t2w1r3 < t2w1rwt7 && t2w1r3 < t2w1lwt7 && t2w1r3 < t2h1uwt7 && t2w1r3 < t2h1dwt7
     && t2w1r3 < t2w1r8 && t2w1r3 < t2w1l8 && t2w1r3 < t2h1u8 && t2w1r3 < t2h1d8 && t2w1r3 < t2w1rwt8 && t2w1r3 < t2w1lwt8 && t2w1r3 < t2h1uwt8 && t2w1r3 < t2h1dwt8
     && t2w1r3 < t2w1r9 && t2w1r3 < t2w1l9 && t2w1r3 < t2h1u9 && t2w1r3 < t2h1d9 && t2w1r3 < t2w1rwt9 && t2w1r3 < t2w1lwt9 && t2w1r3 < t2h1uwt9 && t2w1r3 < t2h1dwt9
     && t2w1r3 < t2w1r10 && t2w1r3 < t2w1l10 && t2w1r3 < t2h1u10 && t2w1r3 < t2h1d10 && t2w1r3 < t2w1rwt10 && t2w1r3 < t2w1lwt10 && t2w1r3 < t2h1uwt10 && t2w1r3 < t2h1dwt10
     && ((loutwr3!=0 && linwr3==0) || (loutwr3==0 && linwr3!=0))){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1r3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1r3+z))*(z0hd3+(vz*t2w1r3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1r3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1r3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1r3+z))*(z0hu3+(vz*t2w1r3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1r3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1r3+y;
  xtest=vx*t2w1r3+x;
  xlimitr=-sqrt(pbwr3-(vz*t2w1r3+z)/pawr3);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr3 > 0){
  i=123;
  }else{
  i=138;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr3!=-1 && t2w1r3 > 0 && t2w1r3 < t1 
     && t2w1r3 < t2w1r && t2w1r3 < t2w1l && t2w1r3 < t2h1u && t2w1r3 < t2h1d && t2w1r3 < t2w1rwt && t2w1r3 < t2w1lwt && t2w1r3 < t2h1uwt && t2w1r3 < t2h1dwt
     && t2w1r3 < t2w1r1 && t2w1r3 < t2w1l1 && t2w1r3 < t2h1u1 && t2w1r3 < t2h1d1 && t2w1r3 < t2w1rwt1 && t2w1r3 < t2w1lwt1 && t2w1r3 < t2h1uwt1 && t2w1r3 < t2h1dwt1
     && t2w1r3 < t2w1r2 && t2w1r3 < t2w1l2 && t2w1r3 < t2h1u2 && t2w1r3 < t2h1d2 && t2w1r3 < t2w1rwt2 && t2w1r3 < t2w1lwt2 && t2w1r3 < t2h1uwt2 && t2w1r3 < t2h1dwt2 
     && t2w1r3 < t2w1l3 && t2w1r3 < t2h1u3 && t2w1r3 < t2h1d3 && t2w1r3 < t2w1rwt3 && t2w1r3 < t2w1lwt3 && t2w1r3 < t2h1uwt3 && t2w1r3 < t2h1dwt3
     && t2w1r3 < t2w1r4 && t2w1r3 < t2w1l4 && t2w1r3 < t2h1u4 && t2w1r3 < t2h1d4 && t2w1r3 < t2w1rwt4 && t2w1r3 < t2w1lwt4 && t2w1r3 < t2h1uwt4 && t2w1r3 < t2h1dwt4
     && t2w1r3 < t2w1r5 && t2w1r3 < t2w1l5 && t2w1r3 < t2h1u5 && t2w1r3 < t2h1d5 && t2w1r3 < t2w1rwt5 && t2w1r3 < t2w1lwt5 && t2w1r3 < t2h1uwt5 && t2w1r3 < t2h1dwt5
     && t2w1r3 < t2w1r6 && t2w1r3 < t2w1l6 && t2w1r3 < t2h1u6 && t2w1r3 < t2h1d6 && t2w1r3 < t2w1rwt6 && t2w1r3 < t2w1lwt6 && t2w1r3 < t2h1uwt6 && t2w1r3 < t2h1dwt6
     && t2w1r3 < t2w1r7 && t2w1r3 < t2w1l7 && t2w1r3 < t2h1u7 && t2w1r3 < t2h1d7 && t2w1r3 < t2w1rwt7 && t2w1r3 < t2w1lwt7 && t2w1r3 < t2h1uwt7 && t2w1r3 < t2h1dwt7
     && t2w1r3 < t2w1r8 && t2w1r3 < t2w1l8 && t2w1r3 < t2h1u8 && t2w1r3 < t2h1d8 && t2w1r3 < t2w1rwt8 && t2w1r3 < t2w1lwt8 && t2w1r3 < t2h1uwt8 && t2w1r3 < t2h1dwt8
     && t2w1r3 < t2w1r9 && t2w1r3 < t2w1l9 && t2w1r3 < t2h1u9 && t2w1r3 < t2h1d9 && t2w1r3 < t2w1rwt9 && t2w1r3 < t2w1lwt9 && t2w1r3 < t2h1uwt9 && t2w1r3 < t2h1dwt9
     && t2w1r3 < t2w1r10 && t2w1r3 < t2w1l10 && t2w1r3 < t2h1u10 && t2w1r3 < t2h1d10 && t2w1r3 < t2w1rwt10 && t2w1r3 < t2w1lwt10 && t2w1r3 < t2h1uwt10 && t2w1r3 < t2h1dwt10
     && (loutwr3==0 && linwr3==0)){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1r3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1r3+z))*(z0hd3+(vz*t2w1r3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1r3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1r3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1r3+z))*(z0hu3+(vz*t2w1r3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1r3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1r3+y;
  xtest=vx*t2w1r3+x;
  xlimitr=-(w2r3+w1r3)*(vz*t2w1r3+z)/l-w1r3;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr3>0){
  i=124;
  }else{
  i=138;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl3!=-1 && t2w1l3 > 0 && t2w1l3 < t1 
      && t2w1l3 < t2w1r && t2w1l3 < t2w1l && t2w1l3 < t2h1u && t2w1l3 < t2h1d && t2w1l3 < t2w1rwt && t2w1l3 < t2w1lwt && t2w1l3 < t2h1uwt && t2w1l3 < t2h1dwt
      && t2w1l3 < t2w1r1 && t2w1l3 < t2w1l1 && t2w1l3 < t2h1u1 && t2w1l3 < t2h1d1 && t2w1l3 < t2w1rwt1 && t2w1l3 < t2w1lwt1 && t2w1l3 < t2h1uwt1 && t2w1l3 < t2h1dwt1
      && t2w1l3 < t2w1r2 && t2w1l3 < t2w1l2 && t2w1l3 < t2h1u2 && t2w1l3 < t2h1d2 && t2w1l3 < t2w1rwt2 && t2w1l3 < t2w1lwt2 && t2w1l3 < t2h1uwt2 && t2w1l3 < t2h1dwt2
      && t2w1l3 < t2w1r3 && t2w1l3 < t2h1u3 && t2w1l3 < t2h1d3 && t2w1l3 < t2w1rwt3 && t2w1l3 < t2w1lwt3 && t2w1l3 < t2h1uwt3 && t2w1l3 < t2h1dwt3
      && t2w1l3 < t2w1r4 && t2w1l3 < t2w1l4 && t2w1l3 < t2h1u4 && t2w1l3 < t2h1d4 && t2w1l3 < t2w1rwt4 && t2w1l3 < t2w1lwt4 && t2w1l3 < t2h1uwt4 && t2w1l3 < t2h1dwt4
      && t2w1l3 < t2w1r5 && t2w1l3 < t2w1l5 && t2w1l3 < t2h1u5 && t2w1l3 < t2h1d5 && t2w1l3 < t2w1rwt5 && t2w1l3 < t2w1lwt5 && t2w1l3 < t2h1uwt5 && t2w1l3 < t2h1dwt5
      && t2w1l3 < t2w1r6 && t2w1l3 < t2w1l6 && t2w1l3 < t2h1u6 && t2w1l3 < t2h1d6 && t2w1l3 < t2w1rwt6 && t2w1l3 < t2w1lwt6 && t2w1l3 < t2h1uwt6 && t2w1l3 < t2h1dwt6
      && t2w1l3 < t2w1r7 && t2w1l3 < t2w1l7 && t2w1l3 < t2h1u7 && t2w1l3 < t2h1d7 && t2w1l3 < t2w1rwt7 && t2w1l3 < t2w1lwt7 && t2w1l3 < t2h1uwt7 && t2w1l3 < t2h1dwt7
      && t2w1l3 < t2w1r8 && t2w1l3 < t2w1l8 && t2w1l3 < t2h1u8 && t2w1l3 < t2h1d8 && t2w1l3 < t2w1rwt8 && t2w1l3 < t2w1lwt8 && t2w1l3 < t2h1uwt8 && t2w1l3 < t2h1dwt8
      && t2w1l3 < t2w1r9 && t2w1l3 < t2w1l9 && t2w1l3 < t2h1u9 && t2w1l3 < t2h1d9 && t2w1l3 < t2w1rwt9 && t2w1l3 < t2w1lwt9 && t2w1l3 < t2h1uwt9 && t2w1l3 < t2h1dwt9
      && t2w1l3 < t2w1r10 && t2w1l3 < t2w1l10 && t2w1l3 < t2h1u10 && t2w1l3 < t2h1d10 && t2w1l3 < t2w1rwt10 && t2w1l3 < t2w1lwt10 && t2w1l3 < t2h1uwt10 && t2w1l3 < t2h1dwt10
      && ((linwl3!=0) && (loutwl3!=0) )){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1l3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1l3+z))*(z0hd3+(vz*t2w1l3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1l3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1l3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1l3+z))*(z0hu3+(vz*t2w1l3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1l3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1l3+y;
  xlimitl=bwl3*sqrt(1-((vz*t2w1l3+z)+z0wl3)*((vz*t2w1l3+z)+z0wl3)/a2wl3);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl3>0){
  i=125;
  }else{
  i=139;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl3!=-1 && t2w1l3 > 0 && t2w1l3 < t1 
      && t2w1l3 < t2w1r && t2w1l3 < t2w1l && t2w1l3 < t2h1u && t2w1l3 < t2h1d && t2w1l3 < t2w1rwt && t2w1l3 < t2w1lwt && t2w1l3 < t2h1uwt && t2w1l3 < t2h1dwt
      && t2w1l3 < t2w1r1 && t2w1l3 < t2w1l1 && t2w1l3 < t2h1u1 && t2w1l3 < t2h1d1 && t2w1l3 < t2w1rwt1 && t2w1l3 < t2w1lwt1 && t2w1l3 < t2h1uwt1 && t2w1l3 < t2h1dwt1
      && t2w1l3 < t2w1r2 && t2w1l3 < t2w1l2 && t2w1l3 < t2h1u2 && t2w1l3 < t2h1d2 && t2w1l3 < t2w1rwt2 && t2w1l3 < t2w1lwt2 && t2w1l3 < t2h1uwt2 && t2w1l3 < t2h1dwt2
      && t2w1l3 < t2w1r3 && t2w1l3 < t2h1u3 && t2w1l3 < t2h1d3 && t2w1l3 < t2w1rwt3 && t2w1l3 < t2w1lwt3 && t2w1l3 < t2h1uwt3 && t2w1l3 < t2h1dwt3
      && t2w1l3 < t2w1r4 && t2w1l3 < t2w1l4 && t2w1l3 < t2h1u4 && t2w1l3 < t2h1d4 && t2w1l3 < t2w1rwt4 && t2w1l3 < t2w1lwt4 && t2w1l3 < t2h1uwt4 && t2w1l3 < t2h1dwt4
      && t2w1l3 < t2w1r5 && t2w1l3 < t2w1l5 && t2w1l3 < t2h1u5 && t2w1l3 < t2h1d5 && t2w1l3 < t2w1rwt5 && t2w1l3 < t2w1lwt5 && t2w1l3 < t2h1uwt5 && t2w1l3 < t2h1dwt5
      && t2w1l3 < t2w1r6 && t2w1l3 < t2w1l6 && t2w1l3 < t2h1u6 && t2w1l3 < t2h1d6 && t2w1l3 < t2w1rwt6 && t2w1l3 < t2w1lwt6 && t2w1l3 < t2h1uwt6 && t2w1l3 < t2h1dwt6
      && t2w1l3 < t2w1r7 && t2w1l3 < t2w1l7 && t2w1l3 < t2h1u7 && t2w1l3 < t2h1d7 && t2w1l3 < t2w1rwt7 && t2w1l3 < t2w1lwt7 && t2w1l3 < t2h1uwt7 && t2w1l3 < t2h1dwt7
      && t2w1l3 < t2w1r8 && t2w1l3 < t2w1l8 && t2w1l3 < t2h1u8 && t2w1l3 < t2h1d8 && t2w1l3 < t2w1rwt8 && t2w1l3 < t2w1lwt8 && t2w1l3 < t2h1uwt8 && t2w1l3 < t2h1dwt8
      && t2w1l3 < t2w1r9 && t2w1l3 < t2w1l9 && t2w1l3 < t2h1u9 && t2w1l3 < t2h1d9 && t2w1l3 < t2w1rwt9 && t2w1l3 < t2w1lwt9 && t2w1l3 < t2h1uwt9 && t2w1l3 < t2h1dwt9
      && t2w1l3 < t2w1r10 && t2w1l3 < t2w1l10 && t2w1l3 < t2h1u10 && t2w1l3 < t2h1d10 && t2w1l3 < t2w1rwt10 && t2w1l3 < t2w1lwt10 && t2w1l3 < t2h1uwt10 && t2w1l3 < t2h1dwt10
      && ((loutwl3!=0 && linwl3==0) || (loutwl3==0 && linwl3!=0))){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1l3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1l3+z))*(z0hd3+(vz*t2w1l3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1l3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1l3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1l3+z))*(z0hu3+(vz*t2w1l3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1l3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1l3+y;
  xlimitl=sqrt(pbwl3-(vz*t2w1l3+z)/pawl3);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl3>0){
  i=126;
  }else{
  i=139;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl3!=-1 && t2w1l3 > 0 && t2w1l3 < t1 
      && t2w1l3 < t2w1r && t2w1l3 < t2w1l && t2w1l3 < t2h1u && t2w1l3 < t2h1d && t2w1l3 < t2w1rwt && t2w1l3 < t2w1lwt && t2w1l3 < t2h1uwt && t2w1l3 < t2h1dwt
      && t2w1l3 < t2w1r1 && t2w1l3 < t2w1l1 && t2w1l3 < t2h1u1 && t2w1l3 < t2h1d1 && t2w1l3 < t2w1rwt1 && t2w1l3 < t2w1lwt1 && t2w1l3 < t2h1uwt1 && t2w1l3 < t2h1dwt1
      && t2w1l3 < t2w1r2 && t2w1l3 < t2w1l2 && t2w1l3 < t2h1u2 && t2w1l3 < t2h1d2 && t2w1l3 < t2w1rwt2 && t2w1l3 < t2w1lwt2 && t2w1l3 < t2h1uwt2 && t2w1l3 < t2h1dwt2
      && t2w1l3 < t2w1r3 && t2w1l3 < t2h1u3 && t2w1l3 < t2h1d3 && t2w1l3 < t2w1rwt3 && t2w1l3 < t2w1lwt3 && t2w1l3 < t2h1uwt3 && t2w1l3 < t2h1dwt3
      && t2w1l3 < t2w1r4 && t2w1l3 < t2w1l4 && t2w1l3 < t2h1u4 && t2w1l3 < t2h1d4 && t2w1l3 < t2w1rwt4 && t2w1l3 < t2w1lwt4 && t2w1l3 < t2h1uwt4 && t2w1l3 < t2h1dwt4
      && t2w1l3 < t2w1r5 && t2w1l3 < t2w1l5 && t2w1l3 < t2h1u5 && t2w1l3 < t2h1d5 && t2w1l3 < t2w1rwt5 && t2w1l3 < t2w1lwt5 && t2w1l3 < t2h1uwt5 && t2w1l3 < t2h1dwt5
      && t2w1l3 < t2w1r6 && t2w1l3 < t2w1l6 && t2w1l3 < t2h1u6 && t2w1l3 < t2h1d6 && t2w1l3 < t2w1rwt6 && t2w1l3 < t2w1lwt6 && t2w1l3 < t2h1uwt6 && t2w1l3 < t2h1dwt6
      && t2w1l3 < t2w1r7 && t2w1l3 < t2w1l7 && t2w1l3 < t2h1u7 && t2w1l3 < t2h1d7 && t2w1l3 < t2w1rwt7 && t2w1l3 < t2w1lwt7 && t2w1l3 < t2h1uwt7 && t2w1l3 < t2h1dwt7
      && t2w1l3 < t2w1r8 && t2w1l3 < t2w1l8 && t2w1l3 < t2h1u8 && t2w1l3 < t2h1d8 && t2w1l3 < t2w1rwt8 && t2w1l3 < t2w1lwt8 && t2w1l3 < t2h1uwt8 && t2w1l3 < t2h1dwt8
      && t2w1l3 < t2w1r9 && t2w1l3 < t2w1l9 && t2w1l3 < t2h1u9 && t2w1l3 < t2h1d9 && t2w1l3 < t2w1rwt9 && t2w1l3 < t2w1lwt9 && t2w1l3 < t2h1uwt9 && t2w1l3 < t2h1dwt9
      && t2w1l3 < t2w1r10 && t2w1l3 < t2w1l10 && t2w1l3 < t2h1u10 && t2w1l3 < t2h1d10 && t2w1l3 < t2w1rwt10 && t2w1l3 < t2w1lwt10 && t2w1l3 < t2h1uwt10 && t2w1l3 < t2h1dwt10
      && (loutwl3==0 && linwl3==0)){
 if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1l3+z)-h1d3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhd3*sqrt(1-((z0hd3+(vz*t2w1l3+z))*(z0hd3+(vz*t2w1l3+z)))/a2hd3);
      }else{
      ylimitd=-sqrt(((vz*t2w1l3+z)-pbhd3)/-pahd3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1l3+z)+h1u3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhu3*sqrt(1-((z0hu3+(vz*t2w1l3+z))*(z0hu3+(vz*t2w1l3+z)))/a2hu3);
     }else{
     ylimitu=sqrt(((vz*t2w1l3+z)-pbhu3)/-pahu3);
    }
    }
  ytest=vy*t2w1l3+y;
  xlimitl=(w2l3-w1l3)*(vz*t2w1l3+z)/l+w1l3;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl3>0){
  i=127;
  }else{
  i=139;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu3!=-1 && t2h1u3 > 0 && t2h1u3 < t1 
  && t2h1u3 < t2w1r && t2h1u3 < t2w1l && t2h1u3 < t2h1u && t2h1u3 < t2h1d && t2h1u3 < t2w1rwt && t2h1u3 < t2w1lwt && t2h1u3 < t2h1uwt && t2h1u3 < t2h1dwt
  && t2h1u3 < t2w1r1 && t2h1u3 < t2w1l1 && t2h1u3 < t2h1u1 && t2h1u3 < t2h1d1 && t2h1u3 < t2w1rwt1 && t2h1u3 < t2w1lwt1 && t2h1u3 < t2h1uwt1 && t2h1u3 < t2h1dwt1
  && t2h1u3 < t2w1r2 && t2h1u3 < t2w1l2 && t2h1u3 < t2h1u2 && t2h1u3 < t2h1d2 && t2h1u3 < t2w1rwt2 && t2h1u3 < t2w1lwt2 && t2h1u3 < t2h1uwt2 && t2h1u3 < t2h1dwt2
  && t2h1u3 < t2w1r3 && t2h1u3 < t2w1l3 && t2h1u3 < t2h1d3 && t2h1u3 < t2w1rwt3 && t2h1u3 < t2w1lwt3 && t2h1u3 < t2h1uwt3 && t2h1u3 < t2h1dwt3
  && t2h1u3 < t2w1r4 && t2h1u3 < t2w1l4 && t2h1u3 < t2h1u4 && t2h1u3 < t2h1d4 && t2h1u3 < t2w1rwt4 && t2h1u3 < t2w1lwt4 && t2h1u3 < t2h1uwt4 && t2h1u3 < t2h1dwt4
  && t2h1u3 < t2w1r5 && t2h1u3 < t2w1l5 && t2h1u3 < t2h1u5 && t2h1u3 < t2h1d5 && t2h1u3 < t2w1rwt5 && t2h1u3 < t2w1lwt5 && t2h1u3 < t2h1uwt5 && t2h1u3 < t2h1dwt5
  && t2h1u3 < t2w1r6 && t2h1u3 < t2w1l6 && t2h1u3 < t2h1u6 && t2h1u3 < t2h1d6 && t2h1u3 < t2w1rwt6 && t2h1u3 < t2w1lwt6 && t2h1u3 < t2h1uwt6 && t2h1u3 < t2h1dwt6
  && t2h1u3 < t2w1r7 && t2h1u3 < t2w1l7 && t2h1u3 < t2h1u7 && t2h1u3 < t2h1d7 && t2h1u3 < t2w1rwt7 && t2h1u3 < t2w1lwt7 && t2h1u3 < t2h1uwt7 && t2h1u3 < t2h1dwt7
  && t2h1u3 < t2w1r8 && t2h1u3 < t2w1l8 && t2h1u3 < t2h1u8 && t2h1u3 < t2h1d8 && t2h1u3 < t2w1rwt8 && t2h1u3 < t2w1lwt8 && t2h1u3 < t2h1uwt8 && t2h1u3 < t2h1dwt8
  && t2h1u3 < t2w1r9 && t2h1u3 < t2w1l9 && t2h1u3 < t2h1u9 && t2h1u3 < t2h1d9 && t2h1u3 < t2w1rwt9 && t2h1u3 < t2w1lwt9 && t2h1u3 < t2h1uwt9 && t2h1u3 < t2h1dwt9
  && t2h1u3 < t2w1r10 && t2h1u3 < t2w1l10 && t2h1u3 < t2h1u10 && t2h1u3 < t2h1d10 && t2h1u3 < t2w1rwt10 && t2h1u3 < t2w1lwt10 && t2h1u3 < t2h1uwt10 && t2h1u3 < t2h1dwt10
  && (louthu3 !=0 && linhu3!=0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1u3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1u3+z))*(z0wr3+(vz*t2h1u3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1u3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1u3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1u3+z))*(z0wl3+(vz*t2h1u3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1u3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1u3+x;
  ylimitu=bhu3*sqrt(1-((vz*t2h1u3+z)+z0hu3)*((vz*t2h1u3+z)+z0hu3)/a2hu3);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu3>0 ){
  i=128;
  }else{
  i=140;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu3!=-1 && t2h1u3 > 0 && t2h1u3 < t1
  && t2h1u3 < t2w1r && t2h1u3 < t2w1l && t2h1u3 < t2h1u && t2h1u3 < t2h1d && t2h1u3 < t2w1rwt && t2h1u3 < t2w1lwt && t2h1u3 < t2h1uwt && t2h1u3 < t2h1dwt
  && t2h1u3 < t2w1r1 && t2h1u3 < t2w1l1 && t2h1u3 < t2h1u1 && t2h1u3 < t2h1d1 && t2h1u3 < t2w1rwt1 && t2h1u3 < t2w1lwt1 && t2h1u3 < t2h1uwt1 && t2h1u3 < t2h1dwt1
  && t2h1u3 < t2w1r2 && t2h1u3 < t2w1l2 && t2h1u3 < t2h1u2 && t2h1u3 < t2h1d2 && t2h1u3 < t2w1rwt2 && t2h1u3 < t2w1lwt2 && t2h1u3 < t2h1uwt2 && t2h1u3 < t2h1dwt2
  && t2h1u3 < t2w1r3 && t2h1u3 < t2w1l3 && t2h1u3 < t2h1d3 && t2h1u3 < t2w1rwt3 && t2h1u3 < t2w1lwt3 && t2h1u3 < t2h1uwt3 && t2h1u3 < t2h1dwt3
  && t2h1u3 < t2w1r4 && t2h1u3 < t2w1l4 && t2h1u3 < t2h1u4 && t2h1u3 < t2h1d4 && t2h1u3 < t2w1rwt4 && t2h1u3 < t2w1lwt4 && t2h1u3 < t2h1uwt4 && t2h1u3 < t2h1dwt4
  && t2h1u3 < t2w1r5 && t2h1u3 < t2w1l5 && t2h1u3 < t2h1u5 && t2h1u3 < t2h1d5 && t2h1u3 < t2w1rwt5 && t2h1u3 < t2w1lwt5 && t2h1u3 < t2h1uwt5 && t2h1u3 < t2h1dwt5
  && t2h1u3 < t2w1r6 && t2h1u3 < t2w1l6 && t2h1u3 < t2h1u6 && t2h1u3 < t2h1d6 && t2h1u3 < t2w1rwt6 && t2h1u3 < t2w1lwt6 && t2h1u3 < t2h1uwt6 && t2h1u3 < t2h1dwt6
  && t2h1u3 < t2w1r7 && t2h1u3 < t2w1l7 && t2h1u3 < t2h1u7 && t2h1u3 < t2h1d7 && t2h1u3 < t2w1rwt7 && t2h1u3 < t2w1lwt7 && t2h1u3 < t2h1uwt7 && t2h1u3 < t2h1dwt7
  && t2h1u3 < t2w1r8 && t2h1u3 < t2w1l8 && t2h1u3 < t2h1u8 && t2h1u3 < t2h1d8 && t2h1u3 < t2w1rwt8 && t2h1u3 < t2w1lwt8 && t2h1u3 < t2h1uwt8 && t2h1u3 < t2h1dwt8
  && t2h1u3 < t2w1r9 && t2h1u3 < t2w1l9 && t2h1u3 < t2h1u9 && t2h1u3 < t2h1d9 && t2h1u3 < t2w1rwt9 && t2h1u3 < t2w1lwt9 && t2h1u3 < t2h1uwt9 && t2h1u3 < t2h1dwt9
  && t2h1u3 < t2w1r10 && t2h1u3 < t2w1l10 && t2h1u3 < t2h1u10 && t2h1u3 < t2h1d10 && t2h1u3 < t2w1rwt10 && t2h1u3 < t2w1lwt10 && t2h1u3 < t2h1uwt10 && t2h1u3 < t2h1dwt10 
  && ((louthu3!=0 && linhu3==0) || (louthu3==0 && linhu3!=0))){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1u3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1u3+z))*(z0wr3+(vz*t2h1u3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1u3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1u3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1u3+z))*(z0wl3+(vz*t2h1u3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1u3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1u3+x;
  ylimitu=sqrt(pbhu3-(vz*t2h1u3+z)/pahu3);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu3>0){
  i=129;
  }else{
  i=140;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu3!=-1 && t2h1u3 > 0 && t2h1u3 < t1
  && t2h1u3 < t2w1r && t2h1u3 < t2w1l && t2h1u3 < t2h1u && t2h1u3 < t2h1d && t2h1u3 < t2w1rwt && t2h1u3 < t2w1lwt && t2h1u3 < t2h1uwt && t2h1u3 < t2h1dwt
  && t2h1u3 < t2w1r1 && t2h1u3 < t2w1l1 && t2h1u3 < t2h1u1 && t2h1u3 < t2h1d1 && t2h1u3 < t2w1rwt1 && t2h1u3 < t2w1lwt1 && t2h1u3 < t2h1uwt1 && t2h1u3 < t2h1dwt1
  && t2h1u3 < t2w1r2 && t2h1u3 < t2w1l2 && t2h1u3 < t2h1u2 && t2h1u3 < t2h1d2 && t2h1u3 < t2w1rwt2 && t2h1u3 < t2w1lwt2 && t2h1u3 < t2h1uwt2 && t2h1u3 < t2h1dwt2
  && t2h1u3 < t2w1r3 && t2h1u3 < t2w1l3 && t2h1u3 < t2h1d3 && t2h1u3 < t2w1rwt3 && t2h1u3 < t2w1lwt3 && t2h1u3 < t2h1uwt3 && t2h1u3 < t2h1dwt3
  && t2h1u3 < t2w1r4 && t2h1u3 < t2w1l4 && t2h1u3 < t2h1u4 && t2h1u3 < t2h1d4 && t2h1u3 < t2w1rwt4 && t2h1u3 < t2w1lwt4 && t2h1u3 < t2h1uwt4 && t2h1u3 < t2h1dwt4
  && t2h1u3 < t2w1r5 && t2h1u3 < t2w1l5 && t2h1u3 < t2h1u5 && t2h1u3 < t2h1d5 && t2h1u3 < t2w1rwt5 && t2h1u3 < t2w1lwt5 && t2h1u3 < t2h1uwt5 && t2h1u3 < t2h1dwt5
  && t2h1u3 < t2w1r6 && t2h1u3 < t2w1l6 && t2h1u3 < t2h1u6 && t2h1u3 < t2h1d6 && t2h1u3 < t2w1rwt6 && t2h1u3 < t2w1lwt6 && t2h1u3 < t2h1uwt6 && t2h1u3 < t2h1dwt6
  && t2h1u3 < t2w1r7 && t2h1u3 < t2w1l7 && t2h1u3 < t2h1u7 && t2h1u3 < t2h1d7 && t2h1u3 < t2w1rwt7 && t2h1u3 < t2w1lwt7 && t2h1u3 < t2h1uwt7 && t2h1u3 < t2h1dwt7
  && t2h1u3 < t2w1r8 && t2h1u3 < t2w1l8 && t2h1u3 < t2h1u8 && t2h1u3 < t2h1d8 && t2h1u3 < t2w1rwt8 && t2h1u3 < t2w1lwt8 && t2h1u3 < t2h1uwt8 && t2h1u3 < t2h1dwt8
  && t2h1u3 < t2w1r9 && t2h1u3 < t2w1l9 && t2h1u3 < t2h1u9 && t2h1u3 < t2h1d9 && t2h1u3 < t2w1rwt9 && t2h1u3 < t2w1lwt9 && t2h1u3 < t2h1uwt9 && t2h1u3 < t2h1dwt9
  && t2h1u3 < t2w1r10 && t2h1u3 < t2w1l10 && t2h1u3 < t2h1u10 && t2h1u3 < t2h1d10 && t2h1u3 < t2w1rwt10 && t2h1u3 < t2w1lwt10 && t2h1u3 < t2h1uwt10 && t2h1u3 < t2h1dwt10
  && (louthu3 == 0 && linhu3 == 0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1u3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1u3+z))*(z0wr3+(vz*t2h1u3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1u3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1u3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1u3+z))*(z0wl3+(vz*t2h1u3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1u3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1u3+x;
  ylimitu=(h2u3-h1u3)*(vz*t2h1u3+z)/l+h1u3;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu3>0 ){
  i=130;
  }else{
  i=140;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd3!=-1 && t2h1d3 > 0 && t2h1d3 < t1 
  && t2h1d3 < t2w1r && t2h1d3 < t2w1l && t2h1d3 < t2h1u && t2h1d3 < t2h1d && t2h1d3 < t2w1rwt && t2h1d3 < t2w1lwt && t2h1d3 < t2h1uwt && t2h1d3 < t2h1dwt
  && t2h1d3 < t2w1r1 && t2h1d3 < t2w1l1 && t2h1d3 < t2h1u1 && t2h1d3 < t2h1d1 && t2h1d3 < t2w1rwt1 && t2h1d3 < t2w1lwt1 && t2h1d3 < t2h1uwt1 && t2h1d3 < t2h1dwt1
  && t2h1d3 < t2w1r2 && t2h1d3 < t2w1l2 && t2h1d3 < t2h1u2 && t2h1d3 < t2h1d2 && t2h1d3 < t2w1rwt2 && t2h1d3 < t2w1lwt2 && t2h1d3 < t2h1uwt2 && t2h1d3 < t2h1dwt2
  && t2h1d3 < t2w1r3 && t2h1d3 < t2w1l3 && t2h1d3 < t2h1u3 && t2h1d3 < t2w1rwt3 && t2h1d3 < t2w1lwt3 && t2h1d3 < t2h1uwt3 && t2h1d3 < t2h1dwt3
  && t2h1d3 < t2w1r4 && t2h1d3 < t2w1l4 && t2h1d3 < t2h1u4 && t2h1d3 < t2h1d4 && t2h1d3 < t2w1rwt4 && t2h1d3 < t2w1lwt4 && t2h1d3 < t2h1uwt4 && t2h1d3 < t2h1dwt4
  && t2h1d3 < t2w1r5 && t2h1d3 < t2w1l5 && t2h1d3 < t2h1u5 && t2h1d3 < t2h1d5 && t2h1d3 < t2w1rwt5 && t2h1d3 < t2w1lwt5 && t2h1d3 < t2h1uwt5 && t2h1d3 < t2h1dwt5
  && t2h1d3 < t2w1r6 && t2h1d3 < t2w1l6 && t2h1d3 < t2h1u6 && t2h1d3 < t2h1d6 && t2h1d3 < t2w1rwt6 && t2h1d3 < t2w1lwt6 && t2h1d3 < t2h1uwt6 && t2h1d3 < t2h1dwt6
  && t2h1d3 < t2w1r7 && t2h1d3 < t2w1l7 && t2h1d3 < t2h1u7 && t2h1d3 < t2h1d7 && t2h1d3 < t2w1rwt7 && t2h1d3 < t2w1lwt7 && t2h1d3 < t2h1uwt7 && t2h1d3 < t2h1dwt7
  && t2h1d3 < t2w1r8 && t2h1d3 < t2w1l8 && t2h1d3 < t2h1u8 && t2h1d3 < t2h1d8 && t2h1d3 < t2w1rwt8 && t2h1d3 < t2w1lwt8 && t2h1d3 < t2h1uwt8 && t2h1d3 < t2h1dwt8
  && t2h1d3 < t2w1r9 && t2h1d3 < t2w1l9 && t2h1d3 < t2h1u9 && t2h1d3 < t2h1d9 && t2h1d3 < t2w1rwt9 && t2h1d3 < t2w1lwt9 && t2h1d3 < t2h1uwt9 && t2h1d3 < t2h1dwt9
  && t2h1d3 < t2w1r10 && t2h1d3 < t2w1l10 && t2h1d3 < t2h1u10 && t2h1d3 < t2h1d10 && t2h1d3 < t2w1rwt10 && t2h1d3 < t2w1lwt10 && t2h1d3 < t2h1uwt10 && t2h1d3 < t2h1dwt10
  && (louthd3 !=0 && linhd3!=0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1d3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1d3+z))*(z0wr3+(vz*t2h1d3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1d3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1d3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1d3+z))*(z0wl3+(vz*t2h1d3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1d3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1d3+x;
  ylimitd=-bhd3*sqrt(1-((vz*t2h1d3+z)+z0hd3)*((vz*t2h1d3+z)+z0hd3)/a2hd3);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd3>0){
  i=131;
  }else{
  i=141;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd3!=-1 && t2h1d3 > 0 && t2h1d3 < t1 
  && t2h1d3 < t2w1r && t2h1d3 < t2w1l && t2h1d3 < t2h1u && t2h1d3 < t2h1d && t2h1d3 < t2w1rwt && t2h1d3 < t2w1lwt && t2h1d3 < t2h1uwt && t2h1d3 < t2h1dwt
  && t2h1d3 < t2w1r1 && t2h1d3 < t2w1l1 && t2h1d3 < t2h1u1 && t2h1d3 < t2h1d1 && t2h1d3 < t2w1rwt1 && t2h1d3 < t2w1lwt1 && t2h1d3 < t2h1uwt1 && t2h1d3 < t2h1dwt1
  && t2h1d3 < t2w1r2 && t2h1d3 < t2w1l2 && t2h1d3 < t2h1u2 && t2h1d3 < t2h1d2 && t2h1d3 < t2w1rwt2 && t2h1d3 < t2w1lwt2 && t2h1d3 < t2h1uwt2 && t2h1d3 < t2h1dwt2
  && t2h1d3 < t2w1r3 && t2h1d3 < t2w1l3 && t2h1d3 < t2h1u3 && t2h1d3 < t2w1rwt3 && t2h1d3 < t2w1lwt3 && t2h1d3 < t2h1uwt3 && t2h1d3 < t2h1dwt3
  && t2h1d3 < t2w1r4 && t2h1d3 < t2w1l4 && t2h1d3 < t2h1u4 && t2h1d3 < t2h1d4 && t2h1d3 < t2w1rwt4 && t2h1d3 < t2w1lwt4 && t2h1d3 < t2h1uwt4 && t2h1d3 < t2h1dwt4
  && t2h1d3 < t2w1r5 && t2h1d3 < t2w1l5 && t2h1d3 < t2h1u5 && t2h1d3 < t2h1d5 && t2h1d3 < t2w1rwt5 && t2h1d3 < t2w1lwt5 && t2h1d3 < t2h1uwt5 && t2h1d3 < t2h1dwt5
  && t2h1d3 < t2w1r6 && t2h1d3 < t2w1l6 && t2h1d3 < t2h1u6 && t2h1d3 < t2h1d6 && t2h1d3 < t2w1rwt6 && t2h1d3 < t2w1lwt6 && t2h1d3 < t2h1uwt6 && t2h1d3 < t2h1dwt6
  && t2h1d3 < t2w1r7 && t2h1d3 < t2w1l7 && t2h1d3 < t2h1u7 && t2h1d3 < t2h1d7 && t2h1d3 < t2w1rwt7 && t2h1d3 < t2w1lwt7 && t2h1d3 < t2h1uwt7 && t2h1d3 < t2h1dwt7
  && t2h1d3 < t2w1r8 && t2h1d3 < t2w1l8 && t2h1d3 < t2h1u8 && t2h1d3 < t2h1d8 && t2h1d3 < t2w1rwt8 && t2h1d3 < t2w1lwt8 && t2h1d3 < t2h1uwt8 && t2h1d3 < t2h1dwt8
  && t2h1d3 < t2w1r9 && t2h1d3 < t2w1l9 && t2h1d3 < t2h1u9 && t2h1d3 < t2h1d9 && t2h1d3 < t2w1rwt9 && t2h1d3 < t2w1lwt9 && t2h1d3 < t2h1uwt9 && t2h1d3 < t2h1dwt9
  && t2h1d3 < t2w1r10 && t2h1d3 < t2w1l10 && t2h1d3 < t2h1u10 && t2h1d3 < t2h1d10 && t2h1d3 < t2w1rwt10 && t2h1d3 < t2w1lwt10 && t2h1d3 < t2h1uwt10 && t2h1d3 < t2h1dwt10
  && ((louthd3 !=0 && linhd3==0) || (louthd3 ==0 && linhd3!=0))){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1d3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1d3+z))*(z0wr3+(vz*t2h1d3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1d3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1d3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1d3+z))*(z0wl3+(vz*t2h1d3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1d3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1d3+x;
  ylimitd=-sqrt(pbhd3-(vz*t2h1d3+z)/pahd3);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd3>0 ){
  i=132;
  }else{
  i=141;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd3!=-1 && t2h1d3 > 0 && t2h1d3 < t1 
  && t2h1d3 < t2w1r && t2h1d3 < t2w1l && t2h1d3 < t2h1u && t2h1d3 < t2h1d && t2h1d3 < t2w1rwt && t2h1d3 < t2w1lwt && t2h1d3 < t2h1uwt && t2h1d3 < t2h1dwt
  && t2h1d3 < t2w1r1 && t2h1d3 < t2w1l1 && t2h1d3 < t2h1u1 && t2h1d3 < t2h1d1 && t2h1d3 < t2w1rwt1 && t2h1d3 < t2w1lwt1 && t2h1d3 < t2h1uwt1 && t2h1d3 < t2h1dwt1
  && t2h1d3 < t2w1r2 && t2h1d3 < t2w1l2 && t2h1d3 < t2h1u2 && t2h1d3 < t2h1d2 && t2h1d3 < t2w1rwt2 && t2h1d3 < t2w1lwt2 && t2h1d3 < t2h1uwt2 && t2h1d3 < t2h1dwt2
  && t2h1d3 < t2w1r3 && t2h1d3 < t2w1l3 && t2h1d3 < t2h1u3 && t2h1d3 < t2w1rwt3 && t2h1d3 < t2w1lwt3 && t2h1d3 < t2h1uwt3 && t2h1d3 < t2h1dwt3
  && t2h1d3 < t2w1r4 && t2h1d3 < t2w1l4 && t2h1d3 < t2h1u4 && t2h1d3 < t2h1d4 && t2h1d3 < t2w1rwt4 && t2h1d3 < t2w1lwt4 && t2h1d3 < t2h1uwt4 && t2h1d3 < t2h1dwt4
  && t2h1d3 < t2w1r5 && t2h1d3 < t2w1l5 && t2h1d3 < t2h1u5 && t2h1d3 < t2h1d5 && t2h1d3 < t2w1rwt5 && t2h1d3 < t2w1lwt5 && t2h1d3 < t2h1uwt5 && t2h1d3 < t2h1dwt5
  && t2h1d3 < t2w1r6 && t2h1d3 < t2w1l6 && t2h1d3 < t2h1u6 && t2h1d3 < t2h1d6 && t2h1d3 < t2w1rwt6 && t2h1d3 < t2w1lwt6 && t2h1d3 < t2h1uwt6 && t2h1d3 < t2h1dwt6
  && t2h1d3 < t2w1r7 && t2h1d3 < t2w1l7 && t2h1d3 < t2h1u7 && t2h1d3 < t2h1d7 && t2h1d3 < t2w1rwt7 && t2h1d3 < t2w1lwt7 && t2h1d3 < t2h1uwt7 && t2h1d3 < t2h1dwt7
  && t2h1d3 < t2w1r8 && t2h1d3 < t2w1l8 && t2h1d3 < t2h1u8 && t2h1d3 < t2h1d8 && t2h1d3 < t2w1rwt8 && t2h1d3 < t2w1lwt8 && t2h1d3 < t2h1uwt8 && t2h1d3 < t2h1dwt8
  && t2h1d3 < t2w1r9 && t2h1d3 < t2w1l9 && t2h1d3 < t2h1u9 && t2h1d3 < t2h1d9 && t2h1d3 < t2w1rwt9 && t2h1d3 < t2w1lwt9 && t2h1d3 < t2h1uwt9 && t2h1d3 < t2h1dwt9
  && t2h1d3 < t2w1r10 && t2h1d3 < t2w1l10 && t2h1d3 < t2h1u10 && t2h1d3 < t2h1d10 && t2h1d3 < t2w1rwt10 && t2h1d3 < t2w1lwt10 && t2h1d3 < t2h1uwt10 && t2h1d3 < t2h1dwt10
  && (louthd3 == 0 && linhd3 == 0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1d3+z)-w1r3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwr3*sqrt(1-((z0wr3+(vz*t2h1d3+z))*(z0wr3+(vz*t2h1d3+z)))/a2wr3);
    }else{
    xlimitr=-sqrt(((vz*t2h1d3+z)-pbwr3)/-pawr3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1d3+z)+w1l3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwl3*sqrt(1-((z0wl3+(vz*t2h1d3+z))*(z0wl3+(vz*t2h1d3+z)))/a2wl3);
      }else{
      xlimitl=sqrt(((vz*t2h1d3+z)-pbwl3)/-pawl3);
      }
   }
  xtest=vx*t2h1d3+x;
  ylimitd=(-h2d3+h1d3)*(vz*t2h1d3+z)/l-h1d3;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd3>0 ){
  i=133;
  }else{
  i=141;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr3==-1 && t2w1r3 > 0 && t2w1r3 < t1 
     && t2w1r3 < t2w1r && t2w1r3 < t2w1l && t2w1r3 < t2h1u && t2w1r3 < t2h1d && t2w1r3 < t2w1rwt && t2w1r3 < t2w1lwt && t2w1r3 < t2h1uwt && t2w1r3 < t2h1dwt
     && t2w1r3 < t2w1r1 && t2w1r3 < t2w1l1 && t2w1r3 < t2h1u1 && t2w1r3 < t2h1d1 && t2w1r3 < t2w1rwt1 && t2w1r3 < t2w1lwt1 && t2w1r3 < t2h1uwt1 && t2w1r3 < t2h1dwt1
     && t2w1r3 < t2w1r2 && t2w1r3 < t2w1l2 && t2w1r3 < t2h1u2 && t2w1r3 < t2h1d2 && t2w1r3 < t2w1rwt2 && t2w1r3 < t2w1lwt2 && t2w1r3 < t2h1uwt2 && t2w1r3 < t2h1dwt2 
     && t2w1r3 < t2w1l3 && t2w1r3 < t2h1u3 && t2w1r3 < t2h1d3 && t2w1r3 < t2w1rwt3 && t2w1r3 < t2w1lwt3 && t2w1r3 < t2h1uwt3 && t2w1r3 < t2h1dwt3
     && t2w1r3 < t2w1r4 && t2w1r3 < t2w1l4 && t2w1r3 < t2h1u4 && t2w1r3 < t2h1d4 && t2w1r3 < t2w1rwt4 && t2w1r3 < t2w1lwt4 && t2w1r3 < t2h1uwt4 && t2w1r3 < t2h1dwt4
     && t2w1r3 < t2w1r5 && t2w1r3 < t2w1l5 && t2w1r3 < t2h1u5 && t2w1r3 < t2h1d5 && t2w1r3 < t2w1rwt5 && t2w1r3 < t2w1lwt5 && t2w1r3 < t2h1uwt5 && t2w1r3 < t2h1dwt5
     && t2w1r3 < t2w1r6 && t2w1r3 < t2w1l6 && t2w1r3 < t2h1u6 && t2w1r3 < t2h1d6 && t2w1r3 < t2w1rwt6 && t2w1r3 < t2w1lwt6 && t2w1r3 < t2h1uwt6 && t2w1r3 < t2h1dwt6
     && t2w1r3 < t2w1r7 && t2w1r3 < t2w1l7 && t2w1r3 < t2h1u7 && t2w1r3 < t2h1d7 && t2w1r3 < t2w1rwt7 && t2w1r3 < t2w1lwt7 && t2w1r3 < t2h1uwt7 && t2w1r3 < t2h1dwt7
     && t2w1r3 < t2w1r8 && t2w1r3 < t2w1l8 && t2w1r3 < t2h1u8 && t2w1r3 < t2h1d8 && t2w1r3 < t2w1rwt8 && t2w1r3 < t2w1lwt8 && t2w1r3 < t2h1uwt8 && t2w1r3 < t2h1dwt8
     && t2w1r3 < t2w1r9 && t2w1r3 < t2w1l9 && t2w1r3 < t2h1u9 && t2w1r3 < t2h1d9 && t2w1r3 < t2w1rwt9 && t2w1r3 < t2w1lwt9 && t2w1r3 < t2h1uwt9 && t2w1r3 < t2h1dwt9
     && t2w1r3 < t2w1r10 && t2w1r3 < t2w1l10 && t2w1r3 < t2h1u10 && t2w1r3 < t2h1d10 && t2w1r3 < t2w1rwt10 && t2w1r3 < t2w1lwt10 && t2w1r3 < t2h1uwt10 && t2w1r3 < t2h1dwt10
     && ((linwr3!=0) && (loutwr3!=0) )) {
  i=134;
  }

  if (mxr3==-1 && t2w1r3 > 0 && t2w1r3 < t1 
     && t2w1r3 < t2w1r && t2w1r3 < t2w1l && t2w1r3 < t2h1u && t2w1r3 < t2h1d && t2w1r3 < t2w1rwt && t2w1r3 < t2w1lwt && t2w1r3 < t2h1uwt && t2w1r3 < t2h1dwt
     && t2w1r3 < t2w1r1 && t2w1r3 < t2w1l1 && t2w1r3 < t2h1u1 && t2w1r3 < t2h1d1 && t2w1r3 < t2w1rwt1 && t2w1r3 < t2w1lwt1 && t2w1r3 < t2h1uwt1 && t2w1r3 < t2h1dwt1
     && t2w1r3 < t2w1r2 && t2w1r3 < t2w1l2 && t2w1r3 < t2h1u2 && t2w1r3 < t2h1d2 && t2w1r3 < t2w1rwt2 && t2w1r3 < t2w1lwt2 && t2w1r3 < t2h1uwt2 && t2w1r3 < t2h1dwt2 
     && t2w1r3 < t2w1l3 && t2w1r3 < t2h1u3 && t2w1r3 < t2h1d3 && t2w1r3 < t2w1rwt3 && t2w1r3 < t2w1lwt3 && t2w1r3 < t2h1uwt3 && t2w1r3 < t2h1dwt3
     && t2w1r3 < t2w1r4 && t2w1r3 < t2w1l4 && t2w1r3 < t2h1u4 && t2w1r3 < t2h1d4 && t2w1r3 < t2w1rwt4 && t2w1r3 < t2w1lwt4 && t2w1r3 < t2h1uwt4 && t2w1r3 < t2h1dwt4
     && t2w1r3 < t2w1r5 && t2w1r3 < t2w1l5 && t2w1r3 < t2h1u5 && t2w1r3 < t2h1d5 && t2w1r3 < t2w1rwt5 && t2w1r3 < t2w1lwt5 && t2w1r3 < t2h1uwt5 && t2w1r3 < t2h1dwt5
     && t2w1r3 < t2w1r6 && t2w1r3 < t2w1l6 && t2w1r3 < t2h1u6 && t2w1r3 < t2h1d6 && t2w1r3 < t2w1rwt6 && t2w1r3 < t2w1lwt6 && t2w1r3 < t2h1uwt6 && t2w1r3 < t2h1dwt6
     && t2w1r3 < t2w1r7 && t2w1r3 < t2w1l7 && t2w1r3 < t2h1u7 && t2w1r3 < t2h1d7 && t2w1r3 < t2w1rwt7 && t2w1r3 < t2w1lwt7 && t2w1r3 < t2h1uwt7 && t2w1r3 < t2h1dwt7
     && t2w1r3 < t2w1r8 && t2w1r3 < t2w1l8 && t2w1r3 < t2h1u8 && t2w1r3 < t2h1d8 && t2w1r3 < t2w1rwt8 && t2w1r3 < t2w1lwt8 && t2w1r3 < t2h1uwt8 && t2w1r3 < t2h1dwt8
     && t2w1r3 < t2w1r9 && t2w1r3 < t2w1l9 && t2w1r3 < t2h1u9 && t2w1r3 < t2h1d9 && t2w1r3 < t2w1rwt9 && t2w1r3 < t2w1lwt9 && t2w1r3 < t2h1uwt9 && t2w1r3 < t2h1dwt9
     && t2w1r3 < t2w1r10 && t2w1r3 < t2w1l10 && t2w1r3 < t2h1u10 && t2w1r3 < t2h1d10 && t2w1r3 < t2w1rwt10 && t2w1r3 < t2w1lwt10 && t2w1r3 < t2h1uwt10 && t2w1r3 < t2h1dwt10
     && ((loutwr3!=0 && linwr3==0) || (loutwr3==0 && linwr3!=0))){
  i=134;
  }

  if (mxr3==-1 && t2w1r3 > 0 && t2w1r3 < t1 
     && t2w1r3 < t2w1r && t2w1r3 < t2w1l && t2w1r3 < t2h1u && t2w1r3 < t2h1d && t2w1r3 < t2w1rwt && t2w1r3 < t2w1lwt && t2w1r3 < t2h1uwt && t2w1r3 < t2h1dwt
     && t2w1r3 < t2w1r1 && t2w1r3 < t2w1l1 && t2w1r3 < t2h1u1 && t2w1r3 < t2h1d1 && t2w1r3 < t2w1rwt1 && t2w1r3 < t2w1lwt1 && t2w1r3 < t2h1uwt1 && t2w1r3 < t2h1dwt1
     && t2w1r3 < t2w1r2 && t2w1r3 < t2w1l2 && t2w1r3 < t2h1u2 && t2w1r3 < t2h1d2 && t2w1r3 < t2w1rwt2 && t2w1r3 < t2w1lwt2 && t2w1r3 < t2h1uwt2 && t2w1r3 < t2h1dwt2 
     && t2w1r3 < t2w1l3 && t2w1r3 < t2h1u3 && t2w1r3 < t2h1d3 && t2w1r3 < t2w1rwt3 && t2w1r3 < t2w1lwt3 && t2w1r3 < t2h1uwt3 && t2w1r3 < t2h1dwt3
     && t2w1r3 < t2w1r4 && t2w1r3 < t2w1l4 && t2w1r3 < t2h1u4 && t2w1r3 < t2h1d4 && t2w1r3 < t2w1rwt4 && t2w1r3 < t2w1lwt4 && t2w1r3 < t2h1uwt4 && t2w1r3 < t2h1dwt4
     && t2w1r3 < t2w1r5 && t2w1r3 < t2w1l5 && t2w1r3 < t2h1u5 && t2w1r3 < t2h1d5 && t2w1r3 < t2w1rwt5 && t2w1r3 < t2w1lwt5 && t2w1r3 < t2h1uwt5 && t2w1r3 < t2h1dwt5
     && t2w1r3 < t2w1r6 && t2w1r3 < t2w1l6 && t2w1r3 < t2h1u6 && t2w1r3 < t2h1d6 && t2w1r3 < t2w1rwt6 && t2w1r3 < t2w1lwt6 && t2w1r3 < t2h1uwt6 && t2w1r3 < t2h1dwt6
     && t2w1r3 < t2w1r7 && t2w1r3 < t2w1l7 && t2w1r3 < t2h1u7 && t2w1r3 < t2h1d7 && t2w1r3 < t2w1rwt7 && t2w1r3 < t2w1lwt7 && t2w1r3 < t2h1uwt7 && t2w1r3 < t2h1dwt7
     && t2w1r3 < t2w1r8 && t2w1r3 < t2w1l8 && t2w1r3 < t2h1u8 && t2w1r3 < t2h1d8 && t2w1r3 < t2w1rwt8 && t2w1r3 < t2w1lwt8 && t2w1r3 < t2h1uwt8 && t2w1r3 < t2h1dwt8
     && t2w1r3 < t2w1r9 && t2w1r3 < t2w1l9 && t2w1r3 < t2h1u9 && t2w1r3 < t2h1d9 && t2w1r3 < t2w1rwt9 && t2w1r3 < t2w1lwt9 && t2w1r3 < t2h1uwt9 && t2w1r3 < t2h1dwt9
     && t2w1r3 < t2w1r10 && t2w1r3 < t2w1l10 && t2w1r3 < t2h1u10 && t2w1r3 < t2h1d10 && t2w1r3 < t2w1rwt10 && t2w1r3 < t2w1lwt10 && t2w1r3 < t2h1uwt10 && t2w1r3 < t2h1dwt10
     && (loutwr3==0 && linwr3==0)){
  i=134;
  }

  if (mxl3==-1 && t2w1l3 > 0 && t2w1l3 < t1 
      && t2w1l3 < t2w1r && t2w1l3 < t2w1l && t2w1l3 < t2h1u && t2w1l3 < t2h1d && t2w1l3 < t2w1rwt && t2w1l3 < t2w1lwt && t2w1l3 < t2h1uwt && t2w1l3 < t2h1dwt
      && t2w1l3 < t2w1r1 && t2w1l3 < t2w1l1 && t2w1l3 < t2h1u1 && t2w1l3 < t2h1d1 && t2w1l3 < t2w1rwt1 && t2w1l3 < t2w1lwt1 && t2w1l3 < t2h1uwt1 && t2w1l3 < t2h1dwt1
      && t2w1l3 < t2w1r2 && t2w1l3 < t2w1l2 && t2w1l3 < t2h1u2 && t2w1l3 < t2h1d2 && t2w1l3 < t2w1rwt2 && t2w1l3 < t2w1lwt2 && t2w1l3 < t2h1uwt2 && t2w1l3 < t2h1dwt2
      && t2w1l3 < t2w1r3 && t2w1l3 < t2h1u3 && t2w1l3 < t2h1d3 && t2w1l3 < t2w1rwt3 && t2w1l3 < t2w1lwt3 && t2w1l3 < t2h1uwt3 && t2w1l3 < t2h1dwt3
      && t2w1l3 < t2w1r4 && t2w1l3 < t2w1l4 && t2w1l3 < t2h1u4 && t2w1l3 < t2h1d4 && t2w1l3 < t2w1rwt4 && t2w1l3 < t2w1lwt4 && t2w1l3 < t2h1uwt4 && t2w1l3 < t2h1dwt4
      && t2w1l3 < t2w1r5 && t2w1l3 < t2w1l5 && t2w1l3 < t2h1u5 && t2w1l3 < t2h1d5 && t2w1l3 < t2w1rwt5 && t2w1l3 < t2w1lwt5 && t2w1l3 < t2h1uwt5 && t2w1l3 < t2h1dwt5
      && t2w1l3 < t2w1r6 && t2w1l3 < t2w1l6 && t2w1l3 < t2h1u6 && t2w1l3 < t2h1d6 && t2w1l3 < t2w1rwt6 && t2w1l3 < t2w1lwt6 && t2w1l3 < t2h1uwt6 && t2w1l3 < t2h1dwt6
      && t2w1l3 < t2w1r7 && t2w1l3 < t2w1l7 && t2w1l3 < t2h1u7 && t2w1l3 < t2h1d7 && t2w1l3 < t2w1rwt7 && t2w1l3 < t2w1lwt7 && t2w1l3 < t2h1uwt7 && t2w1l3 < t2h1dwt7
      && t2w1l3 < t2w1r8 && t2w1l3 < t2w1l8 && t2w1l3 < t2h1u8 && t2w1l3 < t2h1d8 && t2w1l3 < t2w1rwt8 && t2w1l3 < t2w1lwt8 && t2w1l3 < t2h1uwt8 && t2w1l3 < t2h1dwt8
      && t2w1l3 < t2w1r9 && t2w1l3 < t2w1l9 && t2w1l3 < t2h1u9 && t2w1l3 < t2h1d9 && t2w1l3 < t2w1rwt9 && t2w1l3 < t2w1lwt9 && t2w1l3 < t2h1uwt9 && t2w1l3 < t2h1dwt9
      && t2w1l3 < t2w1r10 && t2w1l3 < t2w1l10 && t2w1l3 < t2h1u10 && t2w1l3 < t2h1d10 && t2w1l3 < t2w1rwt10 && t2w1l3 < t2w1lwt10 && t2w1l3 < t2h1uwt10 && t2w1l3 < t2h1dwt10
      && ((linwl3!=0) && (loutwl3!=0) )){
  i=135;
  }

  if (mxl3==-1 && t2w1l3 > 0 && t2w1l3 < t1 
      && t2w1l3 < t2w1r && t2w1l3 < t2w1l && t2w1l3 < t2h1u && t2w1l3 < t2h1d && t2w1l3 < t2w1rwt && t2w1l3 < t2w1lwt && t2w1l3 < t2h1uwt && t2w1l3 < t2h1dwt
      && t2w1l3 < t2w1r1 && t2w1l3 < t2w1l1 && t2w1l3 < t2h1u1 && t2w1l3 < t2h1d1 && t2w1l3 < t2w1rwt1 && t2w1l3 < t2w1lwt1 && t2w1l3 < t2h1uwt1 && t2w1l3 < t2h1dwt1
      && t2w1l3 < t2w1r2 && t2w1l3 < t2w1l2 && t2w1l3 < t2h1u2 && t2w1l3 < t2h1d2 && t2w1l3 < t2w1rwt2 && t2w1l3 < t2w1lwt2 && t2w1l3 < t2h1uwt2 && t2w1l3 < t2h1dwt2
      && t2w1l3 < t2w1r3 && t2w1l3 < t2h1u3 && t2w1l3 < t2h1d3 && t2w1l3 < t2w1rwt3 && t2w1l3 < t2w1lwt3 && t2w1l3 < t2h1uwt3 && t2w1l3 < t2h1dwt3
      && t2w1l3 < t2w1r4 && t2w1l3 < t2w1l4 && t2w1l3 < t2h1u4 && t2w1l3 < t2h1d4 && t2w1l3 < t2w1rwt4 && t2w1l3 < t2w1lwt4 && t2w1l3 < t2h1uwt4 && t2w1l3 < t2h1dwt4
      && t2w1l3 < t2w1r5 && t2w1l3 < t2w1l5 && t2w1l3 < t2h1u5 && t2w1l3 < t2h1d5 && t2w1l3 < t2w1rwt5 && t2w1l3 < t2w1lwt5 && t2w1l3 < t2h1uwt5 && t2w1l3 < t2h1dwt5
      && t2w1l3 < t2w1r6 && t2w1l3 < t2w1l6 && t2w1l3 < t2h1u6 && t2w1l3 < t2h1d6 && t2w1l3 < t2w1rwt6 && t2w1l3 < t2w1lwt6 && t2w1l3 < t2h1uwt6 && t2w1l3 < t2h1dwt6
      && t2w1l3 < t2w1r7 && t2w1l3 < t2w1l7 && t2w1l3 < t2h1u7 && t2w1l3 < t2h1d7 && t2w1l3 < t2w1rwt7 && t2w1l3 < t2w1lwt7 && t2w1l3 < t2h1uwt7 && t2w1l3 < t2h1dwt7
      && t2w1l3 < t2w1r8 && t2w1l3 < t2w1l8 && t2w1l3 < t2h1u8 && t2w1l3 < t2h1d8 && t2w1l3 < t2w1rwt8 && t2w1l3 < t2w1lwt8 && t2w1l3 < t2h1uwt8 && t2w1l3 < t2h1dwt8
      && t2w1l3 < t2w1r9 && t2w1l3 < t2w1l9 && t2w1l3 < t2h1u9 && t2w1l3 < t2h1d9 && t2w1l3 < t2w1rwt9 && t2w1l3 < t2w1lwt9 && t2w1l3 < t2h1uwt9 && t2w1l3 < t2h1dwt9
      && t2w1l3 < t2w1r10 && t2w1l3 < t2w1l10 && t2w1l3 < t2h1u10 && t2w1l3 < t2h1d10 && t2w1l3 < t2w1rwt10 && t2w1l3 < t2w1lwt10 && t2w1l3 < t2h1uwt10 && t2w1l3 < t2h1dwt10
      &&  ((loutwl3!=0 && linwl3==0) || (loutwl3==0 && linwl3!=0))){
  i=135;
  }

  if (mxl3==-1 && t2w1l3 > 0 && t2w1l3 < t1 
      && t2w1l3 < t2w1r && t2w1l3 < t2w1l && t2w1l3 < t2h1u && t2w1l3 < t2h1d && t2w1l3 < t2w1rwt && t2w1l3 < t2w1lwt && t2w1l3 < t2h1uwt && t2w1l3 < t2h1dwt
      && t2w1l3 < t2w1r1 && t2w1l3 < t2w1l1 && t2w1l3 < t2h1u1 && t2w1l3 < t2h1d1 && t2w1l3 < t2w1rwt1 && t2w1l3 < t2w1lwt1 && t2w1l3 < t2h1uwt1 && t2w1l3 < t2h1dwt1
      && t2w1l3 < t2w1r2 && t2w1l3 < t2w1l2 && t2w1l3 < t2h1u2 && t2w1l3 < t2h1d2 && t2w1l3 < t2w1rwt2 && t2w1l3 < t2w1lwt2 && t2w1l3 < t2h1uwt2 && t2w1l3 < t2h1dwt2
      && t2w1l3 < t2w1r3 && t2w1l3 < t2h1u3 && t2w1l3 < t2h1d3 && t2w1l3 < t2w1rwt3 && t2w1l3 < t2w1lwt3 && t2w1l3 < t2h1uwt3 && t2w1l3 < t2h1dwt3
      && t2w1l3 < t2w1r4 && t2w1l3 < t2w1l4 && t2w1l3 < t2h1u4 && t2w1l3 < t2h1d4 && t2w1l3 < t2w1rwt4 && t2w1l3 < t2w1lwt4 && t2w1l3 < t2h1uwt4 && t2w1l3 < t2h1dwt4
      && t2w1l3 < t2w1r5 && t2w1l3 < t2w1l5 && t2w1l3 < t2h1u5 && t2w1l3 < t2h1d5 && t2w1l3 < t2w1rwt5 && t2w1l3 < t2w1lwt5 && t2w1l3 < t2h1uwt5 && t2w1l3 < t2h1dwt5
      && t2w1l3 < t2w1r6 && t2w1l3 < t2w1l6 && t2w1l3 < t2h1u6 && t2w1l3 < t2h1d6 && t2w1l3 < t2w1rwt6 && t2w1l3 < t2w1lwt6 && t2w1l3 < t2h1uwt6 && t2w1l3 < t2h1dwt6
      && t2w1l3 < t2w1r7 && t2w1l3 < t2w1l7 && t2w1l3 < t2h1u7 && t2w1l3 < t2h1d7 && t2w1l3 < t2w1rwt7 && t2w1l3 < t2w1lwt7 && t2w1l3 < t2h1uwt7 && t2w1l3 < t2h1dwt7
      && t2w1l3 < t2w1r8 && t2w1l3 < t2w1l8 && t2w1l3 < t2h1u8 && t2w1l3 < t2h1d8 && t2w1l3 < t2w1rwt8 && t2w1l3 < t2w1lwt8 && t2w1l3 < t2h1uwt8 && t2w1l3 < t2h1dwt8
      && t2w1l3 < t2w1r9 && t2w1l3 < t2w1l9 && t2w1l3 < t2h1u9 && t2w1l3 < t2h1d9 && t2w1l3 < t2w1rwt9 && t2w1l3 < t2w1lwt9 && t2w1l3 < t2h1uwt9 && t2w1l3 < t2h1dwt9
      && t2w1l3 < t2w1r10 && t2w1l3 < t2w1l10 && t2w1l3 < t2h1u10 && t2w1l3 < t2h1d10 && t2w1l3 < t2w1rwt10 && t2w1l3 < t2w1lwt10 && t2w1l3 < t2h1uwt10 && t2w1l3 < t2h1dwt10
      && (loutwl3==0 && linwl3==0)){
  i=135;
  }

  if (myu3==-1 && t2h1u3 > 0 && t2h1u3 < t1 
  && t2h1u3 < t2w1r && t2h1u3 < t2w1l && t2h1u3 < t2h1u && t2h1u3 < t2h1d && t2h1u3 < t2w1rwt && t2h1u3 < t2w1lwt && t2h1u3 < t2h1uwt && t2h1u3 < t2h1dwt
  && t2h1u3 < t2w1r1 && t2h1u3 < t2w1l1 && t2h1u3 < t2h1u1 && t2h1u3 < t2h1d1 && t2h1u3 < t2w1rwt1 && t2h1u3 < t2w1lwt1 && t2h1u3 < t2h1uwt1 && t2h1u3 < t2h1dwt1
  && t2h1u3 < t2w1r2 && t2h1u3 < t2w1l2 && t2h1u3 < t2h1u2 && t2h1u3 < t2h1d2 && t2h1u3 < t2w1rwt2 && t2h1u3 < t2w1lwt2 && t2h1u3 < t2h1uwt2 && t2h1u3 < t2h1dwt2
  && t2h1u3 < t2w1r3 && t2h1u3 < t2w1l3 && t2h1u3 < t2h1d3 && t2h1u3 < t2w1rwt3 && t2h1u3 < t2w1lwt3 && t2h1u3 < t2h1uwt3 && t2h1u3 < t2h1dwt3
  && t2h1u3 < t2w1r4 && t2h1u3 < t2w1l4 && t2h1u3 < t2h1u4 && t2h1u3 < t2h1d4 && t2h1u3 < t2w1rwt4 && t2h1u3 < t2w1lwt4 && t2h1u3 < t2h1uwt4 && t2h1u3 < t2h1dwt4
  && t2h1u3 < t2w1r5 && t2h1u3 < t2w1l5 && t2h1u3 < t2h1u5 && t2h1u3 < t2h1d5 && t2h1u3 < t2w1rwt5 && t2h1u3 < t2w1lwt5 && t2h1u3 < t2h1uwt5 && t2h1u3 < t2h1dwt5
  && t2h1u3 < t2w1r6 && t2h1u3 < t2w1l6 && t2h1u3 < t2h1u6 && t2h1u3 < t2h1d6 && t2h1u3 < t2w1rwt6 && t2h1u3 < t2w1lwt6 && t2h1u3 < t2h1uwt6 && t2h1u3 < t2h1dwt6
  && t2h1u3 < t2w1r7 && t2h1u3 < t2w1l7 && t2h1u3 < t2h1u7 && t2h1u3 < t2h1d7 && t2h1u3 < t2w1rwt7 && t2h1u3 < t2w1lwt7 && t2h1u3 < t2h1uwt7 && t2h1u3 < t2h1dwt7
  && t2h1u3 < t2w1r8 && t2h1u3 < t2w1l8 && t2h1u3 < t2h1u8 && t2h1u3 < t2h1d8 && t2h1u3 < t2w1rwt8 && t2h1u3 < t2w1lwt8 && t2h1u3 < t2h1uwt8 && t2h1u3 < t2h1dwt8
  && t2h1u3 < t2w1r9 && t2h1u3 < t2w1l9 && t2h1u3 < t2h1u9 && t2h1u3 < t2h1d9 && t2h1u3 < t2w1rwt9 && t2h1u3 < t2w1lwt9 && t2h1u3 < t2h1uwt9 && t2h1u3 < t2h1dwt9
  && t2h1u3 < t2w1r10 && t2h1u3 < t2w1l10 && t2h1u3 < t2h1u10 && t2h1u3 < t2h1d10 && t2h1u3 < t2w1rwt10 && t2h1u3 < t2w1lwt10 && t2h1u3 < t2h1uwt10 && t2h1u3 < t2h1dwt10
  && (louthu3 !=0 && linhu3!=0)){
  i=136;
  }

  if (myu3==-1 && t2h1u3 > 0 && t2h1u3 < t1 
  && t2h1u3 < t2w1r && t2h1u3 < t2w1l && t2h1u3 < t2h1u && t2h1u3 < t2h1d && t2h1u3 < t2w1rwt && t2h1u3 < t2w1lwt && t2h1u3 < t2h1uwt && t2h1u3 < t2h1dwt
  && t2h1u3 < t2w1r1 && t2h1u3 < t2w1l1 && t2h1u3 < t2h1u1 && t2h1u3 < t2h1d1 && t2h1u3 < t2w1rwt1 && t2h1u3 < t2w1lwt1 && t2h1u3 < t2h1uwt1 && t2h1u3 < t2h1dwt1
  && t2h1u3 < t2w1r2 && t2h1u3 < t2w1l2 && t2h1u3 < t2h1u2 && t2h1u3 < t2h1d2 && t2h1u3 < t2w1rwt2 && t2h1u3 < t2w1lwt2 && t2h1u3 < t2h1uwt2 && t2h1u3 < t2h1dwt2
  && t2h1u3 < t2w1r3 && t2h1u3 < t2w1l3 && t2h1u3 < t2h1d3 && t2h1u3 < t2w1rwt3 && t2h1u3 < t2w1lwt3 && t2h1u3 < t2h1uwt3 && t2h1u3 < t2h1dwt3
  && t2h1u3 < t2w1r4 && t2h1u3 < t2w1l4 && t2h1u3 < t2h1u4 && t2h1u3 < t2h1d4 && t2h1u3 < t2w1rwt4 && t2h1u3 < t2w1lwt4 && t2h1u3 < t2h1uwt4 && t2h1u3 < t2h1dwt4
  && t2h1u3 < t2w1r5 && t2h1u3 < t2w1l5 && t2h1u3 < t2h1u5 && t2h1u3 < t2h1d5 && t2h1u3 < t2w1rwt5 && t2h1u3 < t2w1lwt5 && t2h1u3 < t2h1uwt5 && t2h1u3 < t2h1dwt5
  && t2h1u3 < t2w1r6 && t2h1u3 < t2w1l6 && t2h1u3 < t2h1u6 && t2h1u3 < t2h1d6 && t2h1u3 < t2w1rwt6 && t2h1u3 < t2w1lwt6 && t2h1u3 < t2h1uwt6 && t2h1u3 < t2h1dwt6
  && t2h1u3 < t2w1r7 && t2h1u3 < t2w1l7 && t2h1u3 < t2h1u7 && t2h1u3 < t2h1d7 && t2h1u3 < t2w1rwt7 && t2h1u3 < t2w1lwt7 && t2h1u3 < t2h1uwt7 && t2h1u3 < t2h1dwt7
  && t2h1u3 < t2w1r8 && t2h1u3 < t2w1l8 && t2h1u3 < t2h1u8 && t2h1u3 < t2h1d8 && t2h1u3 < t2w1rwt8 && t2h1u3 < t2w1lwt8 && t2h1u3 < t2h1uwt8 && t2h1u3 < t2h1dwt8
  && t2h1u3 < t2w1r9 && t2h1u3 < t2w1l9 && t2h1u3 < t2h1u9 && t2h1u3 < t2h1d9 && t2h1u3 < t2w1rwt9 && t2h1u3 < t2w1lwt9 && t2h1u3 < t2h1uwt9 && t2h1u3 < t2h1dwt9
  && t2h1u3 < t2w1r10 && t2h1u3 < t2w1l10 && t2h1u3 < t2h1u10 && t2h1u3 < t2h1d10 && t2h1u3 < t2w1rwt10 && t2h1u3 < t2w1lwt10 && t2h1u3 < t2h1uwt10 && t2h1u3 < t2h1dwt10
  && ((louthu3!=0 && linhu3==0) || (louthu3==0 && linhu3!=0))){
  i=136;
  }

  if (myu3==-1 && t2h1u3 > 0 && t2h1u3 < t1 
  && t2h1u3 < t2w1r && t2h1u3 < t2w1l && t2h1u3 < t2h1u && t2h1u3 < t2h1d && t2h1u3 < t2w1rwt && t2h1u3 < t2w1lwt && t2h1u3 < t2h1uwt && t2h1u3 < t2h1dwt
  && t2h1u3 < t2w1r1 && t2h1u3 < t2w1l1 && t2h1u3 < t2h1u1 && t2h1u3 < t2h1d1 && t2h1u3 < t2w1rwt1 && t2h1u3 < t2w1lwt1 && t2h1u3 < t2h1uwt1 && t2h1u3 < t2h1dwt1
  && t2h1u3 < t2w1r2 && t2h1u3 < t2w1l2 && t2h1u3 < t2h1u2 && t2h1u3 < t2h1d2 && t2h1u3 < t2w1rwt2 && t2h1u3 < t2w1lwt2 && t2h1u3 < t2h1uwt2 && t2h1u3 < t2h1dwt2
  && t2h1u3 < t2w1r3 && t2h1u3 < t2w1l3 && t2h1u3 < t2h1d3 && t2h1u3 < t2w1rwt3 && t2h1u3 < t2w1lwt3 && t2h1u3 < t2h1uwt3 && t2h1u3 < t2h1dwt3
  && t2h1u3 < t2w1r4 && t2h1u3 < t2w1l4 && t2h1u3 < t2h1u4 && t2h1u3 < t2h1d4 && t2h1u3 < t2w1rwt4 && t2h1u3 < t2w1lwt4 && t2h1u3 < t2h1uwt4 && t2h1u3 < t2h1dwt4
  && t2h1u3 < t2w1r5 && t2h1u3 < t2w1l5 && t2h1u3 < t2h1u5 && t2h1u3 < t2h1d5 && t2h1u3 < t2w1rwt5 && t2h1u3 < t2w1lwt5 && t2h1u3 < t2h1uwt5 && t2h1u3 < t2h1dwt5
  && t2h1u3 < t2w1r6 && t2h1u3 < t2w1l6 && t2h1u3 < t2h1u6 && t2h1u3 < t2h1d6 && t2h1u3 < t2w1rwt6 && t2h1u3 < t2w1lwt6 && t2h1u3 < t2h1uwt6 && t2h1u3 < t2h1dwt6
  && t2h1u3 < t2w1r7 && t2h1u3 < t2w1l7 && t2h1u3 < t2h1u7 && t2h1u3 < t2h1d7 && t2h1u3 < t2w1rwt7 && t2h1u3 < t2w1lwt7 && t2h1u3 < t2h1uwt7 && t2h1u3 < t2h1dwt7
  && t2h1u3 < t2w1r8 && t2h1u3 < t2w1l8 && t2h1u3 < t2h1u8 && t2h1u3 < t2h1d8 && t2h1u3 < t2w1rwt8 && t2h1u3 < t2w1lwt8 && t2h1u3 < t2h1uwt8 && t2h1u3 < t2h1dwt8
  && t2h1u3 < t2w1r9 && t2h1u3 < t2w1l9 && t2h1u3 < t2h1u9 && t2h1u3 < t2h1d9 && t2h1u3 < t2w1rwt9 && t2h1u3 < t2w1lwt9 && t2h1u3 < t2h1uwt9 && t2h1u3 < t2h1dwt9
  && t2h1u3 < t2w1r10 && t2h1u3 < t2w1l10 && t2h1u3 < t2h1u10 && t2h1u3 < t2h1d10 && t2h1u3 < t2w1rwt10 && t2h1u3 < t2w1lwt10 && t2h1u3 < t2h1uwt10 && t2h1u3 < t2h1dwt10
  && (louthu3 == 0 && linhu3 == 0)){
  i=136;
  }

  if (myd3==-1 && t2h1d3 > 0 && t2h1d3 < t1 
  && t2h1d3 < t2w1r && t2h1d3 < t2w1l && t2h1d3 < t2h1u && t2h1d3 < t2h1d && t2h1d3 < t2w1rwt && t2h1d3 < t2w1lwt && t2h1d3 < t2h1uwt && t2h1d3 < t2h1dwt
  && t2h1d3 < t2w1r1 && t2h1d3 < t2w1l1 && t2h1d3 < t2h1u1 && t2h1d3 < t2h1d1 && t2h1d3 < t2w1rwt1 && t2h1d3 < t2w1lwt1 && t2h1d3 < t2h1uwt1 && t2h1d3 < t2h1dwt1
  && t2h1d3 < t2w1r2 && t2h1d3 < t2w1l2 && t2h1d3 < t2h1u2 && t2h1d3 < t2h1d2 && t2h1d3 < t2w1rwt2 && t2h1d3 < t2w1lwt2 && t2h1d3 < t2h1uwt2 && t2h1d3 < t2h1dwt2
  && t2h1d3 < t2w1r3 && t2h1d3 < t2w1l3 && t2h1d3 < t2h1u3 && t2h1d3 < t2w1rwt3 && t2h1d3 < t2w1lwt3 && t2h1d3 < t2h1uwt3 && t2h1d3 < t2h1dwt3
  && t2h1d3 < t2w1r4 && t2h1d3 < t2w1l4 && t2h1d3 < t2h1u4 && t2h1d3 < t2h1d4 && t2h1d3 < t2w1rwt4 && t2h1d3 < t2w1lwt4 && t2h1d3 < t2h1uwt4 && t2h1d3 < t2h1dwt4
  && t2h1d3 < t2w1r5 && t2h1d3 < t2w1l5 && t2h1d3 < t2h1u5 && t2h1d3 < t2h1d5 && t2h1d3 < t2w1rwt5 && t2h1d3 < t2w1lwt5 && t2h1d3 < t2h1uwt5 && t2h1d3 < t2h1dwt5
  && t2h1d3 < t2w1r6 && t2h1d3 < t2w1l6 && t2h1d3 < t2h1u6 && t2h1d3 < t2h1d6 && t2h1d3 < t2w1rwt6 && t2h1d3 < t2w1lwt6 && t2h1d3 < t2h1uwt6 && t2h1d3 < t2h1dwt6
  && t2h1d3 < t2w1r7 && t2h1d3 < t2w1l7 && t2h1d3 < t2h1u7 && t2h1d3 < t2h1d7 && t2h1d3 < t2w1rwt7 && t2h1d3 < t2w1lwt7 && t2h1d3 < t2h1uwt7 && t2h1d3 < t2h1dwt7
  && t2h1d3 < t2w1r8 && t2h1d3 < t2w1l8 && t2h1d3 < t2h1u8 && t2h1d3 < t2h1d8 && t2h1d3 < t2w1rwt8 && t2h1d3 < t2w1lwt8 && t2h1d3 < t2h1uwt8 && t2h1d3 < t2h1dwt8
  && t2h1d3 < t2w1r9 && t2h1d3 < t2w1l9 && t2h1d3 < t2h1u9 && t2h1d3 < t2h1d9 && t2h1d3 < t2w1rwt9 && t2h1d3 < t2w1lwt9 && t2h1d3 < t2h1uwt9 && t2h1d3 < t2h1dwt9
  && t2h1d3 < t2w1r10 && t2h1d3 < t2w1l10 && t2h1d3 < t2h1u10 && t2h1d3 < t2h1d10 && t2h1d3 < t2w1rwt10 && t2h1d3 < t2w1lwt10 && t2h1d3 < t2h1uwt10 && t2h1d3 < t2h1dwt10
  && (louthd3 !=0 && linhd3!=0)){
  i=137;
  }

  if (myd3==-1 && t2h1d3 > 0 && t2h1d3 < t1 
  && t2h1d3 < t2w1r && t2h1d3 < t2w1l && t2h1d3 < t2h1u && t2h1d3 < t2h1d && t2h1d3 < t2w1rwt && t2h1d3 < t2w1lwt && t2h1d3 < t2h1uwt && t2h1d3 < t2h1dwt
  && t2h1d3 < t2w1r1 && t2h1d3 < t2w1l1 && t2h1d3 < t2h1u1 && t2h1d3 < t2h1d1 && t2h1d3 < t2w1rwt1 && t2h1d3 < t2w1lwt1 && t2h1d3 < t2h1uwt1 && t2h1d3 < t2h1dwt1
  && t2h1d3 < t2w1r2 && t2h1d3 < t2w1l2 && t2h1d3 < t2h1u2 && t2h1d3 < t2h1d2 && t2h1d3 < t2w1rwt2 && t2h1d3 < t2w1lwt2 && t2h1d3 < t2h1uwt2 && t2h1d3 < t2h1dwt2
  && t2h1d3 < t2w1r3 && t2h1d3 < t2w1l3 && t2h1d3 < t2h1u3 && t2h1d3 < t2w1rwt3 && t2h1d3 < t2w1lwt3 && t2h1d3 < t2h1uwt3 && t2h1d3 < t2h1dwt3
  && t2h1d3 < t2w1r4 && t2h1d3 < t2w1l4 && t2h1d3 < t2h1u4 && t2h1d3 < t2h1d4 && t2h1d3 < t2w1rwt4 && t2h1d3 < t2w1lwt4 && t2h1d3 < t2h1uwt4 && t2h1d3 < t2h1dwt4
  && t2h1d3 < t2w1r5 && t2h1d3 < t2w1l5 && t2h1d3 < t2h1u5 && t2h1d3 < t2h1d5 && t2h1d3 < t2w1rwt5 && t2h1d3 < t2w1lwt5 && t2h1d3 < t2h1uwt5 && t2h1d3 < t2h1dwt5
  && t2h1d3 < t2w1r6 && t2h1d3 < t2w1l6 && t2h1d3 < t2h1u6 && t2h1d3 < t2h1d6 && t2h1d3 < t2w1rwt6 && t2h1d3 < t2w1lwt6 && t2h1d3 < t2h1uwt6 && t2h1d3 < t2h1dwt6
  && t2h1d3 < t2w1r7 && t2h1d3 < t2w1l7 && t2h1d3 < t2h1u7 && t2h1d3 < t2h1d7 && t2h1d3 < t2w1rwt7 && t2h1d3 < t2w1lwt7 && t2h1d3 < t2h1uwt7 && t2h1d3 < t2h1dwt7
  && t2h1d3 < t2w1r8 && t2h1d3 < t2w1l8 && t2h1d3 < t2h1u8 && t2h1d3 < t2h1d8 && t2h1d3 < t2w1rwt8 && t2h1d3 < t2w1lwt8 && t2h1d3 < t2h1uwt8 && t2h1d3 < t2h1dwt8
  && t2h1d3 < t2w1r9 && t2h1d3 < t2w1l9 && t2h1d3 < t2h1u9 && t2h1d3 < t2h1d9 && t2h1d3 < t2w1rwt9 && t2h1d3 < t2w1lwt9 && t2h1d3 < t2h1uwt9 && t2h1d3 < t2h1dwt9
  && t2h1d3 < t2w1r10 && t2h1d3 < t2w1l10 && t2h1d3 < t2h1u10 && t2h1d3 < t2h1d10 && t2h1d3 < t2w1rwt10 && t2h1d3 < t2w1lwt10 && t2h1d3 < t2h1uwt10 && t2h1d3 < t2h1dwt10
  && ((louthd3 !=0 && linhd3==0) || (louthd3 ==0 && linhd3!=0))){
  i=137;
  }

  if (myd3==-1 && t2h1d3 > 0 && t2h1d3 < t1 
  && t2h1d3 < t2w1r && t2h1d3 < t2w1l && t2h1d3 < t2h1u && t2h1d3 < t2h1d && t2h1d3 < t2w1rwt && t2h1d3 < t2w1lwt && t2h1d3 < t2h1uwt && t2h1d3 < t2h1dwt
  && t2h1d3 < t2w1r1 && t2h1d3 < t2w1l1 && t2h1d3 < t2h1u1 && t2h1d3 < t2h1d1 && t2h1d3 < t2w1rwt1 && t2h1d3 < t2w1lwt1 && t2h1d3 < t2h1uwt1 && t2h1d3 < t2h1dwt1
  && t2h1d3 < t2w1r2 && t2h1d3 < t2w1l2 && t2h1d3 < t2h1u2 && t2h1d3 < t2h1d2 && t2h1d3 < t2w1rwt2 && t2h1d3 < t2w1lwt2 && t2h1d3 < t2h1uwt2 && t2h1d3 < t2h1dwt2
  && t2h1d3 < t2w1r3 && t2h1d3 < t2w1l3 && t2h1d3 < t2h1u3 && t2h1d3 < t2w1rwt3 && t2h1d3 < t2w1lwt3 && t2h1d3 < t2h1uwt3 && t2h1d3 < t2h1dwt3
  && t2h1d3 < t2w1r4 && t2h1d3 < t2w1l4 && t2h1d3 < t2h1u4 && t2h1d3 < t2h1d4 && t2h1d3 < t2w1rwt4 && t2h1d3 < t2w1lwt4 && t2h1d3 < t2h1uwt4 && t2h1d3 < t2h1dwt4
  && t2h1d3 < t2w1r5 && t2h1d3 < t2w1l5 && t2h1d3 < t2h1u5 && t2h1d3 < t2h1d5 && t2h1d3 < t2w1rwt5 && t2h1d3 < t2w1lwt5 && t2h1d3 < t2h1uwt5 && t2h1d3 < t2h1dwt5
  && t2h1d3 < t2w1r6 && t2h1d3 < t2w1l6 && t2h1d3 < t2h1u6 && t2h1d3 < t2h1d6 && t2h1d3 < t2w1rwt6 && t2h1d3 < t2w1lwt6 && t2h1d3 < t2h1uwt6 && t2h1d3 < t2h1dwt6
  && t2h1d3 < t2w1r7 && t2h1d3 < t2w1l7 && t2h1d3 < t2h1u7 && t2h1d3 < t2h1d7 && t2h1d3 < t2w1rwt7 && t2h1d3 < t2w1lwt7 && t2h1d3 < t2h1uwt7 && t2h1d3 < t2h1dwt7
  && t2h1d3 < t2w1r8 && t2h1d3 < t2w1l8 && t2h1d3 < t2h1u8 && t2h1d3 < t2h1d8 && t2h1d3 < t2w1rwt8 && t2h1d3 < t2w1lwt8 && t2h1d3 < t2h1uwt8 && t2h1d3 < t2h1dwt8
  && t2h1d3 < t2w1r9 && t2h1d3 < t2w1l9 && t2h1d3 < t2h1u9 && t2h1d3 < t2h1d9 && t2h1d3 < t2w1rwt9 && t2h1d3 < t2w1lwt9 && t2h1d3 < t2h1uwt9 && t2h1d3 < t2h1dwt9
  && t2h1d3 < t2w1r10 && t2h1d3 < t2w1l10 && t2h1d3 < t2h1u10 && t2h1d3 < t2h1d10 && t2h1d3 < t2w1rwt10 && t2h1d3 < t2w1lwt10 && t2h1d3 < t2h1uwt10 && t2h1d3 < t2h1dwt10
  && (louthd3 == 0 && linhd3 == 0)){
  i=137;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW3!=-1 && t2w1rwt3 > 0 && t2w1rwt3 < t1 
  && t2w1rwt3 < t2w1r && t2w1rwt3 < t2w1l && t2w1rwt3 < t2h1u && t2w1rwt3 < t2h1d && t2w1rwt3 <t2w1rwt && t2w1rwt3 <t2w1lwt && t2w1rwt3 < t2h1uwt && t2w1rwt3 < t2h1dwt
  && t2w1rwt3 < t2w1r1 && t2w1rwt3 < t2w1l1 && t2w1rwt3 < t2h1u1 && t2w1rwt3 < t2h1d1 && t2w1rwt3 <t2w1rwt1 && t2w1rwt3 <t2w1lwt1 && t2w1rwt3 < t2h1uwt1 && t2w1rwt3 < t2h1dwt1
  && t2w1rwt3 < t2w1r2 && t2w1rwt3 < t2w1l2 && t2w1rwt3 < t2h1u2 && t2w1rwt3 < t2h1d2 && t2w1rwt3 <t2w1rwt2 && t2w1rwt3 <t2w1lwt2 && t2w1rwt3 < t2h1uwt2 && t2w1rwt3 < t2h1dwt2
  && t2w1rwt3 < t2w1r3 && t2w1rwt3 < t2w1l3 && t2w1rwt3 < t2h1u3 && t2w1rwt3 < t2h1d3 && t2w1rwt3 <t2w1lwt3 && t2w1rwt3 < t2h1uwt3 && t2w1rwt3 < t2h1dwt3
  && t2w1rwt3 < t2w1r4 && t2w1rwt3 < t2w1l4 && t2w1rwt3 < t2h1u4 && t2w1rwt3 < t2h1d4 && t2w1rwt3 <t2w1rwt4 && t2w1rwt3 <t2w1lwt4 && t2w1rwt3 < t2h1uwt4 && t2w1rwt3 < t2h1dwt4
  && t2w1rwt3 < t2w1r5 && t2w1rwt3 < t2w1l5 && t2w1rwt3 < t2h1u5 && t2w1rwt3 < t2h1d5 && t2w1rwt3 <t2w1rwt5 && t2w1rwt3 <t2w1lwt5 && t2w1rwt3 < t2h1uwt5 && t2w1rwt3 < t2h1dwt5
  && t2w1rwt3 < t2w1r6 && t2w1rwt3 < t2w1l6 && t2w1rwt3 < t2h1u6 && t2w1rwt3 < t2h1d6 && t2w1rwt3 <t2w1rwt6 && t2w1rwt3 <t2w1lwt6 && t2w1rwt3 < t2h1uwt6 && t2w1rwt3 < t2h1dwt6
  && t2w1rwt3 < t2w1r7 && t2w1rwt3 < t2w1l7 && t2w1rwt3 < t2h1u7 && t2w1rwt3 < t2h1d7 && t2w1rwt3 <t2w1rwt7 && t2w1rwt3 <t2w1lwt7 && t2w1rwt3 < t2h1uwt7 && t2w1rwt3 < t2h1dwt7
  && t2w1rwt3 < t2w1r8 && t2w1rwt3 < t2w1l8 && t2w1rwt3 < t2h1u8 && t2w1rwt3 < t2h1d8 && t2w1rwt3 <t2w1rwt8 && t2w1rwt3 <t2w1lwt8 && t2w1rwt3 < t2h1uwt8 && t2w1rwt3 < t2h1dwt8
  && t2w1rwt3 < t2w1r9 && t2w1rwt3 < t2w1l9 && t2w1rwt3 < t2h1u9 && t2w1rwt3 < t2h1d9 && t2w1rwt3 <t2w1rwt9 && t2w1rwt3 <t2w1lwt9 && t2w1rwt3 < t2h1uwt9 && t2w1rwt3 < t2h1dwt9
  && t2w1rwt3 < t2w1r10 && t2w1rwt3 < t2w1l10 && t2w1rwt3 < t2h1u10 && t2w1rwt3 < t2h1d10 && t2w1rwt3 <t2w1rwt10 && t2w1rwt3 <t2w1lwt10 && t2w1rwt3 < t2h1uwt10 && t2w1rwt3 < t2h1dwt10
  && ((linwr3!=0) && (loutwr3!=0) )){	
   if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1rwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1rwt3+z))*(z0hd3+(vz*t2w1rwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1rwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1rwt3+z))*(z0hu3+(vz*t2w1rwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1rwt3+y;
  xtest=vx*t2w1rwt3+x;
  xlimitrwt=-bwrwt3*sqrt(1-((vz*t2w1rwt3+z)+z0wr3)*((vz*t2w1rwt3+z)+z0wr3)/a2wrwt3);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW3 > 0){
  i=142;
  }
  else{
  i=154;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW3!=-1 && t2w1rwt3 > 0 && t2w1rwt3 < t1 
  && t2w1rwt3 < t2w1r && t2w1rwt3 < t2w1l && t2w1rwt3 < t2h1u && t2w1rwt3 < t2h1d && t2w1rwt3 <t2w1rwt && t2w1rwt3 <t2w1lwt && t2w1rwt3 < t2h1uwt && t2w1rwt3 < t2h1dwt
  && t2w1rwt3 < t2w1r1 && t2w1rwt3 < t2w1l1 && t2w1rwt3 < t2h1u1 && t2w1rwt3 < t2h1d1 && t2w1rwt3 <t2w1rwt1 && t2w1rwt3 <t2w1lwt1 && t2w1rwt3 < t2h1uwt1 && t2w1rwt3 < t2h1dwt1
  && t2w1rwt3 < t2w1r2 && t2w1rwt3 < t2w1l2 && t2w1rwt3 < t2h1u2 && t2w1rwt3 < t2h1d2 && t2w1rwt3 <t2w1rwt2 && t2w1rwt3 <t2w1lwt2 && t2w1rwt3 < t2h1uwt2 && t2w1rwt3 < t2h1dwt2
  && t2w1rwt3 < t2w1r3 && t2w1rwt3 < t2w1l3 && t2w1rwt3 < t2h1u3 && t2w1rwt3 < t2h1d3 && t2w1rwt3 <t2w1lwt3 && t2w1rwt3 < t2h1uwt3 && t2w1rwt3 < t2h1dwt3
  && t2w1rwt3 < t2w1r4 && t2w1rwt3 < t2w1l4 && t2w1rwt3 < t2h1u4 && t2w1rwt3 < t2h1d4 && t2w1rwt3 <t2w1rwt4 && t2w1rwt3 <t2w1lwt4 && t2w1rwt3 < t2h1uwt4 && t2w1rwt3 < t2h1dwt4
  && t2w1rwt3 < t2w1r5 && t2w1rwt3 < t2w1l5 && t2w1rwt3 < t2h1u5 && t2w1rwt3 < t2h1d5 && t2w1rwt3 <t2w1rwt5 && t2w1rwt3 <t2w1lwt5 && t2w1rwt3 < t2h1uwt5 && t2w1rwt3 < t2h1dwt5
  && t2w1rwt3 < t2w1r6 && t2w1rwt3 < t2w1l6 && t2w1rwt3 < t2h1u6 && t2w1rwt3 < t2h1d6 && t2w1rwt3 <t2w1rwt6 && t2w1rwt3 <t2w1lwt6 && t2w1rwt3 < t2h1uwt6 && t2w1rwt3 < t2h1dwt6
  && t2w1rwt3 < t2w1r7 && t2w1rwt3 < t2w1l7 && t2w1rwt3 < t2h1u7 && t2w1rwt3 < t2h1d7 && t2w1rwt3 <t2w1rwt7 && t2w1rwt3 <t2w1lwt7 && t2w1rwt3 < t2h1uwt7 && t2w1rwt3 < t2h1dwt7
  && t2w1rwt3 < t2w1r8 && t2w1rwt3 < t2w1l8 && t2w1rwt3 < t2h1u8 && t2w1rwt3 < t2h1d8 && t2w1rwt3 <t2w1rwt8 && t2w1rwt3 <t2w1lwt8 && t2w1rwt3 < t2h1uwt8 && t2w1rwt3 < t2h1dwt8
  && t2w1rwt3 < t2w1r9 && t2w1rwt3 < t2w1l9 && t2w1rwt3 < t2h1u9 && t2w1rwt3 < t2h1d9 && t2w1rwt3 <t2w1rwt9 && t2w1rwt3 <t2w1lwt9 && t2w1rwt3 < t2h1uwt9 && t2w1rwt3 < t2h1dwt9
  && t2w1rwt3 < t2w1r10 && t2w1rwt3 < t2w1l10 && t2w1rwt3 < t2h1u10 && t2w1rwt3 < t2h1d10 && t2w1rwt3 <t2w1rwt10 && t2w1rwt3 <t2w1lwt10 && t2w1rwt3 < t2h1uwt10 && t2w1rwt3 < t2h1dwt10
  && ((loutwr3!=0 && linwr3==0) || (loutwr3==0 && linwr3!=0))){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1rwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1rwt3+z))*(z0hd3+(vz*t2w1rwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1rwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1rwt3+z))*(z0hu3+(vz*t2w1rwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1rwt3+y;
  xtest=vx*t2w1rwt3+x;
  xlimitr=-sqrt((pbwrwt3-(vz*t2w1rwt3+z))/pawrwt3);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW3 > 0){
  i=143; 
  }else{
  i=154;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW3!=-1 && t2w1rwt3 > 0 && t2w1rwt3 < t1 
  && t2w1rwt3 < t2w1r && t2w1rwt3 < t2w1l && t2w1rwt3 < t2h1u && t2w1rwt3 < t2h1d && t2w1rwt3 <t2w1rwt && t2w1rwt3 <t2w1lwt && t2w1rwt3 < t2h1uwt && t2w1rwt3 < t2h1dwt
  && t2w1rwt3 < t2w1r1 && t2w1rwt3 < t2w1l1 && t2w1rwt3 < t2h1u1 && t2w1rwt3 < t2h1d1 && t2w1rwt3 <t2w1rwt1 && t2w1rwt3 <t2w1lwt1 && t2w1rwt3 < t2h1uwt1 && t2w1rwt3 < t2h1dwt1
  && t2w1rwt3 < t2w1r2 && t2w1rwt3 < t2w1l2 && t2w1rwt3 < t2h1u2 && t2w1rwt3 < t2h1d2 && t2w1rwt3 <t2w1rwt2 && t2w1rwt3 <t2w1lwt2 && t2w1rwt3 < t2h1uwt2 && t2w1rwt3 < t2h1dwt2
  && t2w1rwt3 < t2w1r3 && t2w1rwt3 < t2w1l3 && t2w1rwt3 < t2h1u3 && t2w1rwt3 < t2h1d3 && t2w1rwt3 <t2w1lwt3 && t2w1rwt3 < t2h1uwt3 && t2w1rwt3 < t2h1dwt3
  && t2w1rwt3 < t2w1r4 && t2w1rwt3 < t2w1l4 && t2w1rwt3 < t2h1u4 && t2w1rwt3 < t2h1d4 && t2w1rwt3 <t2w1rwt4 && t2w1rwt3 <t2w1lwt4 && t2w1rwt3 < t2h1uwt4 && t2w1rwt3 < t2h1dwt4
  && t2w1rwt3 < t2w1r5 && t2w1rwt3 < t2w1l5 && t2w1rwt3 < t2h1u5 && t2w1rwt3 < t2h1d5 && t2w1rwt3 <t2w1rwt5 && t2w1rwt3 <t2w1lwt5 && t2w1rwt3 < t2h1uwt5 && t2w1rwt3 < t2h1dwt5
  && t2w1rwt3 < t2w1r6 && t2w1rwt3 < t2w1l6 && t2w1rwt3 < t2h1u6 && t2w1rwt3 < t2h1d6 && t2w1rwt3 <t2w1rwt6 && t2w1rwt3 <t2w1lwt6 && t2w1rwt3 < t2h1uwt6 && t2w1rwt3 < t2h1dwt6
  && t2w1rwt3 < t2w1r7 && t2w1rwt3 < t2w1l7 && t2w1rwt3 < t2h1u7 && t2w1rwt3 < t2h1d7 && t2w1rwt3 <t2w1rwt7 && t2w1rwt3 <t2w1lwt7 && t2w1rwt3 < t2h1uwt7 && t2w1rwt3 < t2h1dwt7
  && t2w1rwt3 < t2w1r8 && t2w1rwt3 < t2w1l8 && t2w1rwt3 < t2h1u8 && t2w1rwt3 < t2h1d8 && t2w1rwt3 <t2w1rwt8 && t2w1rwt3 <t2w1lwt8 && t2w1rwt3 < t2h1uwt8 && t2w1rwt3 < t2h1dwt8
  && t2w1rwt3 < t2w1r9 && t2w1rwt3 < t2w1l9 && t2w1rwt3 < t2h1u9 && t2w1rwt3 < t2h1d9 && t2w1rwt3 <t2w1rwt9 && t2w1rwt3 <t2w1lwt9 && t2w1rwt3 < t2h1uwt9 && t2w1rwt3 < t2h1dwt9
  && t2w1rwt3 < t2w1r10 && t2w1rwt3 < t2w1l10 && t2w1rwt3 < t2h1u10 && t2w1rwt3 < t2h1d10 && t2w1rwt3 <t2w1rwt10 && t2w1rwt3 <t2w1lwt10 && t2w1rwt3 < t2h1uwt10 && t2w1rwt3 < t2h1dwt10
  && (loutwr3==0 && linwr3==0)){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1rwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1rwt3+z))*(z0hd3+(vz*t2w1rwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1rwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1rwt3+z))*(z0hu3+(vz*t2w1rwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1rwt3+y; 
  xtest=vx*t2w1rwt3+x;
  xlimitr=-(-w2r3+w1r3)*(vz*t2w1rwt3+z)/l-w1rwt3;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW3>0){
  i=144;
  }else{
  i=154;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW3!=-1 && t2w1lwt3 > 0 && t2w1lwt3 < t1 
  && t2w1lwt3 < t2w1r && t2w1lwt3 < t2w1l && t2w1lwt3 < t2h1u && t2w1lwt3 < t2h1d && t2w1lwt3 <t2w1rwt && t2w1lwt3 <t2w1lwt && t2w1lwt3 < t2h1uwt && t2w1lwt3 < t2h1dwt
  && t2w1lwt3 < t2w1r1 && t2w1lwt3 < t2w1l1 && t2w1lwt3 < t2h1u1 && t2w1lwt3 < t2h1d1 && t2w1lwt3 <t2w1rwt1 && t2w1lwt3 <t2w1lwt1 && t2w1lwt3 < t2h1uwt1 && t2w1lwt3 < t2h1dwt1
  && t2w1lwt3 < t2w1r2 && t2w1lwt3 < t2w1l2 && t2w1lwt3 < t2h1u2 && t2w1lwt3 < t2h1d2 && t2w1lwt3 <t2w1rwt2 && t2w1lwt3 <t2w1lwt2 && t2w1lwt3 < t2h1uwt2 && t2w1lwt3 < t2h1dwt2
  && t2w1lwt3 < t2w1r3 && t2w1lwt3 < t2w1l3 && t2w1lwt3 < t2h1u3 && t2w1lwt3 < t2h1d3 && t2w1lwt3 <t2w1rwt3 && t2w1lwt3 < t2h1uwt3 && t2w1lwt3 < t2h1dwt3
  && t2w1lwt3 < t2w1r4 && t2w1lwt3 < t2w1l4 && t2w1lwt3 < t2h1u4 && t2w1lwt3 < t2h1d4 && t2w1lwt3 <t2w1rwt4 && t2w1lwt3 <t2w1lwt4 && t2w1lwt3 < t2h1uwt4 && t2w1lwt3 < t2h1dwt4
  && t2w1lwt3 < t2w1r5 && t2w1lwt3 < t2w1l5 && t2w1lwt3 < t2h1u5 && t2w1lwt3 < t2h1d5 && t2w1lwt3 <t2w1rwt5 && t2w1lwt3 <t2w1lwt5 && t2w1lwt3 < t2h1uwt5 && t2w1lwt3 < t2h1dwt5
  && t2w1lwt3 < t2w1r6 && t2w1lwt3 < t2w1l6 && t2w1lwt3 < t2h1u6 && t2w1lwt3 < t2h1d6 && t2w1lwt3 <t2w1rwt6 && t2w1lwt3 <t2w1lwt6 && t2w1lwt3 < t2h1uwt6 && t2w1lwt3 < t2h1dwt6
  && t2w1lwt3 < t2w1r7 && t2w1lwt3 < t2w1l7 && t2w1lwt3 < t2h1u7 && t2w1lwt3 < t2h1d7 && t2w1lwt3 <t2w1rwt7 && t2w1lwt3 <t2w1lwt7 && t2w1lwt3 < t2h1uwt7 && t2w1lwt3 < t2h1dwt7
  && t2w1lwt3 < t2w1r8 && t2w1lwt3 < t2w1l8 && t2w1lwt3 < t2h1u8 && t2w1lwt3 < t2h1d8 && t2w1lwt3 <t2w1rwt8 && t2w1lwt3 <t2w1lwt8 && t2w1lwt3 < t2h1uwt8 && t2w1lwt3 < t2h1dwt8
  && t2w1lwt3 < t2w1r9 && t2w1lwt3 < t2w1l9 && t2w1lwt3 < t2h1u9 && t2w1lwt3 < t2h1d9 && t2w1lwt3 <t2w1rwt9 && t2w1lwt3 <t2w1lwt9 && t2w1lwt3 < t2h1uwt9 && t2w1lwt3 < t2h1dwt9
  && t2w1lwt3 < t2w1r10 && t2w1lwt3 < t2w1l10 && t2w1lwt3 < t2h1u10 && t2w1lwt3 < t2h1d10 && t2w1lwt3 <t2w1rwt10 && t2w1lwt3 <t2w1lwt10 && t2w1lwt3 < t2h1uwt10 && t2w1lwt3 < t2h1dwt10
  && ((linwl3!=0) && (loutwl3!=0) )){
  if(linhd3==0 && louthd3==0)
   if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1lwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1lwt3+z))*(z0hd3+(vz*t2w1lwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1lwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1lwt3+z))*(z0hu3+(vz*t2w1lwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1lwt3+y;
  xtest=vx*t2w1lwt3+x;
  xlimitlwt=-bwlwt3*sqrt(1-((vz*t2w1lwt3+z)+z0wl3)*((vz*t2w1lwt3+z)+z0wl3)/a2wlwt3);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW3>0){
  i=145;
  }else{
  i=155;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW3!=-1 && t2w1lwt3 > 0 && t2w1lwt3 < t1 
  && t2w1lwt3 < t2w1r && t2w1lwt3 < t2w1l && t2w1lwt3 < t2h1u && t2w1lwt3 < t2h1d && t2w1lwt3 <t2w1rwt && t2w1lwt3 <t2w1lwt && t2w1lwt3 < t2h1uwt && t2w1lwt3 < t2h1dwt
  && t2w1lwt3 < t2w1r1 && t2w1lwt3 < t2w1l1 && t2w1lwt3 < t2h1u1 && t2w1lwt3 < t2h1d1 && t2w1lwt3 <t2w1rwt1 && t2w1lwt3 <t2w1lwt1 && t2w1lwt3 < t2h1uwt1 && t2w1lwt3 < t2h1dwt1
  && t2w1lwt3 < t2w1r2 && t2w1lwt3 < t2w1l2 && t2w1lwt3 < t2h1u2 && t2w1lwt3 < t2h1d2 && t2w1lwt3 <t2w1rwt2 && t2w1lwt3 <t2w1lwt2 && t2w1lwt3 < t2h1uwt2 && t2w1lwt3 < t2h1dwt2
  && t2w1lwt3 < t2w1r3 && t2w1lwt3 < t2w1l3 && t2w1lwt3 < t2h1u3 && t2w1lwt3 < t2h1d3 && t2w1lwt3 <t2w1rwt3 && t2w1lwt3 < t2h1uwt3 && t2w1lwt3 < t2h1dwt3
  && t2w1lwt3 < t2w1r4 && t2w1lwt3 < t2w1l4 && t2w1lwt3 < t2h1u4 && t2w1lwt3 < t2h1d4 && t2w1lwt3 <t2w1rwt4 && t2w1lwt3 <t2w1lwt4 && t2w1lwt3 < t2h1uwt4 && t2w1lwt3 < t2h1dwt4
  && t2w1lwt3 < t2w1r5 && t2w1lwt3 < t2w1l5 && t2w1lwt3 < t2h1u5 && t2w1lwt3 < t2h1d5 && t2w1lwt3 <t2w1rwt5 && t2w1lwt3 <t2w1lwt5 && t2w1lwt3 < t2h1uwt5 && t2w1lwt3 < t2h1dwt5
  && t2w1lwt3 < t2w1r6 && t2w1lwt3 < t2w1l6 && t2w1lwt3 < t2h1u6 && t2w1lwt3 < t2h1d6 && t2w1lwt3 <t2w1rwt6 && t2w1lwt3 <t2w1lwt6 && t2w1lwt3 < t2h1uwt6 && t2w1lwt3 < t2h1dwt6
  && t2w1lwt3 < t2w1r7 && t2w1lwt3 < t2w1l7 && t2w1lwt3 < t2h1u7 && t2w1lwt3 < t2h1d7 && t2w1lwt3 <t2w1rwt7 && t2w1lwt3 <t2w1lwt7 && t2w1lwt3 < t2h1uwt7 && t2w1lwt3 < t2h1dwt7
  && t2w1lwt3 < t2w1r8 && t2w1lwt3 < t2w1l8 && t2w1lwt3 < t2h1u8 && t2w1lwt3 < t2h1d8 && t2w1lwt3 <t2w1rwt8 && t2w1lwt3 <t2w1lwt8 && t2w1lwt3 < t2h1uwt8 && t2w1lwt3 < t2h1dwt8
  && t2w1lwt3 < t2w1r9 && t2w1lwt3 < t2w1l9 && t2w1lwt3 < t2h1u9 && t2w1lwt3 < t2h1d9 && t2w1lwt3 <t2w1rwt9 && t2w1lwt3 <t2w1lwt9 && t2w1lwt3 < t2h1uwt9 && t2w1lwt3 < t2h1dwt9
  && t2w1lwt3 < t2w1r10 && t2w1lwt3 < t2w1l10 && t2w1lwt3 < t2h1u10 && t2w1lwt3 < t2h1d10 && t2w1lwt3 <t2w1rwt10 && t2w1lwt3 <t2w1lwt10 && t2w1lwt3 < t2h1uwt10 && t2w1lwt3 < t2h1dwt10
  && ((loutwl3!=0 && linwl3==0) || (loutwl3==0 && linwl3!=0))){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1lwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1lwt3+z))*(z0hd3+(vz*t2w1lwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1lwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1lwt3+z))*(z0hu3+(vz*t2w1lwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1lwt3+y;
  xtest=vx*t2w1lwt3+x;
  xlimitl=-sqrt((pbwlwt3-(vz*t2w1lwt3+z))/pawlwt3);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW3>0){
  i=146;
  }else{
  i=155;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW3!=-1 && t2w1lwt3 > 0 && t2w1lwt3 < t1 
  && t2w1lwt3 < t2w1r && t2w1lwt3 < t2w1l && t2w1lwt3 < t2h1u && t2w1lwt3 < t2h1d && t2w1lwt3 <t2w1rwt && t2w1lwt3 <t2w1lwt && t2w1lwt3 < t2h1uwt && t2w1lwt3 < t2h1dwt
  && t2w1lwt3 < t2w1r1 && t2w1lwt3 < t2w1l1 && t2w1lwt3 < t2h1u1 && t2w1lwt3 < t2h1d1 && t2w1lwt3 <t2w1rwt1 && t2w1lwt3 <t2w1lwt1 && t2w1lwt3 < t2h1uwt1 && t2w1lwt3 < t2h1dwt1
  && t2w1lwt3 < t2w1r2 && t2w1lwt3 < t2w1l2 && t2w1lwt3 < t2h1u2 && t2w1lwt3 < t2h1d2 && t2w1lwt3 <t2w1rwt2 && t2w1lwt3 <t2w1lwt2 && t2w1lwt3 < t2h1uwt2 && t2w1lwt3 < t2h1dwt2
  && t2w1lwt3 < t2w1r3 && t2w1lwt3 < t2w1l3 && t2w1lwt3 < t2h1u3 && t2w1lwt3 < t2h1d3 && t2w1lwt3 <t2w1rwt3 && t2w1lwt3 < t2h1uwt3 && t2w1lwt3 < t2h1dwt3
  && t2w1lwt3 < t2w1r4 && t2w1lwt3 < t2w1l4 && t2w1lwt3 < t2h1u4 && t2w1lwt3 < t2h1d4 && t2w1lwt3 <t2w1rwt4 && t2w1lwt3 <t2w1lwt4 && t2w1lwt3 < t2h1uwt4 && t2w1lwt3 < t2h1dwt4
  && t2w1lwt3 < t2w1r5 && t2w1lwt3 < t2w1l5 && t2w1lwt3 < t2h1u5 && t2w1lwt3 < t2h1d5 && t2w1lwt3 <t2w1rwt5 && t2w1lwt3 <t2w1lwt5 && t2w1lwt3 < t2h1uwt5 && t2w1lwt3 < t2h1dwt5
  && t2w1lwt3 < t2w1r6 && t2w1lwt3 < t2w1l6 && t2w1lwt3 < t2h1u6 && t2w1lwt3 < t2h1d6 && t2w1lwt3 <t2w1rwt6 && t2w1lwt3 <t2w1lwt6 && t2w1lwt3 < t2h1uwt6 && t2w1lwt3 < t2h1dwt6
  && t2w1lwt3 < t2w1r7 && t2w1lwt3 < t2w1l7 && t2w1lwt3 < t2h1u7 && t2w1lwt3 < t2h1d7 && t2w1lwt3 <t2w1rwt7 && t2w1lwt3 <t2w1lwt7 && t2w1lwt3 < t2h1uwt7 && t2w1lwt3 < t2h1dwt7
  && t2w1lwt3 < t2w1r8 && t2w1lwt3 < t2w1l8 && t2w1lwt3 < t2h1u8 && t2w1lwt3 < t2h1d8 && t2w1lwt3 <t2w1rwt8 && t2w1lwt3 <t2w1lwt8 && t2w1lwt3 < t2h1uwt8 && t2w1lwt3 < t2h1dwt8
  && t2w1lwt3 < t2w1r9 && t2w1lwt3 < t2w1l9 && t2w1lwt3 < t2h1u9 && t2w1lwt3 < t2h1d9 && t2w1lwt3 <t2w1rwt9 && t2w1lwt3 <t2w1lwt9 && t2w1lwt3 < t2h1uwt9 && t2w1lwt3 < t2h1dwt9
  && t2w1lwt3 < t2w1r10 && t2w1lwt3 < t2w1l10 && t2w1lwt3 < t2h1u10 && t2w1lwt3 < t2h1d10 && t2w1lwt3 <t2w1rwt10 && t2w1lwt3 <t2w1lwt10 && t2w1lwt3 < t2h1uwt10 && t2w1lwt3 < t2h1dwt10
  && (loutwl3==0 && linwl3==0)){
  if(linhd3==0 && louthd3==0)
   {
      ylimitd=(-h2d3+h1d3)/l*(vz*t2w1lwt3+z)-h1dwt3;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ylimitd=-bhdwt3*sqrt(1-((z0hd3+(vz*t2w1lwt3+z))*(z0hd3+(vz*t2w1lwt3+z)))/a2hdwt3);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt3+z)-pbhdwt3)/-pahdwt3);
      }
   }
   if(linhu3==0 && louthu3==0)
    {
     ylimitu=(h2u3-h1u3)/l*(vz*t2w1lwt3+z)+h1uwt3;
    }else{
     if(linhu3!=0 && louthu3!=0)
     {
     ylimitu=bhuwt3*sqrt(1-((z0hu3+(vz*t2w1lwt3+z))*(z0hu3+(vz*t2w1lwt3+z)))/a2huwt3);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt3+z)-pbhuwt3)/-pahuwt3);
    }
    }
  ytest=vy*t2w1lwt3+y; 
  xtest=vx*t2w1lwt3+x;
  xlimitl=(w2l3-w1l3)*(vz*t2w1lwt3+z)/l+w1lwt3;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW3>0){
  i=147;
  }else{
  i=155;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW3!=-1 && t2h1uwt3 > 0 && t2h1uwt3 < t1 
  && t2h1uwt3 < t2w1r && t2h1uwt3 < t2w1l && t2h1uwt3 < t2h1u && t2h1uwt3 < t2h1d && t2h1uwt3 < t2w1rwt && t2h1uwt3 < t2w1lwt && t2h1uwt3 < t2h1uwt && t2h1uwt3 < t2h1dwt 
  && t2h1uwt3 < t2w1r1 && t2h1uwt3 < t2w1l1 && t2h1uwt3 < t2h1u1 && t2h1uwt3 < t2h1d1 && t2h1uwt3 < t2w1rwt1 && t2h1uwt3 < t2w1lwt1 && t2h1uwt3 < t2h1uwt1 && t2h1uwt3 < t2h1dwt1
  && t2h1uwt3 < t2w1r2 && t2h1uwt3 < t2w1l2 && t2h1uwt3 < t2h1u2 && t2h1uwt3 < t2h1d2 && t2h1uwt3 < t2w1rwt2 && t2h1uwt3 < t2w1lwt2 && t2h1uwt3 < t2h1uwt2 && t2h1uwt3 < t2h1dwt2
  && t2h1uwt3 < t2w1r3 && t2h1uwt3 < t2w1l3 && t2h1uwt3 < t2h1u3 && t2h1uwt3 < t2h1d3 && t2h1uwt3 < t2w1rwt3 && t2h1uwt3 < t2w1lwt3 && t2h1uwt3 < t2h1dwt3
  && t2h1uwt3 < t2w1r4 && t2h1uwt3 < t2w1l4 && t2h1uwt3 < t2h1u4 && t2h1uwt3 < t2h1d4 && t2h1uwt3 < t2w1rwt4 && t2h1uwt3 < t2w1lwt4 && t2h1uwt3 < t2h1uwt4 && t2h1uwt3 < t2h1dwt4
  && t2h1uwt3 < t2w1r5 && t2h1uwt3 < t2w1l5 && t2h1uwt3 < t2h1u5 && t2h1uwt3 < t2h1d5 && t2h1uwt3 < t2w1rwt5 && t2h1uwt3 < t2w1lwt5 && t2h1uwt3 < t2h1uwt5 && t2h1uwt3 < t2h1dwt5
  && t2h1uwt3 < t2w1r6 && t2h1uwt3 < t2w1l6 && t2h1uwt3 < t2h1u6 && t2h1uwt3 < t2h1d6 && t2h1uwt3 < t2w1rwt6 && t2h1uwt3 < t2w1lwt6 && t2h1uwt3 < t2h1uwt6 && t2h1uwt3 < t2h1dwt6
  && t2h1uwt3 < t2w1r7 && t2h1uwt3 < t2w1l7 && t2h1uwt3 < t2h1u7 && t2h1uwt3 < t2h1d7 && t2h1uwt3 < t2w1rwt7 && t2h1uwt3 < t2w1lwt7 && t2h1uwt3 < t2h1uwt7 && t2h1uwt3 < t2h1dwt7
  && t2h1uwt3 < t2w1r8 && t2h1uwt3 < t2w1l8 && t2h1uwt3 < t2h1u8 && t2h1uwt3 < t2h1d8 && t2h1uwt3 < t2w1rwt8 && t2h1uwt3 < t2w1lwt8 && t2h1uwt3 < t2h1uwt8 && t2h1uwt3 < t2h1dwt8
  && t2h1uwt3 < t2w1r9 && t2h1uwt3 < t2w1l9 && t2h1uwt3 < t2h1u9 && t2h1uwt3 < t2h1d9 && t2h1uwt3 < t2w1rwt9 && t2h1uwt3 < t2w1lwt9 && t2h1uwt3 < t2h1uwt9 && t2h1uwt3 < t2h1dwt9
  && t2h1uwt3 < t2w1r10 && t2h1uwt3 < t2w1l10 && t2h1uwt3 < t2h1u10 && t2h1uwt3 < t2h1d10 && t2h1uwt3 < t2w1rwt10 && t2h1uwt3 < t2w1lwt10 && t2h1uwt3 < t2h1uwt10 && t2h1uwt3 < t2h1dwt10
  && (louthu3 !=0 && linhu3!=0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1uwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1uwt3+z))*(z0wr3+(vz*t2h1uwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1uwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1uwt3+z))*(z0wl3+(vz*t2h1uwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1uwt3+x;
  ytest=vy*t2w1lwt3+y;
  ylimitu=bhuwt3*sqrt(1-((vz*t2h1uwt3+z)+z0hu3)*((vz*t2h1uwt3+z)+z0hu3)/a2huwt3);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW3>0 ){
  i=148;
  }else{
  i=156;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW3!=-1 && t2h1uwt3 > 0 && t2h1uwt3 < t1 
  && t2h1uwt3 < t2w1r && t2h1uwt3 < t2w1l && t2h1uwt3 < t2h1u && t2h1uwt3 < t2h1d && t2h1uwt3 < t2w1rwt && t2h1uwt3 < t2w1lwt && t2h1uwt3 < t2h1uwt && t2h1uwt3 < t2h1dwt 
  && t2h1uwt3 < t2w1r1 && t2h1uwt3 < t2w1l1 && t2h1uwt3 < t2h1u1 && t2h1uwt3 < t2h1d1 && t2h1uwt3 < t2w1rwt1 && t2h1uwt3 < t2w1lwt1 && t2h1uwt3 < t2h1uwt1 && t2h1uwt3 < t2h1dwt1
  && t2h1uwt3 < t2w1r2 && t2h1uwt3 < t2w1l2 && t2h1uwt3 < t2h1u2 && t2h1uwt3 < t2h1d2 && t2h1uwt3 < t2w1rwt2 && t2h1uwt3 < t2w1lwt2 && t2h1uwt3 < t2h1uwt2 && t2h1uwt3 < t2h1dwt2
  && t2h1uwt3 < t2w1r3 && t2h1uwt3 < t2w1l3 && t2h1uwt3 < t2h1u3 && t2h1uwt3 < t2h1d3 && t2h1uwt3 < t2w1rwt3 && t2h1uwt3 < t2w1lwt3 && t2h1uwt3 < t2h1dwt3
  && t2h1uwt3 < t2w1r4 && t2h1uwt3 < t2w1l4 && t2h1uwt3 < t2h1u4 && t2h1uwt3 < t2h1d4 && t2h1uwt3 < t2w1rwt4 && t2h1uwt3 < t2w1lwt4 && t2h1uwt3 < t2h1uwt4 && t2h1uwt3 < t2h1dwt4
  && t2h1uwt3 < t2w1r5 && t2h1uwt3 < t2w1l5 && t2h1uwt3 < t2h1u5 && t2h1uwt3 < t2h1d5 && t2h1uwt3 < t2w1rwt5 && t2h1uwt3 < t2w1lwt5 && t2h1uwt3 < t2h1uwt5 && t2h1uwt3 < t2h1dwt5
  && t2h1uwt3 < t2w1r6 && t2h1uwt3 < t2w1l6 && t2h1uwt3 < t2h1u6 && t2h1uwt3 < t2h1d6 && t2h1uwt3 < t2w1rwt6 && t2h1uwt3 < t2w1lwt6 && t2h1uwt3 < t2h1uwt6 && t2h1uwt3 < t2h1dwt6
  && t2h1uwt3 < t2w1r7 && t2h1uwt3 < t2w1l7 && t2h1uwt3 < t2h1u7 && t2h1uwt3 < t2h1d7 && t2h1uwt3 < t2w1rwt7 && t2h1uwt3 < t2w1lwt7 && t2h1uwt3 < t2h1uwt7 && t2h1uwt3 < t2h1dwt7
  && t2h1uwt3 < t2w1r8 && t2h1uwt3 < t2w1l8 && t2h1uwt3 < t2h1u8 && t2h1uwt3 < t2h1d8 && t2h1uwt3 < t2w1rwt8 && t2h1uwt3 < t2w1lwt8 && t2h1uwt3 < t2h1uwt8 && t2h1uwt3 < t2h1dwt8
  && t2h1uwt3 < t2w1r9 && t2h1uwt3 < t2w1l9 && t2h1uwt3 < t2h1u9 && t2h1uwt3 < t2h1d9 && t2h1uwt3 < t2w1rwt9 && t2h1uwt3 < t2w1lwt9 && t2h1uwt3 < t2h1uwt9 && t2h1uwt3 < t2h1dwt9
  && t2h1uwt3 < t2w1r10 && t2h1uwt3 < t2w1l10 && t2h1uwt3 < t2h1u10 && t2h1uwt3 < t2h1d10 && t2h1uwt3 < t2w1rwt10 && t2h1uwt3 < t2w1lwt10 && t2h1uwt3 < t2h1uwt10 && t2h1uwt3 < t2h1dwt10
  && ((louthu3!=0 && linhu3==0) || (louthu3==0 && linhu3!=0))){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1uwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1uwt3+z))*(z0wr3+(vz*t2h1uwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1uwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1uwt3+z))*(z0wl3+(vz*t2h1uwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1uwt3+x;
  ytest=vy*t2w1lwt3+y;
  ylimitu=sqrt((pbhuwt3-(vz*t2h1uwt3+z))/pahuwt3);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW3>0){
  i=149;
  }else{
  i=156;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW3!=-1 && t2h1uwt3 > 0 && t2h1uwt3 < t1 
  && t2h1uwt3 < t2w1r && t2h1uwt3 < t2w1l && t2h1uwt3 < t2h1u && t2h1uwt3 < t2h1d && t2h1uwt3 < t2w1rwt && t2h1uwt3 < t2w1lwt && t2h1uwt3 < t2h1uwt && t2h1uwt3 < t2h1dwt 
  && t2h1uwt3 < t2w1r1 && t2h1uwt3 < t2w1l1 && t2h1uwt3 < t2h1u1 && t2h1uwt3 < t2h1d1 && t2h1uwt3 < t2w1rwt1 && t2h1uwt3 < t2w1lwt1 && t2h1uwt3 < t2h1uwt1 && t2h1uwt3 < t2h1dwt1
  && t2h1uwt3 < t2w1r2 && t2h1uwt3 < t2w1l2 && t2h1uwt3 < t2h1u2 && t2h1uwt3 < t2h1d2 && t2h1uwt3 < t2w1rwt2 && t2h1uwt3 < t2w1lwt2 && t2h1uwt3 < t2h1uwt2 && t2h1uwt3 < t2h1dwt2
  && t2h1uwt3 < t2w1r3 && t2h1uwt3 < t2w1l3 && t2h1uwt3 < t2h1u3 && t2h1uwt3 < t2h1d3 && t2h1uwt3 < t2w1rwt3 && t2h1uwt3 < t2w1lwt3 && t2h1uwt3 < t2h1dwt3
  && t2h1uwt3 < t2w1r4 && t2h1uwt3 < t2w1l4 && t2h1uwt3 < t2h1u4 && t2h1uwt3 < t2h1d4 && t2h1uwt3 < t2w1rwt4 && t2h1uwt3 < t2w1lwt4 && t2h1uwt3 < t2h1uwt4 && t2h1uwt3 < t2h1dwt4
  && t2h1uwt3 < t2w1r5 && t2h1uwt3 < t2w1l5 && t2h1uwt3 < t2h1u5 && t2h1uwt3 < t2h1d5 && t2h1uwt3 < t2w1rwt5 && t2h1uwt3 < t2w1lwt5 && t2h1uwt3 < t2h1uwt5 && t2h1uwt3 < t2h1dwt5
  && t2h1uwt3 < t2w1r6 && t2h1uwt3 < t2w1l6 && t2h1uwt3 < t2h1u6 && t2h1uwt3 < t2h1d6 && t2h1uwt3 < t2w1rwt6 && t2h1uwt3 < t2w1lwt6 && t2h1uwt3 < t2h1uwt6 && t2h1uwt3 < t2h1dwt6
  && t2h1uwt3 < t2w1r7 && t2h1uwt3 < t2w1l7 && t2h1uwt3 < t2h1u7 && t2h1uwt3 < t2h1d7 && t2h1uwt3 < t2w1rwt7 && t2h1uwt3 < t2w1lwt7 && t2h1uwt3 < t2h1uwt7 && t2h1uwt3 < t2h1dwt7
  && t2h1uwt3 < t2w1r8 && t2h1uwt3 < t2w1l8 && t2h1uwt3 < t2h1u8 && t2h1uwt3 < t2h1d8 && t2h1uwt3 < t2w1rwt8 && t2h1uwt3 < t2w1lwt8 && t2h1uwt3 < t2h1uwt8 && t2h1uwt3 < t2h1dwt8
  && t2h1uwt3 < t2w1r9 && t2h1uwt3 < t2w1l9 && t2h1uwt3 < t2h1u9 && t2h1uwt3 < t2h1d9 && t2h1uwt3 < t2w1rwt9 && t2h1uwt3 < t2w1lwt9 && t2h1uwt3 < t2h1uwt9 && t2h1uwt3 < t2h1dwt9
  && t2h1uwt3 < t2w1r10 && t2h1uwt3 < t2w1l10 && t2h1uwt3 < t2h1u10 && t2h1uwt3 < t2h1d10 && t2h1uwt3 < t2w1rwt10 && t2h1uwt3 < t2w1lwt10 && t2h1uwt3 < t2h1uwt10 && t2h1uwt3 < t2h1dwt10
  && (louthu3 == 0 && linhu3 == 0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1uwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1uwt3+z))*(z0wr3+(vz*t2h1uwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1uwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1uwt3+z))*(z0wl3+(vz*t2h1uwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1uwt3+x;
  ytest=vy*t2w1lwt3+y;
  ylimitu=(h2u3-h1u3)*(vz*t2h1uwt3+z)/l+h1uwt3;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW3>0 ){
  i=150;
  }else{
  i=156;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW3!=-1 && t2h1dwt3 > 0 && t2h1dwt3 < t1 
  && t2h1dwt3 < t2w1r && t2h1dwt3 < t2w1l && t2h1dwt3 < t2h1u && t2h1dwt3 < t2h1d && t2h1dwt3 < t2w1rwt && t2h1dwt3 < t2w1lwt && t2h1dwt3 < t2h1uwt && t2h1dwt3 < t2h1dwt 
  && t2h1dwt3 < t2w1r1 && t2h1dwt3 < t2w1l1 && t2h1dwt3 < t2h1u1 && t2h1dwt3 < t2h1d1 && t2h1dwt3 < t2w1rwt1 && t2h1dwt3 < t2w1lwt1 && t2h1dwt3 < t2h1uwt1 && t2h1dwt3 < t2h1dwt1
  && t2h1dwt3 < t2w1r2 && t2h1dwt3 < t2w1l2 && t2h1dwt3 < t2h1u2 && t2h1dwt3 < t2h1d2 && t2h1dwt3 < t2w1rwt2 && t2h1dwt3 < t2w1lwt2 && t2h1dwt3 < t2h1uwt2 && t2h1dwt3 < t2h1dwt2 
  && t2h1dwt3 < t2w1r3 && t2h1dwt3 < t2w1l3 && t2h1dwt3 < t2h1u3 && t2h1dwt3 < t2h1d3 && t2h1dwt3 < t2w1rwt3 && t2h1dwt3 < t2w1lwt3 && t2h1dwt3 < t2h1uwt3 
  && t2h1dwt3 < t2w1r4 && t2h1dwt3 < t2w1l4 && t2h1dwt3 < t2h1u4 && t2h1dwt3 < t2h1d4 && t2h1dwt3 < t2w1rwt4 && t2h1dwt3 < t2w1lwt4 && t2h1dwt3 < t2h1uwt4 && t2h1dwt3 < t2h1dwt4
  && t2h1dwt3 < t2w1r5 && t2h1dwt3 < t2w1l5 && t2h1dwt3 < t2h1u5 && t2h1dwt3 < t2h1d5 && t2h1dwt3 < t2w1rwt5 && t2h1dwt3 < t2w1lwt5 && t2h1dwt3 < t2h1uwt5 && t2h1dwt3 < t2h1dwt5
  && t2h1dwt3 < t2w1r6 && t2h1dwt3 < t2w1l6 && t2h1dwt3 < t2h1u6 && t2h1dwt3 < t2h1d6 && t2h1dwt3 < t2w1rwt6 && t2h1dwt3 < t2w1lwt6 && t2h1dwt3 < t2h1uwt6 && t2h1dwt3 < t2h1dwt6
  && t2h1dwt3 < t2w1r7 && t2h1dwt3 < t2w1l7 && t2h1dwt3 < t2h1u7 && t2h1dwt3 < t2h1d7 && t2h1dwt3 < t2w1rwt7 && t2h1dwt3 < t2w1lwt7 && t2h1dwt3 < t2h1uwt7 && t2h1dwt3 < t2h1dwt7 
  && t2h1dwt3 < t2w1r8 && t2h1dwt3 < t2w1l8 && t2h1dwt3 < t2h1u8 && t2h1dwt3 < t2h1d8 && t2h1dwt3 < t2w1rwt8 && t2h1dwt3 < t2w1lwt8 && t2h1dwt3 < t2h1uwt8 && t2h1dwt3 < t2h1dwt8
  && t2h1dwt3 < t2w1r9 && t2h1dwt3 < t2w1l9 && t2h1dwt3 < t2h1u9 && t2h1dwt3 < t2h1d9 && t2h1dwt3 < t2w1rwt9 && t2h1dwt3 < t2w1lwt9 && t2h1dwt3 < t2h1uwt9 && t2h1dwt3 < t2h1dwt9 
  && t2h1dwt3 < t2w1r10 && t2h1dwt3 < t2w1l10 && t2h1dwt3 < t2h1u10 && t2h1dwt3 < t2h1d10 && t2h1dwt3 < t2w1rwt10 && t2h1dwt3 < t2w1lwt10 && t2h1dwt3 < t2h1uwt10 && t2h1dwt3 < t2h1dwt10  
  && (louthd3 !=0 && linhd3!=0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1dwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1dwt3+z))*(z0wr3+(vz*t2h1dwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1dwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1dwt3+z))*(z0wl3+(vz*t2h1dwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1dwt3+x;
  ytest=vy*t2w1lwt3+y;
  ylimitd=-bhdwt3*sqrt(1-((vz*t2h1dwt3+z)+z0hd3)*((vz*t2h1dwt3+z)+z0hd3)/a2hdwt3);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW3>0){
  i=151;
  }else{
  i=157;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW3!=-1 && t2h1dwt3 > 0 && t2h1dwt3 < t1 
  && t2h1dwt3 < t2w1r && t2h1dwt3 < t2w1l && t2h1dwt3 < t2h1u && t2h1dwt3 < t2h1d && t2h1dwt3 < t2w1rwt && t2h1dwt3 < t2w1lwt && t2h1dwt3 < t2h1uwt && t2h1dwt3 < t2h1dwt 
  && t2h1dwt3 < t2w1r1 && t2h1dwt3 < t2w1l1 && t2h1dwt3 < t2h1u1 && t2h1dwt3 < t2h1d1 && t2h1dwt3 < t2w1rwt1 && t2h1dwt3 < t2w1lwt1 && t2h1dwt3 < t2h1uwt1 && t2h1dwt3 < t2h1dwt1
  && t2h1dwt3 < t2w1r2 && t2h1dwt3 < t2w1l2 && t2h1dwt3 < t2h1u2 && t2h1dwt3 < t2h1d2 && t2h1dwt3 < t2w1rwt2 && t2h1dwt3 < t2w1lwt2 && t2h1dwt3 < t2h1uwt2 && t2h1dwt3 < t2h1dwt2 
  && t2h1dwt3 < t2w1r3 && t2h1dwt3 < t2w1l3 && t2h1dwt3 < t2h1u3 && t2h1dwt3 < t2h1d3 && t2h1dwt3 < t2w1rwt3 && t2h1dwt3 < t2w1lwt3 && t2h1dwt3 < t2h1uwt3 
  && t2h1dwt3 < t2w1r4 && t2h1dwt3 < t2w1l4 && t2h1dwt3 < t2h1u4 && t2h1dwt3 < t2h1d4 && t2h1dwt3 < t2w1rwt4 && t2h1dwt3 < t2w1lwt4 && t2h1dwt3 < t2h1uwt4 && t2h1dwt3 < t2h1dwt4
  && t2h1dwt3 < t2w1r5 && t2h1dwt3 < t2w1l5 && t2h1dwt3 < t2h1u5 && t2h1dwt3 < t2h1d5 && t2h1dwt3 < t2w1rwt5 && t2h1dwt3 < t2w1lwt5 && t2h1dwt3 < t2h1uwt5 && t2h1dwt3 < t2h1dwt5
  && t2h1dwt3 < t2w1r6 && t2h1dwt3 < t2w1l6 && t2h1dwt3 < t2h1u6 && t2h1dwt3 < t2h1d6 && t2h1dwt3 < t2w1rwt6 && t2h1dwt3 < t2w1lwt6 && t2h1dwt3 < t2h1uwt6 && t2h1dwt3 < t2h1dwt6
  && t2h1dwt3 < t2w1r7 && t2h1dwt3 < t2w1l7 && t2h1dwt3 < t2h1u7 && t2h1dwt3 < t2h1d7 && t2h1dwt3 < t2w1rwt7 && t2h1dwt3 < t2w1lwt7 && t2h1dwt3 < t2h1uwt7 && t2h1dwt3 < t2h1dwt7 
  && t2h1dwt3 < t2w1r8 && t2h1dwt3 < t2w1l8 && t2h1dwt3 < t2h1u8 && t2h1dwt3 < t2h1d8 && t2h1dwt3 < t2w1rwt8 && t2h1dwt3 < t2w1lwt8 && t2h1dwt3 < t2h1uwt8 && t2h1dwt3 < t2h1dwt8
  && t2h1dwt3 < t2w1r9 && t2h1dwt3 < t2w1l9 && t2h1dwt3 < t2h1u9 && t2h1dwt3 < t2h1d9 && t2h1dwt3 < t2w1rwt9 && t2h1dwt3 < t2w1lwt9 && t2h1dwt3 < t2h1uwt9 && t2h1dwt3 < t2h1dwt9 
  && t2h1dwt3 < t2w1r10 && t2h1dwt3 < t2w1l10 && t2h1dwt3 < t2h1u10 && t2h1dwt3 < t2h1d10 && t2h1dwt3 < t2w1rwt10 && t2h1dwt3 < t2w1lwt10 && t2h1dwt3 < t2h1uwt10 && t2h1dwt3 < t2h1dwt10
  && ((louthd3 !=0 && linhd3==0) || (louthd3 ==0 && linhd3!=0))){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1dwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1dwt3+z))*(z0wr3+(vz*t2h1dwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
     xlimitl=(w2l3-w1l3)/l*(vz*t2h1dwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1dwt3+z))*(z0wl3+(vz*t2h1dwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1dwt3+x;
  ytest=vy*t2w1lwt3+y;
  ylimitd=-sqrt((pbhdwt3-(vz*t2h1dwt3+z))/pahdwt3);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW3>0 ){
  i=152;
  }else{
  i=157;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW3!=-1 && t2h1dwt3 > 0 && t2h1dwt3 < t1 
  && t2h1dwt3 < t2w1r && t2h1dwt3 < t2w1l && t2h1dwt3 < t2h1u && t2h1dwt3 < t2h1d && t2h1dwt3 < t2w1rwt && t2h1dwt3 < t2w1lwt && t2h1dwt3 < t2h1uwt && t2h1dwt3 < t2h1dwt 
  && t2h1dwt3 < t2w1r1 && t2h1dwt3 < t2w1l1 && t2h1dwt3 < t2h1u1 && t2h1dwt3 < t2h1d1 && t2h1dwt3 < t2w1rwt1 && t2h1dwt3 < t2w1lwt1 && t2h1dwt3 < t2h1uwt1 && t2h1dwt3 < t2h1dwt1
  && t2h1dwt3 < t2w1r2 && t2h1dwt3 < t2w1l2 && t2h1dwt3 < t2h1u2 && t2h1dwt3 < t2h1d2 && t2h1dwt3 < t2w1rwt2 && t2h1dwt3 < t2w1lwt2 && t2h1dwt3 < t2h1uwt2 && t2h1dwt3 < t2h1dwt2 
  && t2h1dwt3 < t2w1r3 && t2h1dwt3 < t2w1l3 && t2h1dwt3 < t2h1u3 && t2h1dwt3 < t2h1d3 && t2h1dwt3 < t2w1rwt3 && t2h1dwt3 < t2w1lwt3 && t2h1dwt3 < t2h1uwt3 
  && t2h1dwt3 < t2w1r4 && t2h1dwt3 < t2w1l4 && t2h1dwt3 < t2h1u4 && t2h1dwt3 < t2h1d4 && t2h1dwt3 < t2w1rwt4 && t2h1dwt3 < t2w1lwt4 && t2h1dwt3 < t2h1uwt4 && t2h1dwt3 < t2h1dwt4
  && t2h1dwt3 < t2w1r5 && t2h1dwt3 < t2w1l5 && t2h1dwt3 < t2h1u5 && t2h1dwt3 < t2h1d5 && t2h1dwt3 < t2w1rwt5 && t2h1dwt3 < t2w1lwt5 && t2h1dwt3 < t2h1uwt5 && t2h1dwt3 < t2h1dwt5
  && t2h1dwt3 < t2w1r6 && t2h1dwt3 < t2w1l6 && t2h1dwt3 < t2h1u6 && t2h1dwt3 < t2h1d6 && t2h1dwt3 < t2w1rwt6 && t2h1dwt3 < t2w1lwt6 && t2h1dwt3 < t2h1uwt6 && t2h1dwt3 < t2h1dwt6
  && t2h1dwt3 < t2w1r7 && t2h1dwt3 < t2w1l7 && t2h1dwt3 < t2h1u7 && t2h1dwt3 < t2h1d7 && t2h1dwt3 < t2w1rwt7 && t2h1dwt3 < t2w1lwt7 && t2h1dwt3 < t2h1uwt7 && t2h1dwt3 < t2h1dwt7 
  && t2h1dwt3 < t2w1r8 && t2h1dwt3 < t2w1l8 && t2h1dwt3 < t2h1u8 && t2h1dwt3 < t2h1d8 && t2h1dwt3 < t2w1rwt8 && t2h1dwt3 < t2w1lwt8 && t2h1dwt3 < t2h1uwt8 && t2h1dwt3 < t2h1dwt8
  && t2h1dwt3 < t2w1r9 && t2h1dwt3 < t2w1l9 && t2h1dwt3 < t2h1u9 && t2h1dwt3 < t2h1d9 && t2h1dwt3 < t2w1rwt9 && t2h1dwt3 < t2w1lwt9 && t2h1dwt3 < t2h1uwt9 && t2h1dwt3 < t2h1dwt9 
  && t2h1dwt3 < t2w1r10 && t2h1dwt3 < t2w1l10 && t2h1dwt3 < t2h1u10 && t2h1dwt3 < t2h1d10 && t2h1dwt3 < t2w1rwt10 && t2h1dwt3 < t2w1lwt10 && t2h1dwt3 < t2h1uwt10 && t2h1dwt3 < t2h1dwt10
  && (louthd3 == 0 && linhd3 == 0)){
  if(linwr3==0 && loutwr3==0)
  {
    xlimitr=(-w2r3+w1r3)/l*(vz*t2h1dwt3+z)-w1rwt3;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xlimitr=-bwrwt3*sqrt(1-((z0wr3+(vz*t2h1dwt3+z))*(z0wr3+(vz*t2h1dwt3+z)))/a2wrwt3);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt3+z)-pbwrwt3)/-pawrwt3);
    }
  }
  if(linwl3==0 && loutwl3 == 0)
   {
      xlimitl=(w2l3-w1l3)/l*(vz*t2h1dwt3+z)+w1lwt3;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xlimitl=bwlwt3*sqrt(1-((z0wl3+(vz*t2h1dwt3+z))*(z0wl3+(vz*t2h1dwt3+z)))/a2wlwt3);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt3+z)-pbwlwt3)/-pawlwt3);
      }
   }
  xtest=vx*t2h1dwt3+x;
  ytest=vy*t2w1lwt3+y;
  ylimitd=(-h2d3+h1d3)*(vz*t2h1dwt3+z)/l-h1dwt3;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW3>0 ){
  i=153;
  }else{
  i=157;
  }
  }


  if (mxrOW3==-1 && t2w1rwt3 > 0 && t2w1rwt3 < t1 
  && t2w1rwt3 < t2w1r && t2w1rwt3 < t2w1l && t2w1rwt3 < t2h1u && t2w1rwt3 < t2h1d && t2w1rwt3 <t2w1rwt && t2w1rwt3 <t2w1lwt && t2w1rwt3 < t2h1uwt && t2w1rwt3 < t2h1dwt
  && t2w1rwt3 < t2w1r1 && t2w1rwt3 < t2w1l1 && t2w1rwt3 < t2h1u1 && t2w1rwt3 < t2h1d1 && t2w1rwt3 <t2w1rwt1 && t2w1rwt3 <t2w1lwt1 && t2w1rwt3 < t2h1uwt1 && t2w1rwt3 < t2h1dwt1
  && t2w1rwt3 < t2w1r2 && t2w1rwt3 < t2w1l2 && t2w1rwt3 < t2h1u2 && t2w1rwt3 < t2h1d2 && t2w1rwt3 <t2w1rwt2 && t2w1rwt3 <t2w1lwt2 && t2w1rwt3 < t2h1uwt2 && t2w1rwt3 < t2h1dwt2
  && t2w1rwt3 < t2w1r3 && t2w1rwt3 < t2w1l3 && t2w1rwt3 < t2h1u3 && t2w1rwt3 < t2h1d3 && t2w1rwt3 <t2w1lwt3 && t2w1rwt3 < t2h1uwt3 && t2w1rwt3 < t2h1dwt3
  && t2w1rwt3 < t2w1r4 && t2w1rwt3 < t2w1l4 && t2w1rwt3 < t2h1u4 && t2w1rwt3 < t2h1d4 && t2w1rwt3 <t2w1rwt4 && t2w1rwt3 <t2w1lwt4 && t2w1rwt3 < t2h1uwt4 && t2w1rwt3 < t2h1dwt4
  && t2w1rwt3 < t2w1r5 && t2w1rwt3 < t2w1l5 && t2w1rwt3 < t2h1u5 && t2w1rwt3 < t2h1d5 && t2w1rwt3 <t2w1rwt5 && t2w1rwt3 <t2w1lwt5 && t2w1rwt3 < t2h1uwt5 && t2w1rwt3 < t2h1dwt5
  && t2w1rwt3 < t2w1r6 && t2w1rwt3 < t2w1l6 && t2w1rwt3 < t2h1u6 && t2w1rwt3 < t2h1d6 && t2w1rwt3 <t2w1rwt6 && t2w1rwt3 <t2w1lwt6 && t2w1rwt3 < t2h1uwt6 && t2w1rwt3 < t2h1dwt6
  && t2w1rwt3 < t2w1r7 && t2w1rwt3 < t2w1l7 && t2w1rwt3 < t2h1u7 && t2w1rwt3 < t2h1d7 && t2w1rwt3 <t2w1rwt7 && t2w1rwt3 <t2w1lwt7 && t2w1rwt3 < t2h1uwt7 && t2w1rwt3 < t2h1dwt7
  && t2w1rwt3 < t2w1r8 && t2w1rwt3 < t2w1l8 && t2w1rwt3 < t2h1u8 && t2w1rwt3 < t2h1d8 && t2w1rwt3 <t2w1rwt8 && t2w1rwt3 <t2w1lwt8 && t2w1rwt3 < t2h1uwt8 && t2w1rwt3 < t2h1dwt8
  && t2w1rwt3 < t2w1r9 && t2w1rwt3 < t2w1l9 && t2w1rwt3 < t2h1u9 && t2w1rwt3 < t2h1d9 && t2w1rwt3 <t2w1rwt9 && t2w1rwt3 <t2w1lwt9 && t2w1rwt3 < t2h1uwt9 && t2w1rwt3 < t2h1dwt9
  && t2w1rwt3 < t2w1r10 && t2w1rwt3 < t2w1l10 && t2w1rwt3 < t2h1u10 && t2w1rwt3 < t2h1d10 && t2w1rwt3 <t2w1rwt10 && t2w1rwt3 <t2w1lwt10 && t2w1rwt3 < t2h1uwt10 && t2w1rwt3 < t2h1dwt10
  && ((linwr3!=0) && (loutwr3!=0) )){
  i=158;
  }

  if (mxrOW3==-1 && t2w1rwt3 > 0 && t2w1rwt3 < t1 
  && t2w1rwt3 < t2w1r && t2w1rwt3 < t2w1l && t2w1rwt3 < t2h1u && t2w1rwt3 < t2h1d && t2w1rwt3 <t2w1rwt && t2w1rwt3 <t2w1lwt && t2w1rwt3 < t2h1uwt && t2w1rwt3 < t2h1dwt
  && t2w1rwt3 < t2w1r1 && t2w1rwt3 < t2w1l1 && t2w1rwt3 < t2h1u1 && t2w1rwt3 < t2h1d1 && t2w1rwt3 <t2w1rwt1 && t2w1rwt3 <t2w1lwt1 && t2w1rwt3 < t2h1uwt1 && t2w1rwt3 < t2h1dwt1
  && t2w1rwt3 < t2w1r2 && t2w1rwt3 < t2w1l2 && t2w1rwt3 < t2h1u2 && t2w1rwt3 < t2h1d2 && t2w1rwt3 <t2w1rwt2 && t2w1rwt3 <t2w1lwt2 && t2w1rwt3 < t2h1uwt2 && t2w1rwt3 < t2h1dwt2
  && t2w1rwt3 < t2w1r3 && t2w1rwt3 < t2w1l3 && t2w1rwt3 < t2h1u3 && t2w1rwt3 < t2h1d3 && t2w1rwt3 <t2w1lwt3 && t2w1rwt3 < t2h1uwt3 && t2w1rwt3 < t2h1dwt3
  && t2w1rwt3 < t2w1r4 && t2w1rwt3 < t2w1l4 && t2w1rwt3 < t2h1u4 && t2w1rwt3 < t2h1d4 && t2w1rwt3 <t2w1rwt4 && t2w1rwt3 <t2w1lwt4 && t2w1rwt3 < t2h1uwt4 && t2w1rwt3 < t2h1dwt4
  && t2w1rwt3 < t2w1r5 && t2w1rwt3 < t2w1l5 && t2w1rwt3 < t2h1u5 && t2w1rwt3 < t2h1d5 && t2w1rwt3 <t2w1rwt5 && t2w1rwt3 <t2w1lwt5 && t2w1rwt3 < t2h1uwt5 && t2w1rwt3 < t2h1dwt5
  && t2w1rwt3 < t2w1r6 && t2w1rwt3 < t2w1l6 && t2w1rwt3 < t2h1u6 && t2w1rwt3 < t2h1d6 && t2w1rwt3 <t2w1rwt6 && t2w1rwt3 <t2w1lwt6 && t2w1rwt3 < t2h1uwt6 && t2w1rwt3 < t2h1dwt6
  && t2w1rwt3 < t2w1r7 && t2w1rwt3 < t2w1l7 && t2w1rwt3 < t2h1u7 && t2w1rwt3 < t2h1d7 && t2w1rwt3 <t2w1rwt7 && t2w1rwt3 <t2w1lwt7 && t2w1rwt3 < t2h1uwt7 && t2w1rwt3 < t2h1dwt7
  && t2w1rwt3 < t2w1r8 && t2w1rwt3 < t2w1l8 && t2w1rwt3 < t2h1u8 && t2w1rwt3 < t2h1d8 && t2w1rwt3 <t2w1rwt8 && t2w1rwt3 <t2w1lwt8 && t2w1rwt3 < t2h1uwt8 && t2w1rwt3 < t2h1dwt8
  && t2w1rwt3 < t2w1r9 && t2w1rwt3 < t2w1l9 && t2w1rwt3 < t2h1u9 && t2w1rwt3 < t2h1d9 && t2w1rwt3 <t2w1rwt9 && t2w1rwt3 <t2w1lwt9 && t2w1rwt3 < t2h1uwt9 && t2w1rwt3 < t2h1dwt9
  && t2w1rwt3 < t2w1r10 && t2w1rwt3 < t2w1l10 && t2w1rwt3 < t2h1u10 && t2w1rwt3 < t2h1d10 && t2w1rwt3 <t2w1rwt10 && t2w1rwt3 <t2w1lwt10 && t2w1rwt3 < t2h1uwt10 && t2w1rwt3 < t2h1dwt10
  && ((loutwr3!=0 && linwr3==0) || (loutwr3==0 && linwr3!=0))){
  i=158;
  }

  if (mxrOW3==-1 && t2w1rwt3 > 0 && t2w1rwt3 < t1 
  && t2w1rwt3 < t2w1r && t2w1rwt3 < t2w1l && t2w1rwt3 < t2h1u && t2w1rwt3 < t2h1d && t2w1rwt3 <t2w1rwt && t2w1rwt3 <t2w1lwt && t2w1rwt3 < t2h1uwt && t2w1rwt3 < t2h1dwt
  && t2w1rwt3 < t2w1r1 && t2w1rwt3 < t2w1l1 && t2w1rwt3 < t2h1u1 && t2w1rwt3 < t2h1d1 && t2w1rwt3 <t2w1rwt1 && t2w1rwt3 <t2w1lwt1 && t2w1rwt3 < t2h1uwt1 && t2w1rwt3 < t2h1dwt1
  && t2w1rwt3 < t2w1r2 && t2w1rwt3 < t2w1l2 && t2w1rwt3 < t2h1u2 && t2w1rwt3 < t2h1d2 && t2w1rwt3 <t2w1rwt2 && t2w1rwt3 <t2w1lwt2 && t2w1rwt3 < t2h1uwt2 && t2w1rwt3 < t2h1dwt2
  && t2w1rwt3 < t2w1r3 && t2w1rwt3 < t2w1l3 && t2w1rwt3 < t2h1u3 && t2w1rwt3 < t2h1d3 && t2w1rwt3 <t2w1lwt3 && t2w1rwt3 < t2h1uwt3 && t2w1rwt3 < t2h1dwt3
  && t2w1rwt3 < t2w1r4 && t2w1rwt3 < t2w1l4 && t2w1rwt3 < t2h1u4 && t2w1rwt3 < t2h1d4 && t2w1rwt3 <t2w1rwt4 && t2w1rwt3 <t2w1lwt4 && t2w1rwt3 < t2h1uwt4 && t2w1rwt3 < t2h1dwt4
  && t2w1rwt3 < t2w1r5 && t2w1rwt3 < t2w1l5 && t2w1rwt3 < t2h1u5 && t2w1rwt3 < t2h1d5 && t2w1rwt3 <t2w1rwt5 && t2w1rwt3 <t2w1lwt5 && t2w1rwt3 < t2h1uwt5 && t2w1rwt3 < t2h1dwt5
  && t2w1rwt3 < t2w1r6 && t2w1rwt3 < t2w1l6 && t2w1rwt3 < t2h1u6 && t2w1rwt3 < t2h1d6 && t2w1rwt3 <t2w1rwt6 && t2w1rwt3 <t2w1lwt6 && t2w1rwt3 < t2h1uwt6 && t2w1rwt3 < t2h1dwt6
  && t2w1rwt3 < t2w1r7 && t2w1rwt3 < t2w1l7 && t2w1rwt3 < t2h1u7 && t2w1rwt3 < t2h1d7 && t2w1rwt3 <t2w1rwt7 && t2w1rwt3 <t2w1lwt7 && t2w1rwt3 < t2h1uwt7 && t2w1rwt3 < t2h1dwt7
  && t2w1rwt3 < t2w1r8 && t2w1rwt3 < t2w1l8 && t2w1rwt3 < t2h1u8 && t2w1rwt3 < t2h1d8 && t2w1rwt3 <t2w1rwt8 && t2w1rwt3 <t2w1lwt8 && t2w1rwt3 < t2h1uwt8 && t2w1rwt3 < t2h1dwt8
  && t2w1rwt3 < t2w1r9 && t2w1rwt3 < t2w1l9 && t2w1rwt3 < t2h1u9 && t2w1rwt3 < t2h1d9 && t2w1rwt3 <t2w1rwt9 && t2w1rwt3 <t2w1lwt9 && t2w1rwt3 < t2h1uwt9 && t2w1rwt3 < t2h1dwt9
  && t2w1rwt3 < t2w1r10 && t2w1rwt3 < t2w1l10 && t2w1rwt3 < t2h1u10 && t2w1rwt3 < t2h1d10 && t2w1rwt3 <t2w1rwt10 && t2w1rwt3 <t2w1lwt10 && t2w1rwt3 < t2h1uwt10 && t2w1rwt3 < t2h1dwt10
  && (loutwr3==0 && linwr3==0)){
  i=158;
  }

  if (mxlOW3==-1 && t2w1lwt3 > 0 && t2w1lwt3 < t1 
  && t2w1lwt3 < t2w1r && t2w1lwt3 < t2w1l && t2w1lwt3 < t2h1u && t2w1lwt3 < t2h1d && t2w1lwt3 <t2w1rwt && t2w1lwt3 <t2w1lwt && t2w1lwt3 < t2h1uwt && t2w1lwt3 < t2h1dwt
  && t2w1lwt3 < t2w1r1 && t2w1lwt3 < t2w1l1 && t2w1lwt3 < t2h1u1 && t2w1lwt3 < t2h1d1 && t2w1lwt3 <t2w1rwt1 && t2w1lwt3 <t2w1lwt1 && t2w1lwt3 < t2h1uwt1 && t2w1lwt3 < t2h1dwt1
  && t2w1lwt3 < t2w1r2 && t2w1lwt3 < t2w1l2 && t2w1lwt3 < t2h1u2 && t2w1lwt3 < t2h1d2 && t2w1lwt3 <t2w1rwt2 && t2w1lwt3 <t2w1lwt2 && t2w1lwt3 < t2h1uwt2 && t2w1lwt3 < t2h1dwt2
  && t2w1lwt3 < t2w1r3 && t2w1lwt3 < t2w1l3 && t2w1lwt3 < t2h1u3 && t2w1lwt3 < t2h1d3 && t2w1lwt3 <t2w1rwt3 && t2w1lwt3 < t2h1uwt3 && t2w1lwt3 < t2h1dwt3
  && t2w1lwt3 < t2w1r4 && t2w1lwt3 < t2w1l4 && t2w1lwt3 < t2h1u4 && t2w1lwt3 < t2h1d4 && t2w1lwt3 <t2w1rwt4 && t2w1lwt3 <t2w1lwt4 && t2w1lwt3 < t2h1uwt4 && t2w1lwt3 < t2h1dwt4
  && t2w1lwt3 < t2w1r5 && t2w1lwt3 < t2w1l5 && t2w1lwt3 < t2h1u5 && t2w1lwt3 < t2h1d5 && t2w1lwt3 <t2w1rwt5 && t2w1lwt3 <t2w1lwt5 && t2w1lwt3 < t2h1uwt5 && t2w1lwt3 < t2h1dwt5
  && t2w1lwt3 < t2w1r6 && t2w1lwt3 < t2w1l6 && t2w1lwt3 < t2h1u6 && t2w1lwt3 < t2h1d6 && t2w1lwt3 <t2w1rwt6 && t2w1lwt3 <t2w1lwt6 && t2w1lwt3 < t2h1uwt6 && t2w1lwt3 < t2h1dwt6
  && t2w1lwt3 < t2w1r7 && t2w1lwt3 < t2w1l7 && t2w1lwt3 < t2h1u7 && t2w1lwt3 < t2h1d7 && t2w1lwt3 <t2w1rwt7 && t2w1lwt3 <t2w1lwt7 && t2w1lwt3 < t2h1uwt7 && t2w1lwt3 < t2h1dwt7
  && t2w1lwt3 < t2w1r8 && t2w1lwt3 < t2w1l8 && t2w1lwt3 < t2h1u8 && t2w1lwt3 < t2h1d8 && t2w1lwt3 <t2w1rwt8 && t2w1lwt3 <t2w1lwt8 && t2w1lwt3 < t2h1uwt8 && t2w1lwt3 < t2h1dwt8
  && t2w1lwt3 < t2w1r9 && t2w1lwt3 < t2w1l9 && t2w1lwt3 < t2h1u9 && t2w1lwt3 < t2h1d9 && t2w1lwt3 <t2w1rwt9 && t2w1lwt3 <t2w1lwt9 && t2w1lwt3 < t2h1uwt9 && t2w1lwt3 < t2h1dwt9
  && t2w1lwt3 < t2w1r10 && t2w1lwt3 < t2w1l10 && t2w1lwt3 < t2h1u10 && t2w1lwt3 < t2h1d10 && t2w1lwt3 <t2w1rwt10 && t2w1lwt3 <t2w1lwt10 && t2w1lwt3 < t2h1uwt10 && t2w1lwt3 < t2h1dwt10
  && ((linwl3!=0) && (loutwl3!=0) )){
  i=159;
  }

  if (mxlOW3==-1 && t2w1lwt3 > 0 && t2w1lwt3 < t1 
  && t2w1lwt3 < t2w1r && t2w1lwt3 < t2w1l && t2w1lwt3 < t2h1u && t2w1lwt3 < t2h1d && t2w1lwt3 <t2w1rwt && t2w1lwt3 <t2w1lwt && t2w1lwt3 < t2h1uwt && t2w1lwt3 < t2h1dwt
  && t2w1lwt3 < t2w1r1 && t2w1lwt3 < t2w1l1 && t2w1lwt3 < t2h1u1 && t2w1lwt3 < t2h1d1 && t2w1lwt3 <t2w1rwt1 && t2w1lwt3 <t2w1lwt1 && t2w1lwt3 < t2h1uwt1 && t2w1lwt3 < t2h1dwt1
  && t2w1lwt3 < t2w1r2 && t2w1lwt3 < t2w1l2 && t2w1lwt3 < t2h1u2 && t2w1lwt3 < t2h1d2 && t2w1lwt3 <t2w1rwt2 && t2w1lwt3 <t2w1lwt2 && t2w1lwt3 < t2h1uwt2 && t2w1lwt3 < t2h1dwt2
  && t2w1lwt3 < t2w1r3 && t2w1lwt3 < t2w1l3 && t2w1lwt3 < t2h1u3 && t2w1lwt3 < t2h1d3 && t2w1lwt3 <t2w1rwt3 && t2w1lwt3 < t2h1uwt3 && t2w1lwt3 < t2h1dwt3
  && t2w1lwt3 < t2w1r4 && t2w1lwt3 < t2w1l4 && t2w1lwt3 < t2h1u4 && t2w1lwt3 < t2h1d4 && t2w1lwt3 <t2w1rwt4 && t2w1lwt3 <t2w1lwt4 && t2w1lwt3 < t2h1uwt4 && t2w1lwt3 < t2h1dwt4
  && t2w1lwt3 < t2w1r5 && t2w1lwt3 < t2w1l5 && t2w1lwt3 < t2h1u5 && t2w1lwt3 < t2h1d5 && t2w1lwt3 <t2w1rwt5 && t2w1lwt3 <t2w1lwt5 && t2w1lwt3 < t2h1uwt5 && t2w1lwt3 < t2h1dwt5
  && t2w1lwt3 < t2w1r6 && t2w1lwt3 < t2w1l6 && t2w1lwt3 < t2h1u6 && t2w1lwt3 < t2h1d6 && t2w1lwt3 <t2w1rwt6 && t2w1lwt3 <t2w1lwt6 && t2w1lwt3 < t2h1uwt6 && t2w1lwt3 < t2h1dwt6
  && t2w1lwt3 < t2w1r7 && t2w1lwt3 < t2w1l7 && t2w1lwt3 < t2h1u7 && t2w1lwt3 < t2h1d7 && t2w1lwt3 <t2w1rwt7 && t2w1lwt3 <t2w1lwt7 && t2w1lwt3 < t2h1uwt7 && t2w1lwt3 < t2h1dwt7
  && t2w1lwt3 < t2w1r8 && t2w1lwt3 < t2w1l8 && t2w1lwt3 < t2h1u8 && t2w1lwt3 < t2h1d8 && t2w1lwt3 <t2w1rwt8 && t2w1lwt3 <t2w1lwt8 && t2w1lwt3 < t2h1uwt8 && t2w1lwt3 < t2h1dwt8
  && t2w1lwt3 < t2w1r9 && t2w1lwt3 < t2w1l9 && t2w1lwt3 < t2h1u9 && t2w1lwt3 < t2h1d9 && t2w1lwt3 <t2w1rwt9 && t2w1lwt3 <t2w1lwt9 && t2w1lwt3 < t2h1uwt9 && t2w1lwt3 < t2h1dwt9
  && t2w1lwt3 < t2w1r10 && t2w1lwt3 < t2w1l10 && t2w1lwt3 < t2h1u10 && t2w1lwt3 < t2h1d10 && t2w1lwt3 <t2w1rwt10 && t2w1lwt3 <t2w1lwt10 && t2w1lwt3 < t2h1uwt10 && t2w1lwt3 < t2h1dwt10
  && ((loutwl3!=0 && linwl3==0) || (loutwl3==0 && linwl3!=0))){
  i=159;
  }

  if (mxlOW3==-1 && t2w1lwt3 > 0 && t2w1lwt3 < t1 
  && t2w1lwt3 < t2w1r && t2w1lwt3 < t2w1l && t2w1lwt3 < t2h1u && t2w1lwt3 < t2h1d && t2w1lwt3 <t2w1rwt && t2w1lwt3 <t2w1lwt && t2w1lwt3 < t2h1uwt && t2w1lwt3 < t2h1dwt
  && t2w1lwt3 < t2w1r1 && t2w1lwt3 < t2w1l1 && t2w1lwt3 < t2h1u1 && t2w1lwt3 < t2h1d1 && t2w1lwt3 <t2w1rwt1 && t2w1lwt3 <t2w1lwt1 && t2w1lwt3 < t2h1uwt1 && t2w1lwt3 < t2h1dwt1
  && t2w1lwt3 < t2w1r2 && t2w1lwt3 < t2w1l2 && t2w1lwt3 < t2h1u2 && t2w1lwt3 < t2h1d2 && t2w1lwt3 <t2w1rwt2 && t2w1lwt3 <t2w1lwt2 && t2w1lwt3 < t2h1uwt2 && t2w1lwt3 < t2h1dwt2
  && t2w1lwt3 < t2w1r3 && t2w1lwt3 < t2w1l3 && t2w1lwt3 < t2h1u3 && t2w1lwt3 < t2h1d3 && t2w1lwt3 <t2w1rwt3 && t2w1lwt3 < t2h1uwt3 && t2w1lwt3 < t2h1dwt3
  && t2w1lwt3 < t2w1r4 && t2w1lwt3 < t2w1l4 && t2w1lwt3 < t2h1u4 && t2w1lwt3 < t2h1d4 && t2w1lwt3 <t2w1rwt4 && t2w1lwt3 <t2w1lwt4 && t2w1lwt3 < t2h1uwt4 && t2w1lwt3 < t2h1dwt4
  && t2w1lwt3 < t2w1r5 && t2w1lwt3 < t2w1l5 && t2w1lwt3 < t2h1u5 && t2w1lwt3 < t2h1d5 && t2w1lwt3 <t2w1rwt5 && t2w1lwt3 <t2w1lwt5 && t2w1lwt3 < t2h1uwt5 && t2w1lwt3 < t2h1dwt5
  && t2w1lwt3 < t2w1r6 && t2w1lwt3 < t2w1l6 && t2w1lwt3 < t2h1u6 && t2w1lwt3 < t2h1d6 && t2w1lwt3 <t2w1rwt6 && t2w1lwt3 <t2w1lwt6 && t2w1lwt3 < t2h1uwt6 && t2w1lwt3 < t2h1dwt6
  && t2w1lwt3 < t2w1r7 && t2w1lwt3 < t2w1l7 && t2w1lwt3 < t2h1u7 && t2w1lwt3 < t2h1d7 && t2w1lwt3 <t2w1rwt7 && t2w1lwt3 <t2w1lwt7 && t2w1lwt3 < t2h1uwt7 && t2w1lwt3 < t2h1dwt7
  && t2w1lwt3 < t2w1r8 && t2w1lwt3 < t2w1l8 && t2w1lwt3 < t2h1u8 && t2w1lwt3 < t2h1d8 && t2w1lwt3 <t2w1rwt8 && t2w1lwt3 <t2w1lwt8 && t2w1lwt3 < t2h1uwt8 && t2w1lwt3 < t2h1dwt8
  && t2w1lwt3 < t2w1r9 && t2w1lwt3 < t2w1l9 && t2w1lwt3 < t2h1u9 && t2w1lwt3 < t2h1d9 && t2w1lwt3 <t2w1rwt9 && t2w1lwt3 <t2w1lwt9 && t2w1lwt3 < t2h1uwt9 && t2w1lwt3 < t2h1dwt9
  && t2w1lwt3 < t2w1r10 && t2w1lwt3 < t2w1l10 && t2w1lwt3 < t2h1u10 && t2w1lwt3 < t2h1d10 && t2w1lwt3 <t2w1rwt10 && t2w1lwt3 <t2w1lwt10 && t2w1lwt3 < t2h1uwt10 && t2w1lwt3 < t2h1dwt10
  && (loutwl3==0 && linwl3==0)){
  i=159;}

  if (myuOW3==-1 && t2h1uwt3 > 0 && t2h1uwt3 < t1 
  && t2h1uwt3 < t2w1r && t2h1uwt3 < t2w1l && t2h1uwt3 < t2h1u && t2h1uwt3 < t2h1d && t2h1uwt3 < t2w1rwt && t2h1uwt3 < t2w1lwt && t2h1uwt3 < t2h1uwt && t2h1uwt3 < t2h1dwt 
  && t2h1uwt3 < t2w1r1 && t2h1uwt3 < t2w1l1 && t2h1uwt3 < t2h1u1 && t2h1uwt3 < t2h1d1 && t2h1uwt3 < t2w1rwt1 && t2h1uwt3 < t2w1lwt1 && t2h1uwt3 < t2h1uwt1 && t2h1uwt3 < t2h1dwt1
  && t2h1uwt3 < t2w1r2 && t2h1uwt3 < t2w1l2 && t2h1uwt3 < t2h1u2 && t2h1uwt3 < t2h1d2 && t2h1uwt3 < t2w1rwt2 && t2h1uwt3 < t2w1lwt2 && t2h1uwt3 < t2h1uwt2 && t2h1uwt3 < t2h1dwt2
  && t2h1uwt3 < t2w1r3 && t2h1uwt3 < t2w1l3 && t2h1uwt3 < t2h1u3 && t2h1uwt3 < t2h1d3 && t2h1uwt3 < t2w1rwt3 && t2h1uwt3 < t2w1lwt3 && t2h1uwt3 < t2h1dwt3
  && t2h1uwt3 < t2w1r4 && t2h1uwt3 < t2w1l4 && t2h1uwt3 < t2h1u4 && t2h1uwt3 < t2h1d4 && t2h1uwt3 < t2w1rwt4 && t2h1uwt3 < t2w1lwt4 && t2h1uwt3 < t2h1uwt4 && t2h1uwt3 < t2h1dwt4
  && t2h1uwt3 < t2w1r5 && t2h1uwt3 < t2w1l5 && t2h1uwt3 < t2h1u5 && t2h1uwt3 < t2h1d5 && t2h1uwt3 < t2w1rwt5 && t2h1uwt3 < t2w1lwt5 && t2h1uwt3 < t2h1uwt5 && t2h1uwt3 < t2h1dwt5
  && t2h1uwt3 < t2w1r6 && t2h1uwt3 < t2w1l6 && t2h1uwt3 < t2h1u6 && t2h1uwt3 < t2h1d6 && t2h1uwt3 < t2w1rwt6 && t2h1uwt3 < t2w1lwt6 && t2h1uwt3 < t2h1uwt6 && t2h1uwt3 < t2h1dwt6
  && t2h1uwt3 < t2w1r7 && t2h1uwt3 < t2w1l7 && t2h1uwt3 < t2h1u7 && t2h1uwt3 < t2h1d7 && t2h1uwt3 < t2w1rwt7 && t2h1uwt3 < t2w1lwt7 && t2h1uwt3 < t2h1uwt7 && t2h1uwt3 < t2h1dwt7
  && t2h1uwt3 < t2w1r8 && t2h1uwt3 < t2w1l8 && t2h1uwt3 < t2h1u8 && t2h1uwt3 < t2h1d8 && t2h1uwt3 < t2w1rwt8 && t2h1uwt3 < t2w1lwt8 && t2h1uwt3 < t2h1uwt8 && t2h1uwt3 < t2h1dwt8
  && t2h1uwt3 < t2w1r9 && t2h1uwt3 < t2w1l9 && t2h1uwt3 < t2h1u9 && t2h1uwt3 < t2h1d9 && t2h1uwt3 < t2w1rwt9 && t2h1uwt3 < t2w1lwt9 && t2h1uwt3 < t2h1uwt9 && t2h1uwt3 < t2h1dwt9
  && t2h1uwt3 < t2w1r10 && t2h1uwt3 < t2w1l10 && t2h1uwt3 < t2h1u10 && t2h1uwt3 < t2h1d10 && t2h1uwt3 < t2w1rwt10 && t2h1uwt3 < t2w1lwt10 && t2h1uwt3 < t2h1uwt10 && t2h1uwt3 < t2h1dwt10
  && (louthu3 !=0 && linhu3!=0)){
  i=160;
  }

  if (myuOW3==-1 && t2h1uwt3 > 0 && t2h1uwt3 < t1 
  && t2h1uwt3 < t2w1r && t2h1uwt3 < t2w1l && t2h1uwt3 < t2h1u && t2h1uwt3 < t2h1d && t2h1uwt3 < t2w1rwt && t2h1uwt3 < t2w1lwt && t2h1uwt3 < t2h1uwt && t2h1uwt3 < t2h1dwt 
  && t2h1uwt3 < t2w1r1 && t2h1uwt3 < t2w1l1 && t2h1uwt3 < t2h1u1 && t2h1uwt3 < t2h1d1 && t2h1uwt3 < t2w1rwt1 && t2h1uwt3 < t2w1lwt1 && t2h1uwt3 < t2h1uwt1 && t2h1uwt3 < t2h1dwt1
  && t2h1uwt3 < t2w1r2 && t2h1uwt3 < t2w1l2 && t2h1uwt3 < t2h1u2 && t2h1uwt3 < t2h1d2 && t2h1uwt3 < t2w1rwt2 && t2h1uwt3 < t2w1lwt2 && t2h1uwt3 < t2h1uwt2 && t2h1uwt3 < t2h1dwt2
  && t2h1uwt3 < t2w1r3 && t2h1uwt3 < t2w1l3 && t2h1uwt3 < t2h1u3 && t2h1uwt3 < t2h1d3 && t2h1uwt3 < t2w1rwt3 && t2h1uwt3 < t2w1lwt3 && t2h1uwt3 < t2h1dwt3
  && t2h1uwt3 < t2w1r4 && t2h1uwt3 < t2w1l4 && t2h1uwt3 < t2h1u4 && t2h1uwt3 < t2h1d4 && t2h1uwt3 < t2w1rwt4 && t2h1uwt3 < t2w1lwt4 && t2h1uwt3 < t2h1uwt4 && t2h1uwt3 < t2h1dwt4
  && t2h1uwt3 < t2w1r5 && t2h1uwt3 < t2w1l5 && t2h1uwt3 < t2h1u5 && t2h1uwt3 < t2h1d5 && t2h1uwt3 < t2w1rwt5 && t2h1uwt3 < t2w1lwt5 && t2h1uwt3 < t2h1uwt5 && t2h1uwt3 < t2h1dwt5
  && t2h1uwt3 < t2w1r6 && t2h1uwt3 < t2w1l6 && t2h1uwt3 < t2h1u6 && t2h1uwt3 < t2h1d6 && t2h1uwt3 < t2w1rwt6 && t2h1uwt3 < t2w1lwt6 && t2h1uwt3 < t2h1uwt6 && t2h1uwt3 < t2h1dwt6
  && t2h1uwt3 < t2w1r7 && t2h1uwt3 < t2w1l7 && t2h1uwt3 < t2h1u7 && t2h1uwt3 < t2h1d7 && t2h1uwt3 < t2w1rwt7 && t2h1uwt3 < t2w1lwt7 && t2h1uwt3 < t2h1uwt7 && t2h1uwt3 < t2h1dwt7
  && t2h1uwt3 < t2w1r8 && t2h1uwt3 < t2w1l8 && t2h1uwt3 < t2h1u8 && t2h1uwt3 < t2h1d8 && t2h1uwt3 < t2w1rwt8 && t2h1uwt3 < t2w1lwt8 && t2h1uwt3 < t2h1uwt8 && t2h1uwt3 < t2h1dwt8
  && t2h1uwt3 < t2w1r9 && t2h1uwt3 < t2w1l9 && t2h1uwt3 < t2h1u9 && t2h1uwt3 < t2h1d9 && t2h1uwt3 < t2w1rwt9 && t2h1uwt3 < t2w1lwt9 && t2h1uwt3 < t2h1uwt9 && t2h1uwt3 < t2h1dwt9
  && t2h1uwt3 < t2w1r10 && t2h1uwt3 < t2w1l10 && t2h1uwt3 < t2h1u10 && t2h1uwt3 < t2h1d10 && t2h1uwt3 < t2w1rwt10 && t2h1uwt3 < t2w1lwt10 && t2h1uwt3 < t2h1uwt10 && t2h1uwt3 < t2h1dwt10
  && ((louthu3!=0 && linhu3==0) || (louthu3==0 && linhu3!=0))){
  i=160;
  }

  if (myuOW3==-1 && t2h1uwt3 > 0 && t2h1uwt3 < t1 
  && t2h1uwt3 < t2w1r && t2h1uwt3 < t2w1l && t2h1uwt3 < t2h1u && t2h1uwt3 < t2h1d && t2h1uwt3 < t2w1rwt && t2h1uwt3 < t2w1lwt && t2h1uwt3 < t2h1uwt && t2h1uwt3 < t2h1dwt 
  && t2h1uwt3 < t2w1r1 && t2h1uwt3 < t2w1l1 && t2h1uwt3 < t2h1u1 && t2h1uwt3 < t2h1d1 && t2h1uwt3 < t2w1rwt1 && t2h1uwt3 < t2w1lwt1 && t2h1uwt3 < t2h1uwt1 && t2h1uwt3 < t2h1dwt1
  && t2h1uwt3 < t2w1r2 && t2h1uwt3 < t2w1l2 && t2h1uwt3 < t2h1u2 && t2h1uwt3 < t2h1d2 && t2h1uwt3 < t2w1rwt2 && t2h1uwt3 < t2w1lwt2 && t2h1uwt3 < t2h1uwt2 && t2h1uwt3 < t2h1dwt2
  && t2h1uwt3 < t2w1r3 && t2h1uwt3 < t2w1l3 && t2h1uwt3 < t2h1u3 && t2h1uwt3 < t2h1d3 && t2h1uwt3 < t2w1rwt3 && t2h1uwt3 < t2w1lwt3 && t2h1uwt3 < t2h1dwt3
  && t2h1uwt3 < t2w1r4 && t2h1uwt3 < t2w1l4 && t2h1uwt3 < t2h1u4 && t2h1uwt3 < t2h1d4 && t2h1uwt3 < t2w1rwt4 && t2h1uwt3 < t2w1lwt4 && t2h1uwt3 < t2h1uwt4 && t2h1uwt3 < t2h1dwt4
  && t2h1uwt3 < t2w1r5 && t2h1uwt3 < t2w1l5 && t2h1uwt3 < t2h1u5 && t2h1uwt3 < t2h1d5 && t2h1uwt3 < t2w1rwt5 && t2h1uwt3 < t2w1lwt5 && t2h1uwt3 < t2h1uwt5 && t2h1uwt3 < t2h1dwt5
  && t2h1uwt3 < t2w1r6 && t2h1uwt3 < t2w1l6 && t2h1uwt3 < t2h1u6 && t2h1uwt3 < t2h1d6 && t2h1uwt3 < t2w1rwt6 && t2h1uwt3 < t2w1lwt6 && t2h1uwt3 < t2h1uwt6 && t2h1uwt3 < t2h1dwt6
  && t2h1uwt3 < t2w1r7 && t2h1uwt3 < t2w1l7 && t2h1uwt3 < t2h1u7 && t2h1uwt3 < t2h1d7 && t2h1uwt3 < t2w1rwt7 && t2h1uwt3 < t2w1lwt7 && t2h1uwt3 < t2h1uwt7 && t2h1uwt3 < t2h1dwt7
  && t2h1uwt3 < t2w1r8 && t2h1uwt3 < t2w1l8 && t2h1uwt3 < t2h1u8 && t2h1uwt3 < t2h1d8 && t2h1uwt3 < t2w1rwt8 && t2h1uwt3 < t2w1lwt8 && t2h1uwt3 < t2h1uwt8 && t2h1uwt3 < t2h1dwt8
  && t2h1uwt3 < t2w1r9 && t2h1uwt3 < t2w1l9 && t2h1uwt3 < t2h1u9 && t2h1uwt3 < t2h1d9 && t2h1uwt3 < t2w1rwt9 && t2h1uwt3 < t2w1lwt9 && t2h1uwt3 < t2h1uwt9 && t2h1uwt3 < t2h1dwt9
  && t2h1uwt3 < t2w1r10 && t2h1uwt3 < t2w1l10 && t2h1uwt3 < t2h1u10 && t2h1uwt3 < t2h1d10 && t2h1uwt3 < t2w1rwt10 && t2h1uwt3 < t2w1lwt10 && t2h1uwt3 < t2h1uwt10 && t2h1uwt3 < t2h1dwt10
  && (louthu3 == 0 && linhu3 == 0)){
  i=160;
  }

  if (mydOW3==-1 && t2h1dwt3 > 0 && t2h1dwt3 < t1 
  && t2h1dwt3 < t2w1r && t2h1dwt3 < t2w1l && t2h1dwt3 < t2h1u && t2h1dwt3 < t2h1d && t2h1dwt3 < t2w1rwt && t2h1dwt3 < t2w1lwt && t2h1dwt3 < t2h1uwt && t2h1dwt3 < t2h1dwt 
  && t2h1dwt3 < t2w1r1 && t2h1dwt3 < t2w1l1 && t2h1dwt3 < t2h1u1 && t2h1dwt3 < t2h1d1 && t2h1dwt3 < t2w1rwt1 && t2h1dwt3 < t2w1lwt1 && t2h1dwt3 < t2h1uwt1 && t2h1dwt3 < t2h1dwt1
  && t2h1dwt3 < t2w1r2 && t2h1dwt3 < t2w1l2 && t2h1dwt3 < t2h1u2 && t2h1dwt3 < t2h1d2 && t2h1dwt3 < t2w1rwt2 && t2h1dwt3 < t2w1lwt2 && t2h1dwt3 < t2h1uwt2 && t2h1dwt3 < t2h1dwt2 
  && t2h1dwt3 < t2w1r3 && t2h1dwt3 < t2w1l3 && t2h1dwt3 < t2h1u3 && t2h1dwt3 < t2h1d3 && t2h1dwt3 < t2w1rwt3 && t2h1dwt3 < t2w1lwt3 && t2h1dwt3 < t2h1uwt3 
  && t2h1dwt3 < t2w1r4 && t2h1dwt3 < t2w1l4 && t2h1dwt3 < t2h1u4 && t2h1dwt3 < t2h1d4 && t2h1dwt3 < t2w1rwt4 && t2h1dwt3 < t2w1lwt4 && t2h1dwt3 < t2h1uwt4 && t2h1dwt3 < t2h1dwt4
  && t2h1dwt3 < t2w1r5 && t2h1dwt3 < t2w1l5 && t2h1dwt3 < t2h1u5 && t2h1dwt3 < t2h1d5 && t2h1dwt3 < t2w1rwt5 && t2h1dwt3 < t2w1lwt5 && t2h1dwt3 < t2h1uwt5 && t2h1dwt3 < t2h1dwt5
  && t2h1dwt3 < t2w1r6 && t2h1dwt3 < t2w1l6 && t2h1dwt3 < t2h1u6 && t2h1dwt3 < t2h1d6 && t2h1dwt3 < t2w1rwt6 && t2h1dwt3 < t2w1lwt6 && t2h1dwt3 < t2h1uwt6 && t2h1dwt3 < t2h1dwt6
  && t2h1dwt3 < t2w1r7 && t2h1dwt3 < t2w1l7 && t2h1dwt3 < t2h1u7 && t2h1dwt3 < t2h1d7 && t2h1dwt3 < t2w1rwt7 && t2h1dwt3 < t2w1lwt7 && t2h1dwt3 < t2h1uwt7 && t2h1dwt3 < t2h1dwt7 
  && t2h1dwt3 < t2w1r8 && t2h1dwt3 < t2w1l8 && t2h1dwt3 < t2h1u8 && t2h1dwt3 < t2h1d8 && t2h1dwt3 < t2w1rwt8 && t2h1dwt3 < t2w1lwt8 && t2h1dwt3 < t2h1uwt8 && t2h1dwt3 < t2h1dwt8
  && t2h1dwt3 < t2w1r9 && t2h1dwt3 < t2w1l9 && t2h1dwt3 < t2h1u9 && t2h1dwt3 < t2h1d9 && t2h1dwt3 < t2w1rwt9 && t2h1dwt3 < t2w1lwt9 && t2h1dwt3 < t2h1uwt9 && t2h1dwt3 < t2h1dwt9 
  && t2h1dwt3 < t2w1r10 && t2h1dwt3 < t2w1l10 && t2h1dwt3 < t2h1u10 && t2h1dwt3 < t2h1d10 && t2h1dwt3 < t2w1rwt10 && t2h1dwt3 < t2w1lwt10 && t2h1dwt3 < t2h1uwt10 && t2h1dwt3 < t2h1dwt10  
  && (louthd3 !=0 && linhd3!=0)){
  i=161;
  }

  if (mydOW3==-1 && t2h1dwt3 > 0 && t2h1dwt3 < t1 
  && t2h1dwt3 < t2w1r && t2h1dwt3 < t2w1l && t2h1dwt3 < t2h1u && t2h1dwt3 < t2h1d && t2h1dwt3 < t2w1rwt && t2h1dwt3 < t2w1lwt && t2h1dwt3 < t2h1uwt && t2h1dwt3 < t2h1dwt 
  && t2h1dwt3 < t2w1r1 && t2h1dwt3 < t2w1l1 && t2h1dwt3 < t2h1u1 && t2h1dwt3 < t2h1d1 && t2h1dwt3 < t2w1rwt1 && t2h1dwt3 < t2w1lwt1 && t2h1dwt3 < t2h1uwt1 && t2h1dwt3 < t2h1dwt1
  && t2h1dwt3 < t2w1r2 && t2h1dwt3 < t2w1l2 && t2h1dwt3 < t2h1u2 && t2h1dwt3 < t2h1d2 && t2h1dwt3 < t2w1rwt2 && t2h1dwt3 < t2w1lwt2 && t2h1dwt3 < t2h1uwt2 && t2h1dwt3 < t2h1dwt2 
  && t2h1dwt3 < t2w1r3 && t2h1dwt3 < t2w1l3 && t2h1dwt3 < t2h1u3 && t2h1dwt3 < t2h1d3 && t2h1dwt3 < t2w1rwt3 && t2h1dwt3 < t2w1lwt3 && t2h1dwt3 < t2h1uwt3 
  && t2h1dwt3 < t2w1r4 && t2h1dwt3 < t2w1l4 && t2h1dwt3 < t2h1u4 && t2h1dwt3 < t2h1d4 && t2h1dwt3 < t2w1rwt4 && t2h1dwt3 < t2w1lwt4 && t2h1dwt3 < t2h1uwt4 && t2h1dwt3 < t2h1dwt4
  && t2h1dwt3 < t2w1r5 && t2h1dwt3 < t2w1l5 && t2h1dwt3 < t2h1u5 && t2h1dwt3 < t2h1d5 && t2h1dwt3 < t2w1rwt5 && t2h1dwt3 < t2w1lwt5 && t2h1dwt3 < t2h1uwt5 && t2h1dwt3 < t2h1dwt5
  && t2h1dwt3 < t2w1r6 && t2h1dwt3 < t2w1l6 && t2h1dwt3 < t2h1u6 && t2h1dwt3 < t2h1d6 && t2h1dwt3 < t2w1rwt6 && t2h1dwt3 < t2w1lwt6 && t2h1dwt3 < t2h1uwt6 && t2h1dwt3 < t2h1dwt6
  && t2h1dwt3 < t2w1r7 && t2h1dwt3 < t2w1l7 && t2h1dwt3 < t2h1u7 && t2h1dwt3 < t2h1d7 && t2h1dwt3 < t2w1rwt7 && t2h1dwt3 < t2w1lwt7 && t2h1dwt3 < t2h1uwt7 && t2h1dwt3 < t2h1dwt7 
  && t2h1dwt3 < t2w1r8 && t2h1dwt3 < t2w1l8 && t2h1dwt3 < t2h1u8 && t2h1dwt3 < t2h1d8 && t2h1dwt3 < t2w1rwt8 && t2h1dwt3 < t2w1lwt8 && t2h1dwt3 < t2h1uwt8 && t2h1dwt3 < t2h1dwt8
  && t2h1dwt3 < t2w1r9 && t2h1dwt3 < t2w1l9 && t2h1dwt3 < t2h1u9 && t2h1dwt3 < t2h1d9 && t2h1dwt3 < t2w1rwt9 && t2h1dwt3 < t2w1lwt9 && t2h1dwt3 < t2h1uwt9 && t2h1dwt3 < t2h1dwt9 
  && t2h1dwt3 < t2w1r10 && t2h1dwt3 < t2w1l10 && t2h1dwt3 < t2h1u10 && t2h1dwt3 < t2h1d10 && t2h1dwt3 < t2w1rwt10 && t2h1dwt3 < t2w1lwt10 && t2h1dwt3 < t2h1uwt10 && t2h1dwt3 < t2h1dwt10
  && ((louthd3 !=0 && linhd3==0) || (louthd3 ==0 && linhd3!=0))){
  i=161;
  }

  if (mydOW3==-1 && t2h1dwt3 > 0 && t2h1dwt3 < t1 
  && t2h1dwt3 < t2w1r && t2h1dwt3 < t2w1l && t2h1dwt3 < t2h1u && t2h1dwt3 < t2h1d && t2h1dwt3 < t2w1rwt && t2h1dwt3 < t2w1lwt && t2h1dwt3 < t2h1uwt && t2h1dwt3 < t2h1dwt 
  && t2h1dwt3 < t2w1r1 && t2h1dwt3 < t2w1l1 && t2h1dwt3 < t2h1u1 && t2h1dwt3 < t2h1d1 && t2h1dwt3 < t2w1rwt1 && t2h1dwt3 < t2w1lwt1 && t2h1dwt3 < t2h1uwt1 && t2h1dwt3 < t2h1dwt1
  && t2h1dwt3 < t2w1r2 && t2h1dwt3 < t2w1l2 && t2h1dwt3 < t2h1u2 && t2h1dwt3 < t2h1d2 && t2h1dwt3 < t2w1rwt2 && t2h1dwt3 < t2w1lwt2 && t2h1dwt3 < t2h1uwt2 && t2h1dwt3 < t2h1dwt2 
  && t2h1dwt3 < t2w1r3 && t2h1dwt3 < t2w1l3 && t2h1dwt3 < t2h1u3 && t2h1dwt3 < t2h1d3 && t2h1dwt3 < t2w1rwt3 && t2h1dwt3 < t2w1lwt3 && t2h1dwt3 < t2h1uwt3 
  && t2h1dwt3 < t2w1r4 && t2h1dwt3 < t2w1l4 && t2h1dwt3 < t2h1u4 && t2h1dwt3 < t2h1d4 && t2h1dwt3 < t2w1rwt4 && t2h1dwt3 < t2w1lwt4 && t2h1dwt3 < t2h1uwt4 && t2h1dwt3 < t2h1dwt4
  && t2h1dwt3 < t2w1r5 && t2h1dwt3 < t2w1l5 && t2h1dwt3 < t2h1u5 && t2h1dwt3 < t2h1d5 && t2h1dwt3 < t2w1rwt5 && t2h1dwt3 < t2w1lwt5 && t2h1dwt3 < t2h1uwt5 && t2h1dwt3 < t2h1dwt5
  && t2h1dwt3 < t2w1r6 && t2h1dwt3 < t2w1l6 && t2h1dwt3 < t2h1u6 && t2h1dwt3 < t2h1d6 && t2h1dwt3 < t2w1rwt6 && t2h1dwt3 < t2w1lwt6 && t2h1dwt3 < t2h1uwt6 && t2h1dwt3 < t2h1dwt6
  && t2h1dwt3 < t2w1r7 && t2h1dwt3 < t2w1l7 && t2h1dwt3 < t2h1u7 && t2h1dwt3 < t2h1d7 && t2h1dwt3 < t2w1rwt7 && t2h1dwt3 < t2w1lwt7 && t2h1dwt3 < t2h1uwt7 && t2h1dwt3 < t2h1dwt7 
  && t2h1dwt3 < t2w1r8 && t2h1dwt3 < t2w1l8 && t2h1dwt3 < t2h1u8 && t2h1dwt3 < t2h1d8 && t2h1dwt3 < t2w1rwt8 && t2h1dwt3 < t2w1lwt8 && t2h1dwt3 < t2h1uwt8 && t2h1dwt3 < t2h1dwt8
  && t2h1dwt3 < t2w1r9 && t2h1dwt3 < t2w1l9 && t2h1dwt3 < t2h1u9 && t2h1dwt3 < t2h1d9 && t2h1dwt3 < t2w1rwt9 && t2h1dwt3 < t2w1lwt9 && t2h1dwt3 < t2h1uwt9 && t2h1dwt3 < t2h1dwt9 
  && t2h1dwt3 < t2w1r10 && t2h1dwt3 < t2w1l10 && t2h1dwt3 < t2h1u10 && t2h1dwt3 < t2h1d10 && t2h1dwt3 < t2w1rwt10 && t2h1dwt3 < t2w1lwt10 && t2h1dwt3 < t2h1uwt10 && t2h1dwt3 < t2h1dwt10
  && (louthd3 == 0 && linhd3 == 0)){ 
  i=161;
  }



  if (mxr4!=-1 && t2w1r4 > 0 && t2w1r4 < t1 
     && t2w1r4 < t2w1r && t2w1r4 < t2w1l && t2w1r4 < t2h1u && t2w1r4 < t2h1d && t2w1r4 < t2w1rwt && t2w1r4 < t2w1lwt && t2w1r4 < t2h1uwt && t2w1r4 < t2h1dwt
     && t2w1r4 < t2w1r1 && t2w1r4 < t2w1l1 && t2w1r4 < t2h1u1 && t2w1r4 < t2h1d1 && t2w1r4 < t2w1rwt1 && t2w1r4 < t2w1lwt1 && t2w1r4 < t2h1uwt1 && t2w1r4 < t2h1dwt1
     && t2w1r4 < t2w1r2 && t2w1r4 < t2w1l2 && t2w1r4 < t2h1u2 && t2w1r4 < t2h1d2 && t2w1r4 < t2w1rwt2 && t2w1r4 < t2w1lwt2 && t2w1r4 < t2h1uwt2 && t2w1r4 < t2h1dwt2 
     && t2w1r4 < t2w1r3 && t2w1r4 < t2w1l3 && t2w1r4 < t2h1u3 && t2w1r4 < t2h1d3 && t2w1r4 < t2w1rwt3 && t2w1r4 < t2w1lwt3 && t2w1r4 < t2h1uwt3 && t2w1r4 < t2h1dwt3
     && t2w1r4 < t2w1l4 && t2w1r4 < t2h1u4 && t2w1r4 < t2h1d4 && t2w1r4 < t2w1rwt4 && t2w1r4 < t2w1lwt4 && t2w1r4 < t2h1uwt4 && t2w1r4 < t2h1dwt4
     && t2w1r4 < t2w1r5 && t2w1r4 < t2w1l5 && t2w1r4 < t2h1u5 && t2w1r4 < t2h1d5 && t2w1r4 < t2w1rwt5 && t2w1r4 < t2w1lwt5 && t2w1r4 < t2h1uwt5 && t2w1r4 < t2h1dwt5
     && t2w1r4 < t2w1r6 && t2w1r4 < t2w1l6 && t2w1r4 < t2h1u6 && t2w1r4 < t2h1d6 && t2w1r4 < t2w1rwt6 && t2w1r4 < t2w1lwt6 && t2w1r4 < t2h1uwt6 && t2w1r4 < t2h1dwt6
     && t2w1r4 < t2w1r7 && t2w1r4 < t2w1l7 && t2w1r4 < t2h1u7 && t2w1r4 < t2h1d7 && t2w1r4 < t2w1rwt7 && t2w1r4 < t2w1lwt7 && t2w1r4 < t2h1uwt7 && t2w1r4 < t2h1dwt7
     && t2w1r4 < t2w1r8 && t2w1r4 < t2w1l8 && t2w1r4 < t2h1u8 && t2w1r4 < t2h1d8 && t2w1r4 < t2w1rwt8 && t2w1r4 < t2w1lwt8 && t2w1r4 < t2h1uwt8 && t2w1r4 < t2h1dwt8
     && t2w1r4 < t2w1r9 && t2w1r4 < t2w1l9 && t2w1r4 < t2h1u9 && t2w1r4 < t2h1d9 && t2w1r4 < t2w1rwt9 && t2w1r4 < t2w1lwt9 && t2w1r4 < t2h1uwt9 && t2w1r4 < t2h1dwt9
     && t2w1r4 < t2w1r10 && t2w1r4 < t2w1l10 && t2w1r4 < t2h1u10 && t2w1r4 < t2h1d10 && t2w1r4 < t2w1rwt10 && t2w1r4 < t2w1lwt10 && t2w1r4 < t2h1uwt10 && t2w1r4 < t2h1dwt10
     && ((linwr4!=0) && (loutwr4!=0) )) {	
    if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1r4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1r4+z))*(z0hd4+(vz*t2w1r4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1r4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1r4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1r4+z))*(z0hu4+(vz*t2w1r4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1r4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1r4+y;
  xlimitr=bwr4*sqrt(1-((vz*t2w1r4+z)+z0wr4)*((vz*t2w1r4+z)+z0wr4)/a2wr4);
  xtest=vx*t2w1r4+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr4 > 0){
  i=162;
  }else{
  i=178;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr4!=-1 && t2w1r4 > 0 && t2w1r4 < t1 
     && t2w1r4 < t2w1r && t2w1r4 < t2w1l && t2w1r4 < t2h1u && t2w1r4 < t2h1d && t2w1r4 < t2w1rwt && t2w1r4 < t2w1lwt && t2w1r4 < t2h1uwt && t2w1r4 < t2h1dwt
     && t2w1r4 < t2w1r1 && t2w1r4 < t2w1l1 && t2w1r4 < t2h1u1 && t2w1r4 < t2h1d1 && t2w1r4 < t2w1rwt1 && t2w1r4 < t2w1lwt1 && t2w1r4 < t2h1uwt1 && t2w1r4 < t2h1dwt1
     && t2w1r4 < t2w1r2 && t2w1r4 < t2w1l2 && t2w1r4 < t2h1u2 && t2w1r4 < t2h1d2 && t2w1r4 < t2w1rwt2 && t2w1r4 < t2w1lwt2 && t2w1r4 < t2h1uwt2 && t2w1r4 < t2h1dwt2 
     && t2w1r4 < t2w1r3 && t2w1r4 < t2w1l3 && t2w1r4 < t2h1u3 && t2w1r4 < t2h1d3 && t2w1r4 < t2w1rwt3 && t2w1r4 < t2w1lwt3 && t2w1r4 < t2h1uwt3 && t2w1r4 < t2h1dwt3
     && t2w1r4 < t2w1l4 && t2w1r4 < t2h1u4 && t2w1r4 < t2h1d4 && t2w1r4 < t2w1rwt4 && t2w1r4 < t2w1lwt4 && t2w1r4 < t2h1uwt4 && t2w1r4 < t2h1dwt4
     && t2w1r4 < t2w1r5 && t2w1r4 < t2w1l5 && t2w1r4 < t2h1u5 && t2w1r4 < t2h1d5 && t2w1r4 < t2w1rwt5 && t2w1r4 < t2w1lwt5 && t2w1r4 < t2h1uwt5 && t2w1r4 < t2h1dwt5
     && t2w1r4 < t2w1r6 && t2w1r4 < t2w1l6 && t2w1r4 < t2h1u6 && t2w1r4 < t2h1d6 && t2w1r4 < t2w1rwt6 && t2w1r4 < t2w1lwt6 && t2w1r4 < t2h1uwt6 && t2w1r4 < t2h1dwt6
     && t2w1r4 < t2w1r7 && t2w1r4 < t2w1l7 && t2w1r4 < t2h1u7 && t2w1r4 < t2h1d7 && t2w1r4 < t2w1rwt7 && t2w1r4 < t2w1lwt7 && t2w1r4 < t2h1uwt7 && t2w1r4 < t2h1dwt7
     && t2w1r4 < t2w1r8 && t2w1r4 < t2w1l8 && t2w1r4 < t2h1u8 && t2w1r4 < t2h1d8 && t2w1r4 < t2w1rwt8 && t2w1r4 < t2w1lwt8 && t2w1r4 < t2h1uwt8 && t2w1r4 < t2h1dwt8
     && t2w1r4 < t2w1r9 && t2w1r4 < t2w1l9 && t2w1r4 < t2h1u9 && t2w1r4 < t2h1d9 && t2w1r4 < t2w1rwt9 && t2w1r4 < t2w1lwt9 && t2w1r4 < t2h1uwt9 && t2w1r4 < t2h1dwt9
     && t2w1r4 < t2w1r10 && t2w1r4 < t2w1l10 && t2w1r4 < t2h1u10 && t2w1r4 < t2h1d10 && t2w1r4 < t2w1rwt10 && t2w1r4 < t2w1lwt10 && t2w1r4 < t2h1uwt10 && t2w1r4 < t2h1dwt10
     && ((loutwr4!=0 && linwr4==0) || (loutwr4==0 && linwr4!=0))){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1r4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1r4+z))*(z0hd4+(vz*t2w1r4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1r4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1r4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1r4+z))*(z0hu4+(vz*t2w1r4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1r4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1r4+y;
  xtest=vx*t2w1r4+x;
  xlimitr=-sqrt(pbwr4-(vz*t2w1r4+z)/pawr4);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr4 > 0){
  i=163;
  }else{
  i=178;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr4!=-1 && t2w1r4 > 0 && t2w1r4 < t1 
     && t2w1r4 < t2w1r && t2w1r4 < t2w1l && t2w1r4 < t2h1u && t2w1r4 < t2h1d && t2w1r4 < t2w1rwt && t2w1r4 < t2w1lwt && t2w1r4 < t2h1uwt && t2w1r4 < t2h1dwt
     && t2w1r4 < t2w1r1 && t2w1r4 < t2w1l1 && t2w1r4 < t2h1u1 && t2w1r4 < t2h1d1 && t2w1r4 < t2w1rwt1 && t2w1r4 < t2w1lwt1 && t2w1r4 < t2h1uwt1 && t2w1r4 < t2h1dwt1
     && t2w1r4 < t2w1r2 && t2w1r4 < t2w1l2 && t2w1r4 < t2h1u2 && t2w1r4 < t2h1d2 && t2w1r4 < t2w1rwt2 && t2w1r4 < t2w1lwt2 && t2w1r4 < t2h1uwt2 && t2w1r4 < t2h1dwt2 
     && t2w1r4 < t2w1r3 && t2w1r4 < t2w1l3 && t2w1r4 < t2h1u3 && t2w1r4 < t2h1d3 && t2w1r4 < t2w1rwt3 && t2w1r4 < t2w1lwt3 && t2w1r4 < t2h1uwt3 && t2w1r4 < t2h1dwt3
     && t2w1r4 < t2w1l4 && t2w1r4 < t2h1u4 && t2w1r4 < t2h1d4 && t2w1r4 < t2w1rwt4 && t2w1r4 < t2w1lwt4 && t2w1r4 < t2h1uwt4 && t2w1r4 < t2h1dwt4
     && t2w1r4 < t2w1r5 && t2w1r4 < t2w1l5 && t2w1r4 < t2h1u5 && t2w1r4 < t2h1d5 && t2w1r4 < t2w1rwt5 && t2w1r4 < t2w1lwt5 && t2w1r4 < t2h1uwt5 && t2w1r4 < t2h1dwt5
     && t2w1r4 < t2w1r6 && t2w1r4 < t2w1l6 && t2w1r4 < t2h1u6 && t2w1r4 < t2h1d6 && t2w1r4 < t2w1rwt6 && t2w1r4 < t2w1lwt6 && t2w1r4 < t2h1uwt6 && t2w1r4 < t2h1dwt6
     && t2w1r4 < t2w1r7 && t2w1r4 < t2w1l7 && t2w1r4 < t2h1u7 && t2w1r4 < t2h1d7 && t2w1r4 < t2w1rwt7 && t2w1r4 < t2w1lwt7 && t2w1r4 < t2h1uwt7 && t2w1r4 < t2h1dwt7
     && t2w1r4 < t2w1r8 && t2w1r4 < t2w1l8 && t2w1r4 < t2h1u8 && t2w1r4 < t2h1d8 && t2w1r4 < t2w1rwt8 && t2w1r4 < t2w1lwt8 && t2w1r4 < t2h1uwt8 && t2w1r4 < t2h1dwt8
     && t2w1r4 < t2w1r9 && t2w1r4 < t2w1l9 && t2w1r4 < t2h1u9 && t2w1r4 < t2h1d9 && t2w1r4 < t2w1rwt9 && t2w1r4 < t2w1lwt9 && t2w1r4 < t2h1uwt9 && t2w1r4 < t2h1dwt9
     && t2w1r4 < t2w1r10 && t2w1r4 < t2w1l10 && t2w1r4 < t2h1u10 && t2w1r4 < t2h1d10 && t2w1r4 < t2w1rwt10 && t2w1r4 < t2w1lwt10 && t2w1r4 < t2h1uwt10 && t2w1r4 < t2h1dwt10
     && (loutwr4==0 && linwr4==0)){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1r4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1r4+z))*(z0hd4+(vz*t2w1r4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1r4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1r4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1r4+z))*(z0hu4+(vz*t2w1r4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1r4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1r4+y;
  xtest=vx*t2w1r4+x;
  xlimitr=-(w2r4+w1r4)*(vz*t2w1r4+z)/l-w1r4;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr4>0){
  i=164;
  }else{
  i=178;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl4!=-1 && t2w1l4 > 0 && t2w1l4 < t1 
      && t2w1l4 < t2w1r && t2w1l4 < t2w1l && t2w1l4 < t2h1u && t2w1l4 < t2h1d && t2w1l4 < t2w1rwt && t2w1l4 < t2w1lwt && t2w1l4 < t2h1uwt && t2w1l4 < t2h1dwt
      && t2w1l4 < t2w1r1 && t2w1l4 < t2w1l1 && t2w1l4 < t2h1u1 && t2w1l4 < t2h1d1 && t2w1l4 < t2w1rwt1 && t2w1l4 < t2w1lwt1 && t2w1l4 < t2h1uwt1 && t2w1l4 < t2h1dwt1
      && t2w1l4 < t2w1r2 && t2w1l4 < t2w1l2 && t2w1l4 < t2h1u2 && t2w1l4 < t2h1d2 && t2w1l4 < t2w1rwt2 && t2w1l4 < t2w1lwt2 && t2w1l4 < t2h1uwt2 && t2w1l4 < t2h1dwt2
      && t2w1l4 < t2w1r3 && t2w1l4 < t2w1l3 && t2w1l4 < t2h1u3 && t2w1l4 < t2h1d3 && t2w1l4 < t2w1rwt3 && t2w1l4 < t2w1lwt3 && t2w1l4 < t2h1uwt3 && t2w1l4 < t2h1dwt3
      && t2w1l4 < t2w1r4 && t2w1l4 < t2h1u4 && t2w1l4 < t2h1d4 && t2w1l4 < t2w1rwt4 && t2w1l4 < t2w1lwt4 && t2w1l4 < t2h1uwt4 && t2w1l4 < t2h1dwt4
      && t2w1l4 < t2w1r5 && t2w1l4 < t2w1l5 && t2w1l4 < t2h1u5 && t2w1l4 < t2h1d5 && t2w1l4 < t2w1rwt5 && t2w1l4 < t2w1lwt5 && t2w1l4 < t2h1uwt5 && t2w1l4 < t2h1dwt5
      && t2w1l4 < t2w1r6 && t2w1l4 < t2w1l6 && t2w1l4 < t2h1u6 && t2w1l4 < t2h1d6 && t2w1l4 < t2w1rwt6 && t2w1l4 < t2w1lwt6 && t2w1l4 < t2h1uwt6 && t2w1l4 < t2h1dwt6
      && t2w1l4 < t2w1r7 && t2w1l4 < t2w1l7 && t2w1l4 < t2h1u7 && t2w1l4 < t2h1d7 && t2w1l4 < t2w1rwt7 && t2w1l4 < t2w1lwt7 && t2w1l4 < t2h1uwt7 && t2w1l4 < t2h1dwt7
      && t2w1l4 < t2w1r8 && t2w1l4 < t2w1l8 && t2w1l4 < t2h1u8 && t2w1l4 < t2h1d8 && t2w1l4 < t2w1rwt8 && t2w1l4 < t2w1lwt8 && t2w1l4 < t2h1uwt8 && t2w1l4 < t2h1dwt8
      && t2w1l4 < t2w1r9 && t2w1l4 < t2w1l9 && t2w1l4 < t2h1u9 && t2w1l4 < t2h1d9 && t2w1l4 < t2w1rwt9 && t2w1l4 < t2w1lwt9 && t2w1l4 < t2h1uwt9 && t2w1l4 < t2h1dwt9
      && t2w1l4 < t2w1r10 && t2w1l4 < t2w1l10 && t2w1l4 < t2h1u10 && t2w1l4 < t2h1d10 && t2w1l4 < t2w1rwt10 && t2w1l4 < t2w1lwt10 && t2w1l4 < t2h1uwt10 && t2w1l4 < t2h1dwt10
      && ((linwl4!=0) && (loutwl4!=0) )){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1l4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1l4+z))*(z0hd4+(vz*t2w1l4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1l4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1l4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1l4+z))*(z0hu4+(vz*t2w1l4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1l4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1l4+y;
  xlimitl=bwl4*sqrt(1-((vz*t2w1l4+z)+z0wl4)*((vz*t2w1l4+z)+z0wl4)/a2wl4);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl4>0){
  i=165;
  }else{
  i=179;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl4!=-1 && t2w1l4 > 0 && t2w1l4 < t1 
      && t2w1l4 < t2w1r && t2w1l4 < t2w1l && t2w1l4 < t2h1u && t2w1l4 < t2h1d && t2w1l4 < t2w1rwt && t2w1l4 < t2w1lwt && t2w1l4 < t2h1uwt && t2w1l4 < t2h1dwt
      && t2w1l4 < t2w1r1 && t2w1l4 < t2w1l1 && t2w1l4 < t2h1u1 && t2w1l4 < t2h1d1 && t2w1l4 < t2w1rwt1 && t2w1l4 < t2w1lwt1 && t2w1l4 < t2h1uwt1 && t2w1l4 < t2h1dwt1
      && t2w1l4 < t2w1r2 && t2w1l4 < t2w1l2 && t2w1l4 < t2h1u2 && t2w1l4 < t2h1d2 && t2w1l4 < t2w1rwt2 && t2w1l4 < t2w1lwt2 && t2w1l4 < t2h1uwt2 && t2w1l4 < t2h1dwt2
      && t2w1l4 < t2w1r3 && t2w1l4 < t2w1l3 && t2w1l4 < t2h1u3 && t2w1l4 < t2h1d3 && t2w1l4 < t2w1rwt3 && t2w1l4 < t2w1lwt3 && t2w1l4 < t2h1uwt3 && t2w1l4 < t2h1dwt3
      && t2w1l4 < t2w1r4 && t2w1l4 < t2h1u4 && t2w1l4 < t2h1d4 && t2w1l4 < t2w1rwt4 && t2w1l4 < t2w1lwt4 && t2w1l4 < t2h1uwt4 && t2w1l4 < t2h1dwt4
      && t2w1l4 < t2w1r5 && t2w1l4 < t2w1l5 && t2w1l4 < t2h1u5 && t2w1l4 < t2h1d5 && t2w1l4 < t2w1rwt5 && t2w1l4 < t2w1lwt5 && t2w1l4 < t2h1uwt5 && t2w1l4 < t2h1dwt5
      && t2w1l4 < t2w1r6 && t2w1l4 < t2w1l6 && t2w1l4 < t2h1u6 && t2w1l4 < t2h1d6 && t2w1l4 < t2w1rwt6 && t2w1l4 < t2w1lwt6 && t2w1l4 < t2h1uwt6 && t2w1l4 < t2h1dwt6
      && t2w1l4 < t2w1r7 && t2w1l4 < t2w1l7 && t2w1l4 < t2h1u7 && t2w1l4 < t2h1d7 && t2w1l4 < t2w1rwt7 && t2w1l4 < t2w1lwt7 && t2w1l4 < t2h1uwt7 && t2w1l4 < t2h1dwt7
      && t2w1l4 < t2w1r8 && t2w1l4 < t2w1l8 && t2w1l4 < t2h1u8 && t2w1l4 < t2h1d8 && t2w1l4 < t2w1rwt8 && t2w1l4 < t2w1lwt8 && t2w1l4 < t2h1uwt8 && t2w1l4 < t2h1dwt8
      && t2w1l4 < t2w1r9 && t2w1l4 < t2w1l9 && t2w1l4 < t2h1u9 && t2w1l4 < t2h1d9 && t2w1l4 < t2w1rwt9 && t2w1l4 < t2w1lwt9 && t2w1l4 < t2h1uwt9 && t2w1l4 < t2h1dwt9
      && t2w1l4 < t2w1r10 && t2w1l4 < t2w1l10 && t2w1l4 < t2h1u10 && t2w1l4 < t2h1d10 && t2w1l4 < t2w1rwt10 && t2w1l4 < t2w1lwt10 && t2w1l4 < t2h1uwt10 && t2w1l4 < t2h1dwt10
      && ((loutwl4!=0 && linwl4==0) || (loutwl4==0 && linwl4!=0))){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1l4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1l4+z))*(z0hd4+(vz*t2w1l4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1l4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1l4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1l4+z))*(z0hu4+(vz*t2w1l4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1l4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1l4+y;
  xlimitl=sqrt(pbwl4-(vz*t2w1l4+z)/pawl4);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl4>0){
  i=166;
  }else{
  i=179;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl4!=-1 && t2w1l4 > 0 && t2w1l4 < t1 
      && t2w1l4 < t2w1r && t2w1l4 < t2w1l && t2w1l4 < t2h1u && t2w1l4 < t2h1d && t2w1l4 < t2w1rwt && t2w1l4 < t2w1lwt && t2w1l4 < t2h1uwt && t2w1l4 < t2h1dwt
      && t2w1l4 < t2w1r1 && t2w1l4 < t2w1l1 && t2w1l4 < t2h1u1 && t2w1l4 < t2h1d1 && t2w1l4 < t2w1rwt1 && t2w1l4 < t2w1lwt1 && t2w1l4 < t2h1uwt1 && t2w1l4 < t2h1dwt1
      && t2w1l4 < t2w1r2 && t2w1l4 < t2w1l2 && t2w1l4 < t2h1u2 && t2w1l4 < t2h1d2 && t2w1l4 < t2w1rwt2 && t2w1l4 < t2w1lwt2 && t2w1l4 < t2h1uwt2 && t2w1l4 < t2h1dwt2
      && t2w1l4 < t2w1r3 && t2w1l4 < t2w1l3 && t2w1l4 < t2h1u3 && t2w1l4 < t2h1d3 && t2w1l4 < t2w1rwt3 && t2w1l4 < t2w1lwt3 && t2w1l4 < t2h1uwt3 && t2w1l4 < t2h1dwt3
      && t2w1l4 < t2w1r4 && t2w1l4 < t2h1u4 && t2w1l4 < t2h1d4 && t2w1l4 < t2w1rwt4 && t2w1l4 < t2w1lwt4 && t2w1l4 < t2h1uwt4 && t2w1l4 < t2h1dwt4
      && t2w1l4 < t2w1r5 && t2w1l4 < t2w1l5 && t2w1l4 < t2h1u5 && t2w1l4 < t2h1d5 && t2w1l4 < t2w1rwt5 && t2w1l4 < t2w1lwt5 && t2w1l4 < t2h1uwt5 && t2w1l4 < t2h1dwt5
      && t2w1l4 < t2w1r6 && t2w1l4 < t2w1l6 && t2w1l4 < t2h1u6 && t2w1l4 < t2h1d6 && t2w1l4 < t2w1rwt6 && t2w1l4 < t2w1lwt6 && t2w1l4 < t2h1uwt6 && t2w1l4 < t2h1dwt6
      && t2w1l4 < t2w1r7 && t2w1l4 < t2w1l7 && t2w1l4 < t2h1u7 && t2w1l4 < t2h1d7 && t2w1l4 < t2w1rwt7 && t2w1l4 < t2w1lwt7 && t2w1l4 < t2h1uwt7 && t2w1l4 < t2h1dwt7
      && t2w1l4 < t2w1r8 && t2w1l4 < t2w1l8 && t2w1l4 < t2h1u8 && t2w1l4 < t2h1d8 && t2w1l4 < t2w1rwt8 && t2w1l4 < t2w1lwt8 && t2w1l4 < t2h1uwt8 && t2w1l4 < t2h1dwt8
      && t2w1l4 < t2w1r9 && t2w1l4 < t2w1l9 && t2w1l4 < t2h1u9 && t2w1l4 < t2h1d9 && t2w1l4 < t2w1rwt9 && t2w1l4 < t2w1lwt9 && t2w1l4 < t2h1uwt9 && t2w1l4 < t2h1dwt9
      && t2w1l4 < t2w1r10 && t2w1l4 < t2w1l10 && t2w1l4 < t2h1u10 && t2w1l4 < t2h1d10 && t2w1l4 < t2w1rwt10 && t2w1l4 < t2w1lwt10 && t2w1l4 < t2h1uwt10 && t2w1l4 < t2h1dwt10
      && (loutwl4==0 && linwl4==0)){
 if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1l4+z)-h1d4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhd4*sqrt(1-((z0hd4+(vz*t2w1l4+z))*(z0hd4+(vz*t2w1l4+z)))/a2hd4);
      }else{
      ylimitd=-sqrt(((vz*t2w1l4+z)-pbhd4)/-pahd4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1l4+z)+h1u4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhu4*sqrt(1-((z0hu4+(vz*t2w1l4+z))*(z0hu4+(vz*t2w1l4+z)))/a2hu4);
     }else{
     ylimitu=sqrt(((vz*t2w1l4+z)-pbhu4)/-pahu4);
    }
    }
  ytest=vy*t2w1l4+y;
  xlimitl=(w2l4-w1l4)*(vz*t2w1l4+z)/l+w1l4;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl4>0){
  i=167;
  }else{
  i=179;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu4!=-1 && t2h1u4 > 0 && t2h1u4 < t1 
  && t2h1u4 < t2w1r && t2h1u4 < t2w1l && t2h1u4 < t2h1u && t2h1u4 < t2h1d && t2h1u4 < t2w1rwt && t2h1u4 < t2w1lwt && t2h1u4 < t2h1uwt && t2h1u4 < t2h1dwt
  && t2h1u4 < t2w1r1 && t2h1u4 < t2w1l1 && t2h1u4 < t2h1u1 && t2h1u4 < t2h1d1 && t2h1u4 < t2w1rwt1 && t2h1u4 < t2w1lwt1 && t2h1u4 < t2h1uwt1 && t2h1u4 < t2h1dwt1
  && t2h1u4 < t2w1r2 && t2h1u4 < t2w1l2 && t2h1u4 < t2h1u2 && t2h1u4 < t2h1d2 && t2h1u4 < t2w1rwt2 && t2h1u4 < t2w1lwt2 && t2h1u4 < t2h1uwt2 && t2h1u4 < t2h1dwt2
  && t2h1u4 < t2w1r3 && t2h1u4 < t2w1l3 && t2h1u4 < t2h1u3 && t2h1u4 < t2h1d3 && t2h1u4 < t2w1rwt3 && t2h1u4 < t2w1lwt3 && t2h1u4 < t2h1uwt3 && t2h1u4 < t2h1dwt3
  && t2h1u4 < t2w1r4 && t2h1u4 < t2w1l4 && t2h1u4 < t2h1d4 && t2h1u4 < t2w1rwt4 && t2h1u4 < t2w1lwt4 && t2h1u4 < t2h1uwt4 && t2h1u4 < t2h1dwt4
  && t2h1u4 < t2w1r5 && t2h1u4 < t2w1l5 && t2h1u4 < t2h1u5 && t2h1u4 < t2h1d5 && t2h1u4 < t2w1rwt5 && t2h1u4 < t2w1lwt5 && t2h1u4 < t2h1uwt5 && t2h1u4 < t2h1dwt5
  && t2h1u4 < t2w1r6 && t2h1u4 < t2w1l6 && t2h1u4 < t2h1u6 && t2h1u4 < t2h1d6 && t2h1u4 < t2w1rwt6 && t2h1u4 < t2w1lwt6 && t2h1u4 < t2h1uwt6 && t2h1u4 < t2h1dwt6
  && t2h1u4 < t2w1r7 && t2h1u4 < t2w1l7 && t2h1u4 < t2h1u7 && t2h1u4 < t2h1d7 && t2h1u4 < t2w1rwt7 && t2h1u4 < t2w1lwt7 && t2h1u4 < t2h1uwt7 && t2h1u4 < t2h1dwt7
  && t2h1u4 < t2w1r8 && t2h1u4 < t2w1l8 && t2h1u4 < t2h1u8 && t2h1u4 < t2h1d8 && t2h1u4 < t2w1rwt8 && t2h1u4 < t2w1lwt8 && t2h1u4 < t2h1uwt8 && t2h1u4 < t2h1dwt8
  && t2h1u4 < t2w1r9 && t2h1u4 < t2w1l9 && t2h1u4 < t2h1u9 && t2h1u4 < t2h1d9 && t2h1u4 < t2w1rwt9 && t2h1u4 < t2w1lwt9 && t2h1u4 < t2h1uwt9 && t2h1u4 < t2h1dwt9
  && t2h1u4 < t2w1r10 && t2h1u4 < t2w1l10 && t2h1u4 < t2h1u10 && t2h1u4 < t2h1d10 && t2h1u4 < t2w1rwt10 && t2h1u4 < t2w1lwt10 && t2h1u4 < t2h1uwt10 && t2h1u4 < t2h1dwt10
  && (louthu4 !=0 && linhu4!=0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1u4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1u4+z))*(z0wr4+(vz*t2h1u4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1u4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1u4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1u4+z))*(z0wl4+(vz*t2h1u4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1u4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1u4+x;
  ylimitu=bhu4*sqrt(1-((vz*t2h1u4+z)+z0hu4)*((vz*t2h1u4+z)+z0hu4)/a2hu4);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu4>0 ){
  i=168;
  }else{
  i=180;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu4!=-1 && t2h1u4 > 0 && t2h1u4 < t1
  && t2h1u4 < t2w1r && t2h1u4 < t2w1l && t2h1u4 < t2h1u && t2h1u4 < t2h1d && t2h1u4 < t2w1rwt && t2h1u4 < t2w1lwt && t2h1u4 < t2h1uwt && t2h1u4 < t2h1dwt
  && t2h1u4 < t2w1r1 && t2h1u4 < t2w1l1 && t2h1u4 < t2h1u1 && t2h1u4 < t2h1d1 && t2h1u4 < t2w1rwt1 && t2h1u4 < t2w1lwt1 && t2h1u4 < t2h1uwt1 && t2h1u4 < t2h1dwt1
  && t2h1u4 < t2w1r2 && t2h1u4 < t2w1l2 && t2h1u4 < t2h1u2 && t2h1u4 < t2h1d2 && t2h1u4 < t2w1rwt2 && t2h1u4 < t2w1lwt2 && t2h1u4 < t2h1uwt2 && t2h1u4 < t2h1dwt2
  && t2h1u4 < t2w1r3 && t2h1u4 < t2w1l3 && t2h1u4 < t2h1u3 && t2h1u4 < t2h1d3 && t2h1u4 < t2w1rwt3 && t2h1u4 < t2w1lwt3 && t2h1u4 < t2h1uwt3 && t2h1u4 < t2h1dwt3
  && t2h1u4 < t2w1r4 && t2h1u4 < t2w1l4 && t2h1u4 < t2h1d4 && t2h1u4 < t2w1rwt4 && t2h1u4 < t2w1lwt4 && t2h1u4 < t2h1uwt4 && t2h1u4 < t2h1dwt4
  && t2h1u4 < t2w1r5 && t2h1u4 < t2w1l5 && t2h1u4 < t2h1u5 && t2h1u4 < t2h1d5 && t2h1u4 < t2w1rwt5 && t2h1u4 < t2w1lwt5 && t2h1u4 < t2h1uwt5 && t2h1u4 < t2h1dwt5
  && t2h1u4 < t2w1r6 && t2h1u4 < t2w1l6 && t2h1u4 < t2h1u6 && t2h1u4 < t2h1d6 && t2h1u4 < t2w1rwt6 && t2h1u4 < t2w1lwt6 && t2h1u4 < t2h1uwt6 && t2h1u4 < t2h1dwt6
  && t2h1u4 < t2w1r7 && t2h1u4 < t2w1l7 && t2h1u4 < t2h1u7 && t2h1u4 < t2h1d7 && t2h1u4 < t2w1rwt7 && t2h1u4 < t2w1lwt7 && t2h1u4 < t2h1uwt7 && t2h1u4 < t2h1dwt7
  && t2h1u4 < t2w1r8 && t2h1u4 < t2w1l8 && t2h1u4 < t2h1u8 && t2h1u4 < t2h1d8 && t2h1u4 < t2w1rwt8 && t2h1u4 < t2w1lwt8 && t2h1u4 < t2h1uwt8 && t2h1u4 < t2h1dwt8
  && t2h1u4 < t2w1r9 && t2h1u4 < t2w1l9 && t2h1u4 < t2h1u9 && t2h1u4 < t2h1d9 && t2h1u4 < t2w1rwt9 && t2h1u4 < t2w1lwt9 && t2h1u4 < t2h1uwt9 && t2h1u4 < t2h1dwt9
  && t2h1u4 < t2w1r10 && t2h1u4 < t2w1l10 && t2h1u4 < t2h1u10 && t2h1u4 < t2h1d10 && t2h1u4 < t2w1rwt10 && t2h1u4 < t2w1lwt10 && t2h1u4 < t2h1uwt10 && t2h1u4 < t2h1dwt10 
  && ((louthu4!=0 && linhu4==0) || (louthu4==0 && linhu4!=0))){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1u4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1u4+z))*(z0wr4+(vz*t2h1u4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1u4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1u4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1u4+z))*(z0wl4+(vz*t2h1u4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1u4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1u4+x;
  ylimitu=sqrt(pbhu4-(vz*t2h1u4+z)/pahu4);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu4>0){
  i=169;
  }else{
  i=180;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu4!=-1 && t2h1u4 > 0 && t2h1u4 < t1
  && t2h1u4 < t2w1r && t2h1u4 < t2w1l && t2h1u4 < t2h1u && t2h1u4 < t2h1d && t2h1u4 < t2w1rwt && t2h1u4 < t2w1lwt && t2h1u4 < t2h1uwt && t2h1u4 < t2h1dwt
  && t2h1u4 < t2w1r1 && t2h1u4 < t2w1l1 && t2h1u4 < t2h1u1 && t2h1u4 < t2h1d1 && t2h1u4 < t2w1rwt1 && t2h1u4 < t2w1lwt1 && t2h1u4 < t2h1uwt1 && t2h1u4 < t2h1dwt1
  && t2h1u4 < t2w1r2 && t2h1u4 < t2w1l2 && t2h1u4 < t2h1u2 && t2h1u4 < t2h1d2 && t2h1u4 < t2w1rwt2 && t2h1u4 < t2w1lwt2 && t2h1u4 < t2h1uwt2 && t2h1u4 < t2h1dwt2
  && t2h1u4 < t2w1r3 && t2h1u4 < t2w1l3 && t2h1u4 < t2h1u3 && t2h1u4 < t2h1d3 && t2h1u4 < t2w1rwt3 && t2h1u4 < t2w1lwt3 && t2h1u4 < t2h1uwt3 && t2h1u4 < t2h1dwt3
  && t2h1u4 < t2w1r4 && t2h1u4 < t2w1l4 && t2h1u4 < t2h1d4 && t2h1u4 < t2w1rwt4 && t2h1u4 < t2w1lwt4 && t2h1u4 < t2h1uwt4 && t2h1u4 < t2h1dwt4
  && t2h1u4 < t2w1r5 && t2h1u4 < t2w1l5 && t2h1u4 < t2h1u5 && t2h1u4 < t2h1d5 && t2h1u4 < t2w1rwt5 && t2h1u4 < t2w1lwt5 && t2h1u4 < t2h1uwt5 && t2h1u4 < t2h1dwt5
  && t2h1u4 < t2w1r6 && t2h1u4 < t2w1l6 && t2h1u4 < t2h1u6 && t2h1u4 < t2h1d6 && t2h1u4 < t2w1rwt6 && t2h1u4 < t2w1lwt6 && t2h1u4 < t2h1uwt6 && t2h1u4 < t2h1dwt6
  && t2h1u4 < t2w1r7 && t2h1u4 < t2w1l7 && t2h1u4 < t2h1u7 && t2h1u4 < t2h1d7 && t2h1u4 < t2w1rwt7 && t2h1u4 < t2w1lwt7 && t2h1u4 < t2h1uwt7 && t2h1u4 < t2h1dwt7
  && t2h1u4 < t2w1r8 && t2h1u4 < t2w1l8 && t2h1u4 < t2h1u8 && t2h1u4 < t2h1d8 && t2h1u4 < t2w1rwt8 && t2h1u4 < t2w1lwt8 && t2h1u4 < t2h1uwt8 && t2h1u4 < t2h1dwt8
  && t2h1u4 < t2w1r9 && t2h1u4 < t2w1l9 && t2h1u4 < t2h1u9 && t2h1u4 < t2h1d9 && t2h1u4 < t2w1rwt9 && t2h1u4 < t2w1lwt9 && t2h1u4 < t2h1uwt9 && t2h1u4 < t2h1dwt9
  && t2h1u4 < t2w1r10 && t2h1u4 < t2w1l10 && t2h1u4 < t2h1u10 && t2h1u4 < t2h1d10 && t2h1u4 < t2w1rwt10 && t2h1u4 < t2w1lwt10 && t2h1u4 < t2h1uwt10 && t2h1u4 < t2h1dwt10
  && (louthu4 == 0 && linhu4 == 0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1u4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1u4+z))*(z0wr4+(vz*t2h1u4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1u4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1u4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1u4+z))*(z0wl4+(vz*t2h1u4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1u4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1u4+x;
  ylimitu=(h2u4-h1u4)*(vz*t2h1u4+z)/l+h1u4;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu4>0 ){
  i=170;
  }else{
  i=180;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd4!=-1 && t2h1d4 > 0 && t2h1d4 < t1 
  && t2h1d4 < t2w1r && t2h1d4 < t2w1l && t2h1d4 < t2h1u && t2h1d4 < t2h1d && t2h1d4 < t2w1rwt && t2h1d4 < t2w1lwt && t2h1d4 < t2h1uwt && t2h1d4 < t2h1dwt
  && t2h1d4 < t2w1r1 && t2h1d4 < t2w1l1 && t2h1d4 < t2h1u1 && t2h1d4 < t2h1d1 && t2h1d4 < t2w1rwt1 && t2h1d4 < t2w1lwt1 && t2h1d4 < t2h1uwt1 && t2h1d4 < t2h1dwt1
  && t2h1d4 < t2w1r2 && t2h1d4 < t2w1l2 && t2h1d4 < t2h1u2 && t2h1d4 < t2h1d2 && t2h1d4 < t2w1rwt2 && t2h1d4 < t2w1lwt2 && t2h1d4 < t2h1uwt2 && t2h1d4 < t2h1dwt2
  && t2h1d4 < t2w1r3 && t2h1d4 < t2w1l3 && t2h1d4 < t2h1u3 && t2h1d4 < t2h1d3 && t2h1d4 < t2w1rwt3 && t2h1d4 < t2w1lwt3 && t2h1d4 < t2h1uwt3 && t2h1d4 < t2h1dwt3
  && t2h1d4 < t2w1r4 && t2h1d4 < t2w1l4 && t2h1d4 < t2h1u4 && t2h1d4 < t2w1rwt4 && t2h1d4 < t2w1lwt4 && t2h1d4 < t2h1uwt4 && t2h1d4 < t2h1dwt4
  && t2h1d4 < t2w1r5 && t2h1d4 < t2w1l5 && t2h1d4 < t2h1u5 && t2h1d4 < t2h1d5 && t2h1d4 < t2w1rwt5 && t2h1d4 < t2w1lwt5 && t2h1d4 < t2h1uwt5 && t2h1d4 < t2h1dwt5
  && t2h1d4 < t2w1r6 && t2h1d4 < t2w1l6 && t2h1d4 < t2h1u6 && t2h1d4 < t2h1d6 && t2h1d4 < t2w1rwt6 && t2h1d4 < t2w1lwt6 && t2h1d4 < t2h1uwt6 && t2h1d4 < t2h1dwt6
  && t2h1d4 < t2w1r7 && t2h1d4 < t2w1l7 && t2h1d4 < t2h1u7 && t2h1d4 < t2h1d7 && t2h1d4 < t2w1rwt7 && t2h1d4 < t2w1lwt7 && t2h1d4 < t2h1uwt7 && t2h1d4 < t2h1dwt7
  && t2h1d4 < t2w1r8 && t2h1d4 < t2w1l8 && t2h1d4 < t2h1u8 && t2h1d4 < t2h1d8 && t2h1d4 < t2w1rwt8 && t2h1d4 < t2w1lwt8 && t2h1d4 < t2h1uwt8 && t2h1d4 < t2h1dwt8
  && t2h1d4 < t2w1r9 && t2h1d4 < t2w1l9 && t2h1d4 < t2h1u9 && t2h1d4 < t2h1d9 && t2h1d4 < t2w1rwt9 && t2h1d4 < t2w1lwt9 && t2h1d4 < t2h1uwt9 && t2h1d4 < t2h1dwt9
  && t2h1d4 < t2w1r10 && t2h1d4 < t2w1l10 && t2h1d4 < t2h1u10 && t2h1d4 < t2h1d10 && t2h1d4 < t2w1rwt10 && t2h1d4 < t2w1lwt10 && t2h1d4 < t2h1uwt10 && t2h1d4 < t2h1dwt10
  && (louthd4 !=0 && linhd4!=0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1d4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1d4+z))*(z0wr4+(vz*t2h1d4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1d4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1d4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1d4+z))*(z0wl4+(vz*t2h1d4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1d4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1d4+x;
  ylimitd=-bhd4*sqrt(1-((vz*t2h1d4+z)+z0hd4)*((vz*t2h1d4+z)+z0hd4)/a2hd4);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd4>0){
  i=171;
  }else{
  i=181;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd4!=-1 && t2h1d4 > 0 && t2h1d4 < t1 
  && t2h1d4 < t2w1r && t2h1d4 < t2w1l && t2h1d4 < t2h1u && t2h1d4 < t2h1d && t2h1d4 < t2w1rwt && t2h1d4 < t2w1lwt && t2h1d4 < t2h1uwt && t2h1d4 < t2h1dwt
  && t2h1d4 < t2w1r1 && t2h1d4 < t2w1l1 && t2h1d4 < t2h1u1 && t2h1d4 < t2h1d1 && t2h1d4 < t2w1rwt1 && t2h1d4 < t2w1lwt1 && t2h1d4 < t2h1uwt1 && t2h1d4 < t2h1dwt1
  && t2h1d4 < t2w1r2 && t2h1d4 < t2w1l2 && t2h1d4 < t2h1u2 && t2h1d4 < t2h1d2 && t2h1d4 < t2w1rwt2 && t2h1d4 < t2w1lwt2 && t2h1d4 < t2h1uwt2 && t2h1d4 < t2h1dwt2
  && t2h1d4 < t2w1r3 && t2h1d4 < t2w1l3 && t2h1d4 < t2h1u3 && t2h1d4 < t2h1d3 && t2h1d4 < t2w1rwt3 && t2h1d4 < t2w1lwt3 && t2h1d4 < t2h1uwt3 && t2h1d4 < t2h1dwt3
  && t2h1d4 < t2w1r4 && t2h1d4 < t2w1l4 && t2h1d4 < t2h1u4 && t2h1d4 < t2w1rwt4 && t2h1d4 < t2w1lwt4 && t2h1d4 < t2h1uwt4 && t2h1d4 < t2h1dwt4
  && t2h1d4 < t2w1r5 && t2h1d4 < t2w1l5 && t2h1d4 < t2h1u5 && t2h1d4 < t2h1d5 && t2h1d4 < t2w1rwt5 && t2h1d4 < t2w1lwt5 && t2h1d4 < t2h1uwt5 && t2h1d4 < t2h1dwt5
  && t2h1d4 < t2w1r6 && t2h1d4 < t2w1l6 && t2h1d4 < t2h1u6 && t2h1d4 < t2h1d6 && t2h1d4 < t2w1rwt6 && t2h1d4 < t2w1lwt6 && t2h1d4 < t2h1uwt6 && t2h1d4 < t2h1dwt6
  && t2h1d4 < t2w1r7 && t2h1d4 < t2w1l7 && t2h1d4 < t2h1u7 && t2h1d4 < t2h1d7 && t2h1d4 < t2w1rwt7 && t2h1d4 < t2w1lwt7 && t2h1d4 < t2h1uwt7 && t2h1d4 < t2h1dwt7
  && t2h1d4 < t2w1r8 && t2h1d4 < t2w1l8 && t2h1d4 < t2h1u8 && t2h1d4 < t2h1d8 && t2h1d4 < t2w1rwt8 && t2h1d4 < t2w1lwt8 && t2h1d4 < t2h1uwt8 && t2h1d4 < t2h1dwt8
  && t2h1d4 < t2w1r9 && t2h1d4 < t2w1l9 && t2h1d4 < t2h1u9 && t2h1d4 < t2h1d9 && t2h1d4 < t2w1rwt9 && t2h1d4 < t2w1lwt9 && t2h1d4 < t2h1uwt9 && t2h1d4 < t2h1dwt9
  && t2h1d4 < t2w1r10 && t2h1d4 < t2w1l10 && t2h1d4 < t2h1u10 && t2h1d4 < t2h1d10 && t2h1d4 < t2w1rwt10 && t2h1d4 < t2w1lwt10 && t2h1d4 < t2h1uwt10 && t2h1d4 < t2h1dwt10
  && ((louthd4 !=0 && linhd4==0) || (louthd4 ==0 && linhd4!=0))){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1d4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1d4+z))*(z0wr4+(vz*t2h1d4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1d4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1d4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1d4+z))*(z0wl4+(vz*t2h1d4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1d4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1d4+x;
  ylimitd=-sqrt(pbhd4-(vz*t2h1d4+z)/pahd4);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd4>0 ){
  i=172;
  }else{
  i=181;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd4!=-1 && t2h1d4 > 0 && t2h1d4 < t1 
  && t2h1d4 < t2w1r && t2h1d4 < t2w1l && t2h1d4 < t2h1u && t2h1d4 < t2h1d && t2h1d4 < t2w1rwt && t2h1d4 < t2w1lwt && t2h1d4 < t2h1uwt && t2h1d4 < t2h1dwt
  && t2h1d4 < t2w1r1 && t2h1d4 < t2w1l1 && t2h1d4 < t2h1u1 && t2h1d4 < t2h1d1 && t2h1d4 < t2w1rwt1 && t2h1d4 < t2w1lwt1 && t2h1d4 < t2h1uwt1 && t2h1d4 < t2h1dwt1
  && t2h1d4 < t2w1r2 && t2h1d4 < t2w1l2 && t2h1d4 < t2h1u2 && t2h1d4 < t2h1d2 && t2h1d4 < t2w1rwt2 && t2h1d4 < t2w1lwt2 && t2h1d4 < t2h1uwt2 && t2h1d4 < t2h1dwt2
  && t2h1d4 < t2w1r3 && t2h1d4 < t2w1l3 && t2h1d4 < t2h1u3 && t2h1d4 < t2h1d3 && t2h1d4 < t2w1rwt3 && t2h1d4 < t2w1lwt3 && t2h1d4 < t2h1uwt3 && t2h1d4 < t2h1dwt3
  && t2h1d4 < t2w1r4 && t2h1d4 < t2w1l4 && t2h1d4 < t2h1u4 && t2h1d4 < t2w1rwt4 && t2h1d4 < t2w1lwt4 && t2h1d4 < t2h1uwt4 && t2h1d4 < t2h1dwt4
  && t2h1d4 < t2w1r5 && t2h1d4 < t2w1l5 && t2h1d4 < t2h1u5 && t2h1d4 < t2h1d5 && t2h1d4 < t2w1rwt5 && t2h1d4 < t2w1lwt5 && t2h1d4 < t2h1uwt5 && t2h1d4 < t2h1dwt5
  && t2h1d4 < t2w1r6 && t2h1d4 < t2w1l6 && t2h1d4 < t2h1u6 && t2h1d4 < t2h1d6 && t2h1d4 < t2w1rwt6 && t2h1d4 < t2w1lwt6 && t2h1d4 < t2h1uwt6 && t2h1d4 < t2h1dwt6
  && t2h1d4 < t2w1r7 && t2h1d4 < t2w1l7 && t2h1d4 < t2h1u7 && t2h1d4 < t2h1d7 && t2h1d4 < t2w1rwt7 && t2h1d4 < t2w1lwt7 && t2h1d4 < t2h1uwt7 && t2h1d4 < t2h1dwt7
  && t2h1d4 < t2w1r8 && t2h1d4 < t2w1l8 && t2h1d4 < t2h1u8 && t2h1d4 < t2h1d8 && t2h1d4 < t2w1rwt8 && t2h1d4 < t2w1lwt8 && t2h1d4 < t2h1uwt8 && t2h1d4 < t2h1dwt8
  && t2h1d4 < t2w1r9 && t2h1d4 < t2w1l9 && t2h1d4 < t2h1u9 && t2h1d4 < t2h1d9 && t2h1d4 < t2w1rwt9 && t2h1d4 < t2w1lwt9 && t2h1d4 < t2h1uwt9 && t2h1d4 < t2h1dwt9
  && t2h1d4 < t2w1r10 && t2h1d4 < t2w1l10 && t2h1d4 < t2h1u10 && t2h1d4 < t2h1d10 && t2h1d4 < t2w1rwt10 && t2h1d4 < t2w1lwt10 && t2h1d4 < t2h1uwt10 && t2h1d4 < t2h1dwt10
  && (louthd4 == 0 && linhd4 == 0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1d4+z)-w1r4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwr4*sqrt(1-((z0wr4+(vz*t2h1d4+z))*(z0wr4+(vz*t2h1d4+z)))/a2wr4);
    }else{
    xlimitr=-sqrt(((vz*t2h1d4+z)-pbwr4)/-pawr4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1d4+z)+w1l4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwl4*sqrt(1-((z0wl4+(vz*t2h1d4+z))*(z0wl4+(vz*t2h1d4+z)))/a2wl4);
      }else{
      xlimitl=sqrt(((vz*t2h1d4+z)-pbwl4)/-pawl4);
      }
   }
  xtest=vx*t2h1d4+x;
  ylimitd=(-h2d4+h1d4)*(vz*t2h1d4+z)/l-h1d4;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd4>0 ){
  i=173;
  }else{
  i=181;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr4==-1 && t2w1r4 > 0 && t2w1r4 < t1 
     && t2w1r4 < t2w1r && t2w1r4 < t2w1l && t2w1r4 < t2h1u && t2w1r4 < t2h1d && t2w1r4 < t2w1rwt && t2w1r4 < t2w1lwt && t2w1r4 < t2h1uwt && t2w1r4 < t2h1dwt
     && t2w1r4 < t2w1r1 && t2w1r4 < t2w1l1 && t2w1r4 < t2h1u1 && t2w1r4 < t2h1d1 && t2w1r4 < t2w1rwt1 && t2w1r4 < t2w1lwt1 && t2w1r4 < t2h1uwt1 && t2w1r4 < t2h1dwt1
     && t2w1r4 < t2w1r2 && t2w1r4 < t2w1l2 && t2w1r4 < t2h1u2 && t2w1r4 < t2h1d2 && t2w1r4 < t2w1rwt2 && t2w1r4 < t2w1lwt2 && t2w1r4 < t2h1uwt2 && t2w1r4 < t2h1dwt2 
     && t2w1r4 < t2w1r3 && t2w1r4 < t2w1l3 && t2w1r4 < t2h1u3 && t2w1r4 < t2h1d3 && t2w1r4 < t2w1rwt3 && t2w1r4 < t2w1lwt3 && t2w1r4 < t2h1uwt3 && t2w1r4 < t2h1dwt3
     && t2w1r4 < t2w1l4 && t2w1r4 < t2h1u4 && t2w1r4 < t2h1d4 && t2w1r4 < t2w1rwt4 && t2w1r4 < t2w1lwt4 && t2w1r4 < t2h1uwt4 && t2w1r4 < t2h1dwt4
     && t2w1r4 < t2w1r5 && t2w1r4 < t2w1l5 && t2w1r4 < t2h1u5 && t2w1r4 < t2h1d5 && t2w1r4 < t2w1rwt5 && t2w1r4 < t2w1lwt5 && t2w1r4 < t2h1uwt5 && t2w1r4 < t2h1dwt5
     && t2w1r4 < t2w1r6 && t2w1r4 < t2w1l6 && t2w1r4 < t2h1u6 && t2w1r4 < t2h1d6 && t2w1r4 < t2w1rwt6 && t2w1r4 < t2w1lwt6 && t2w1r4 < t2h1uwt6 && t2w1r4 < t2h1dwt6
     && t2w1r4 < t2w1r7 && t2w1r4 < t2w1l7 && t2w1r4 < t2h1u7 && t2w1r4 < t2h1d7 && t2w1r4 < t2w1rwt7 && t2w1r4 < t2w1lwt7 && t2w1r4 < t2h1uwt7 && t2w1r4 < t2h1dwt7
     && t2w1r4 < t2w1r8 && t2w1r4 < t2w1l8 && t2w1r4 < t2h1u8 && t2w1r4 < t2h1d8 && t2w1r4 < t2w1rwt8 && t2w1r4 < t2w1lwt8 && t2w1r4 < t2h1uwt8 && t2w1r4 < t2h1dwt8
     && t2w1r4 < t2w1r9 && t2w1r4 < t2w1l9 && t2w1r4 < t2h1u9 && t2w1r4 < t2h1d9 && t2w1r4 < t2w1rwt9 && t2w1r4 < t2w1lwt9 && t2w1r4 < t2h1uwt9 && t2w1r4 < t2h1dwt9
     && t2w1r4 < t2w1r10 && t2w1r4 < t2w1l10 && t2w1r4 < t2h1u10 && t2w1r4 < t2h1d10 && t2w1r4 < t2w1rwt10 && t2w1r4 < t2w1lwt10 && t2w1r4 < t2h1uwt10 && t2w1r4 < t2h1dwt10
     && ((linwr4!=0) && (loutwr4!=0) )) {
  i=174;
  }

  if (mxr4==-1 && t2w1r4 > 0 && t2w1r4 < t1 
     && t2w1r4 < t2w1r && t2w1r4 < t2w1l && t2w1r4 < t2h1u && t2w1r4 < t2h1d && t2w1r4 < t2w1rwt && t2w1r4 < t2w1lwt && t2w1r4 < t2h1uwt && t2w1r4 < t2h1dwt
     && t2w1r4 < t2w1r1 && t2w1r4 < t2w1l1 && t2w1r4 < t2h1u1 && t2w1r4 < t2h1d1 && t2w1r4 < t2w1rwt1 && t2w1r4 < t2w1lwt1 && t2w1r4 < t2h1uwt1 && t2w1r4 < t2h1dwt1
     && t2w1r4 < t2w1r2 && t2w1r4 < t2w1l2 && t2w1r4 < t2h1u2 && t2w1r4 < t2h1d2 && t2w1r4 < t2w1rwt2 && t2w1r4 < t2w1lwt2 && t2w1r4 < t2h1uwt2 && t2w1r4 < t2h1dwt2 
     && t2w1r4 < t2w1r3 && t2w1r4 < t2w1l3 && t2w1r4 < t2h1u3 && t2w1r4 < t2h1d3 && t2w1r4 < t2w1rwt3 && t2w1r4 < t2w1lwt3 && t2w1r4 < t2h1uwt3 && t2w1r4 < t2h1dwt3
     && t2w1r4 < t2w1l4 && t2w1r4 < t2h1u4 && t2w1r4 < t2h1d4 && t2w1r4 < t2w1rwt4 && t2w1r4 < t2w1lwt4 && t2w1r4 < t2h1uwt4 && t2w1r4 < t2h1dwt4
     && t2w1r4 < t2w1r5 && t2w1r4 < t2w1l5 && t2w1r4 < t2h1u5 && t2w1r4 < t2h1d5 && t2w1r4 < t2w1rwt5 && t2w1r4 < t2w1lwt5 && t2w1r4 < t2h1uwt5 && t2w1r4 < t2h1dwt5
     && t2w1r4 < t2w1r6 && t2w1r4 < t2w1l6 && t2w1r4 < t2h1u6 && t2w1r4 < t2h1d6 && t2w1r4 < t2w1rwt6 && t2w1r4 < t2w1lwt6 && t2w1r4 < t2h1uwt6 && t2w1r4 < t2h1dwt6
     && t2w1r4 < t2w1r7 && t2w1r4 < t2w1l7 && t2w1r4 < t2h1u7 && t2w1r4 < t2h1d7 && t2w1r4 < t2w1rwt7 && t2w1r4 < t2w1lwt7 && t2w1r4 < t2h1uwt7 && t2w1r4 < t2h1dwt7
     && t2w1r4 < t2w1r8 && t2w1r4 < t2w1l8 && t2w1r4 < t2h1u8 && t2w1r4 < t2h1d8 && t2w1r4 < t2w1rwt8 && t2w1r4 < t2w1lwt8 && t2w1r4 < t2h1uwt8 && t2w1r4 < t2h1dwt8
     && t2w1r4 < t2w1r9 && t2w1r4 < t2w1l9 && t2w1r4 < t2h1u9 && t2w1r4 < t2h1d9 && t2w1r4 < t2w1rwt9 && t2w1r4 < t2w1lwt9 && t2w1r4 < t2h1uwt9 && t2w1r4 < t2h1dwt9
     && t2w1r4 < t2w1r10 && t2w1r4 < t2w1l10 && t2w1r4 < t2h1u10 && t2w1r4 < t2h1d10 && t2w1r4 < t2w1rwt10 && t2w1r4 < t2w1lwt10 && t2w1r4 < t2h1uwt10 && t2w1r4 < t2h1dwt10
     && ((loutwr4!=0 && linwr4==0) || (loutwr4==0 && linwr4!=0))){
  i=174;
  }

  if (mxr4==-1 && t2w1r4 > 0 && t2w1r4 < t1 
     && t2w1r4 < t2w1r && t2w1r4 < t2w1l && t2w1r4 < t2h1u && t2w1r4 < t2h1d && t2w1r4 < t2w1rwt && t2w1r4 < t2w1lwt && t2w1r4 < t2h1uwt && t2w1r4 < t2h1dwt
     && t2w1r4 < t2w1r1 && t2w1r4 < t2w1l1 && t2w1r4 < t2h1u1 && t2w1r4 < t2h1d1 && t2w1r4 < t2w1rwt1 && t2w1r4 < t2w1lwt1 && t2w1r4 < t2h1uwt1 && t2w1r4 < t2h1dwt1
     && t2w1r4 < t2w1r2 && t2w1r4 < t2w1l2 && t2w1r4 < t2h1u2 && t2w1r4 < t2h1d2 && t2w1r4 < t2w1rwt2 && t2w1r4 < t2w1lwt2 && t2w1r4 < t2h1uwt2 && t2w1r4 < t2h1dwt2 
     && t2w1r4 < t2w1r3 && t2w1r4 < t2w1l3 && t2w1r4 < t2h1u3 && t2w1r4 < t2h1d3 && t2w1r4 < t2w1rwt3 && t2w1r4 < t2w1lwt3 && t2w1r4 < t2h1uwt3 && t2w1r4 < t2h1dwt3
     && t2w1r4 < t2w1l4 && t2w1r4 < t2h1u4 && t2w1r4 < t2h1d4 && t2w1r4 < t2w1rwt4 && t2w1r4 < t2w1lwt4 && t2w1r4 < t2h1uwt4 && t2w1r4 < t2h1dwt4
     && t2w1r4 < t2w1r5 && t2w1r4 < t2w1l5 && t2w1r4 < t2h1u5 && t2w1r4 < t2h1d5 && t2w1r4 < t2w1rwt5 && t2w1r4 < t2w1lwt5 && t2w1r4 < t2h1uwt5 && t2w1r4 < t2h1dwt5
     && t2w1r4 < t2w1r6 && t2w1r4 < t2w1l6 && t2w1r4 < t2h1u6 && t2w1r4 < t2h1d6 && t2w1r4 < t2w1rwt6 && t2w1r4 < t2w1lwt6 && t2w1r4 < t2h1uwt6 && t2w1r4 < t2h1dwt6
     && t2w1r4 < t2w1r7 && t2w1r4 < t2w1l7 && t2w1r4 < t2h1u7 && t2w1r4 < t2h1d7 && t2w1r4 < t2w1rwt7 && t2w1r4 < t2w1lwt7 && t2w1r4 < t2h1uwt7 && t2w1r4 < t2h1dwt7
     && t2w1r4 < t2w1r8 && t2w1r4 < t2w1l8 && t2w1r4 < t2h1u8 && t2w1r4 < t2h1d8 && t2w1r4 < t2w1rwt8 && t2w1r4 < t2w1lwt8 && t2w1r4 < t2h1uwt8 && t2w1r4 < t2h1dwt8
     && t2w1r4 < t2w1r9 && t2w1r4 < t2w1l9 && t2w1r4 < t2h1u9 && t2w1r4 < t2h1d9 && t2w1r4 < t2w1rwt9 && t2w1r4 < t2w1lwt9 && t2w1r4 < t2h1uwt9 && t2w1r4 < t2h1dwt9
     && t2w1r4 < t2w1r10 && t2w1r4 < t2w1l10 && t2w1r4 < t2h1u10 && t2w1r4 < t2h1d10 && t2w1r4 < t2w1rwt10 && t2w1r4 < t2w1lwt10 && t2w1r4 < t2h1uwt10 && t2w1r4 < t2h1dwt10
     && (loutwr4==0 && linwr4==0)){
  i=174;
  }

  if (mxl4==-1 && t2w1l4 > 0 && t2w1l4 < t1 
      && t2w1l4 < t2w1r && t2w1l4 < t2w1l && t2w1l4 < t2h1u && t2w1l4 < t2h1d && t2w1l4 < t2w1rwt && t2w1l4 < t2w1lwt && t2w1l4 < t2h1uwt && t2w1l4 < t2h1dwt
      && t2w1l4 < t2w1r1 && t2w1l4 < t2w1l1 && t2w1l4 < t2h1u1 && t2w1l4 < t2h1d1 && t2w1l4 < t2w1rwt1 && t2w1l4 < t2w1lwt1 && t2w1l4 < t2h1uwt1 && t2w1l4 < t2h1dwt1
      && t2w1l4 < t2w1r2 && t2w1l4 < t2w1l2 && t2w1l4 < t2h1u2 && t2w1l4 < t2h1d2 && t2w1l4 < t2w1rwt2 && t2w1l4 < t2w1lwt2 && t2w1l4 < t2h1uwt2 && t2w1l4 < t2h1dwt2
      && t2w1l4 < t2w1r3 && t2w1l4 < t2w1l3 && t2w1l4 < t2h1u3 && t2w1l4 < t2h1d3 && t2w1l4 < t2w1rwt3 && t2w1l4 < t2w1lwt3 && t2w1l4 < t2h1uwt3 && t2w1l4 < t2h1dwt3
      && t2w1l4 < t2w1r4 && t2w1l4 < t2h1u4 && t2w1l4 < t2h1d4 && t2w1l4 < t2w1rwt4 && t2w1l4 < t2w1lwt4 && t2w1l4 < t2h1uwt4 && t2w1l4 < t2h1dwt4
      && t2w1l4 < t2w1r5 && t2w1l4 < t2w1l5 && t2w1l4 < t2h1u5 && t2w1l4 < t2h1d5 && t2w1l4 < t2w1rwt5 && t2w1l4 < t2w1lwt5 && t2w1l4 < t2h1uwt5 && t2w1l4 < t2h1dwt5
      && t2w1l4 < t2w1r6 && t2w1l4 < t2w1l6 && t2w1l4 < t2h1u6 && t2w1l4 < t2h1d6 && t2w1l4 < t2w1rwt6 && t2w1l4 < t2w1lwt6 && t2w1l4 < t2h1uwt6 && t2w1l4 < t2h1dwt6
      && t2w1l4 < t2w1r7 && t2w1l4 < t2w1l7 && t2w1l4 < t2h1u7 && t2w1l4 < t2h1d7 && t2w1l4 < t2w1rwt7 && t2w1l4 < t2w1lwt7 && t2w1l4 < t2h1uwt7 && t2w1l4 < t2h1dwt7
      && t2w1l4 < t2w1r8 && t2w1l4 < t2w1l8 && t2w1l4 < t2h1u8 && t2w1l4 < t2h1d8 && t2w1l4 < t2w1rwt8 && t2w1l4 < t2w1lwt8 && t2w1l4 < t2h1uwt8 && t2w1l4 < t2h1dwt8
      && t2w1l4 < t2w1r9 && t2w1l4 < t2w1l9 && t2w1l4 < t2h1u9 && t2w1l4 < t2h1d9 && t2w1l4 < t2w1rwt9 && t2w1l4 < t2w1lwt9 && t2w1l4 < t2h1uwt9 && t2w1l4 < t2h1dwt9
      && t2w1l4 < t2w1r10 && t2w1l4 < t2w1l10 && t2w1l4 < t2h1u10 && t2w1l4 < t2h1d10 && t2w1l4 < t2w1rwt10 && t2w1l4 < t2w1lwt10 && t2w1l4 < t2h1uwt10 && t2w1l4 < t2h1dwt10
      && ((linwl4!=0) && (loutwl4!=0) )){
  i=175;
  }

  if (mxl4==-1 && t2w1l4 > 0 && t2w1l4 < t1 
      && t2w1l4 < t2w1r && t2w1l4 < t2w1l && t2w1l4 < t2h1u && t2w1l4 < t2h1d && t2w1l4 < t2w1rwt && t2w1l4 < t2w1lwt && t2w1l4 < t2h1uwt && t2w1l4 < t2h1dwt
      && t2w1l4 < t2w1r1 && t2w1l4 < t2w1l1 && t2w1l4 < t2h1u1 && t2w1l4 < t2h1d1 && t2w1l4 < t2w1rwt1 && t2w1l4 < t2w1lwt1 && t2w1l4 < t2h1uwt1 && t2w1l4 < t2h1dwt1
      && t2w1l4 < t2w1r2 && t2w1l4 < t2w1l2 && t2w1l4 < t2h1u2 && t2w1l4 < t2h1d2 && t2w1l4 < t2w1rwt2 && t2w1l4 < t2w1lwt2 && t2w1l4 < t2h1uwt2 && t2w1l4 < t2h1dwt2
      && t2w1l4 < t2w1r3 && t2w1l4 < t2w1l3 && t2w1l4 < t2h1u3 && t2w1l4 < t2h1d3 && t2w1l4 < t2w1rwt3 && t2w1l4 < t2w1lwt3 && t2w1l4 < t2h1uwt3 && t2w1l4 < t2h1dwt3
      && t2w1l4 < t2w1r4 && t2w1l4 < t2h1u4 && t2w1l4 < t2h1d4 && t2w1l4 < t2w1rwt4 && t2w1l4 < t2w1lwt4 && t2w1l4 < t2h1uwt4 && t2w1l4 < t2h1dwt4
      && t2w1l4 < t2w1r5 && t2w1l4 < t2w1l5 && t2w1l4 < t2h1u5 && t2w1l4 < t2h1d5 && t2w1l4 < t2w1rwt5 && t2w1l4 < t2w1lwt5 && t2w1l4 < t2h1uwt5 && t2w1l4 < t2h1dwt5
      && t2w1l4 < t2w1r6 && t2w1l4 < t2w1l6 && t2w1l4 < t2h1u6 && t2w1l4 < t2h1d6 && t2w1l4 < t2w1rwt6 && t2w1l4 < t2w1lwt6 && t2w1l4 < t2h1uwt6 && t2w1l4 < t2h1dwt6
      && t2w1l4 < t2w1r7 && t2w1l4 < t2w1l7 && t2w1l4 < t2h1u7 && t2w1l4 < t2h1d7 && t2w1l4 < t2w1rwt7 && t2w1l4 < t2w1lwt7 && t2w1l4 < t2h1uwt7 && t2w1l4 < t2h1dwt7
      && t2w1l4 < t2w1r8 && t2w1l4 < t2w1l8 && t2w1l4 < t2h1u8 && t2w1l4 < t2h1d8 && t2w1l4 < t2w1rwt8 && t2w1l4 < t2w1lwt8 && t2w1l4 < t2h1uwt8 && t2w1l4 < t2h1dwt8
      && t2w1l4 < t2w1r9 && t2w1l4 < t2w1l9 && t2w1l4 < t2h1u9 && t2w1l4 < t2h1d9 && t2w1l4 < t2w1rwt9 && t2w1l4 < t2w1lwt9 && t2w1l4 < t2h1uwt9 && t2w1l4 < t2h1dwt9
      && t2w1l4 < t2w1r10 && t2w1l4 < t2w1l10 && t2w1l4 < t2h1u10 && t2w1l4 < t2h1d10 && t2w1l4 < t2w1rwt10 && t2w1l4 < t2w1lwt10 && t2w1l4 < t2h1uwt10 && t2w1l4 < t2h1dwt10
      &&  ((loutwl4!=0 && linwl4==0) || (loutwl4==0 && linwl4!=0))){
  i=175;
  }

  if (mxl4==-1 && t2w1l4 > 0 && t2w1l4 < t1 
      && t2w1l4 < t2w1r && t2w1l4 < t2w1l && t2w1l4 < t2h1u && t2w1l4 < t2h1d && t2w1l4 < t2w1rwt && t2w1l4 < t2w1lwt && t2w1l4 < t2h1uwt && t2w1l4 < t2h1dwt
      && t2w1l4 < t2w1r1 && t2w1l4 < t2w1l1 && t2w1l4 < t2h1u1 && t2w1l4 < t2h1d1 && t2w1l4 < t2w1rwt1 && t2w1l4 < t2w1lwt1 && t2w1l4 < t2h1uwt1 && t2w1l4 < t2h1dwt1
      && t2w1l4 < t2w1r2 && t2w1l4 < t2w1l2 && t2w1l4 < t2h1u2 && t2w1l4 < t2h1d2 && t2w1l4 < t2w1rwt2 && t2w1l4 < t2w1lwt2 && t2w1l4 < t2h1uwt2 && t2w1l4 < t2h1dwt2
      && t2w1l4 < t2w1r3 && t2w1l4 < t2w1l3 && t2w1l4 < t2h1u3 && t2w1l4 < t2h1d3 && t2w1l4 < t2w1rwt3 && t2w1l4 < t2w1lwt3 && t2w1l4 < t2h1uwt3 && t2w1l4 < t2h1dwt3
      && t2w1l4 < t2w1r4 && t2w1l4 < t2h1u4 && t2w1l4 < t2h1d4 && t2w1l4 < t2w1rwt4 && t2w1l4 < t2w1lwt4 && t2w1l4 < t2h1uwt4 && t2w1l4 < t2h1dwt4
      && t2w1l4 < t2w1r5 && t2w1l4 < t2w1l5 && t2w1l4 < t2h1u5 && t2w1l4 < t2h1d5 && t2w1l4 < t2w1rwt5 && t2w1l4 < t2w1lwt5 && t2w1l4 < t2h1uwt5 && t2w1l4 < t2h1dwt5
      && t2w1l4 < t2w1r6 && t2w1l4 < t2w1l6 && t2w1l4 < t2h1u6 && t2w1l4 < t2h1d6 && t2w1l4 < t2w1rwt6 && t2w1l4 < t2w1lwt6 && t2w1l4 < t2h1uwt6 && t2w1l4 < t2h1dwt6
      && t2w1l4 < t2w1r7 && t2w1l4 < t2w1l7 && t2w1l4 < t2h1u7 && t2w1l4 < t2h1d7 && t2w1l4 < t2w1rwt7 && t2w1l4 < t2w1lwt7 && t2w1l4 < t2h1uwt7 && t2w1l4 < t2h1dwt7
      && t2w1l4 < t2w1r8 && t2w1l4 < t2w1l8 && t2w1l4 < t2h1u8 && t2w1l4 < t2h1d8 && t2w1l4 < t2w1rwt8 && t2w1l4 < t2w1lwt8 && t2w1l4 < t2h1uwt8 && t2w1l4 < t2h1dwt8
      && t2w1l4 < t2w1r9 && t2w1l4 < t2w1l9 && t2w1l4 < t2h1u9 && t2w1l4 < t2h1d9 && t2w1l4 < t2w1rwt9 && t2w1l4 < t2w1lwt9 && t2w1l4 < t2h1uwt9 && t2w1l4 < t2h1dwt9
      && t2w1l4 < t2w1r10 && t2w1l4 < t2w1l10 && t2w1l4 < t2h1u10 && t2w1l4 < t2h1d10 && t2w1l4 < t2w1rwt10 && t2w1l4 < t2w1lwt10 && t2w1l4 < t2h1uwt10 && t2w1l4 < t2h1dwt10
      && (loutwl4==0 && linwl4==0)){
  i=175;
  }

  if (myu4==-1 && t2h1u4 > 0 && t2h1u4 < t1 
  && t2h1u4 < t2w1r && t2h1u4 < t2w1l && t2h1u4 < t2h1u && t2h1u4 < t2h1d && t2h1u4 < t2w1rwt && t2h1u4 < t2w1lwt && t2h1u4 < t2h1uwt && t2h1u4 < t2h1dwt
  && t2h1u4 < t2w1r1 && t2h1u4 < t2w1l1 && t2h1u4 < t2h1u1 && t2h1u4 < t2h1d1 && t2h1u4 < t2w1rwt1 && t2h1u4 < t2w1lwt1 && t2h1u4 < t2h1uwt1 && t2h1u4 < t2h1dwt1
  && t2h1u4 < t2w1r2 && t2h1u4 < t2w1l2 && t2h1u4 < t2h1u2 && t2h1u4 < t2h1d2 && t2h1u4 < t2w1rwt2 && t2h1u4 < t2w1lwt2 && t2h1u4 < t2h1uwt2 && t2h1u4 < t2h1dwt2
  && t2h1u4 < t2w1r3 && t2h1u4 < t2w1l3 && t2h1u4 < t2h1u3 && t2h1u4 < t2h1d3 && t2h1u4 < t2w1rwt3 && t2h1u4 < t2w1lwt3 && t2h1u4 < t2h1uwt3 && t2h1u4 < t2h1dwt3
  && t2h1u4 < t2w1r4 && t2h1u4 < t2w1l4 && t2h1u4 < t2h1d4 && t2h1u4 < t2w1rwt4 && t2h1u4 < t2w1lwt4 && t2h1u4 < t2h1uwt4 && t2h1u4 < t2h1dwt4
  && t2h1u4 < t2w1r5 && t2h1u4 < t2w1l5 && t2h1u4 < t2h1u5 && t2h1u4 < t2h1d5 && t2h1u4 < t2w1rwt5 && t2h1u4 < t2w1lwt5 && t2h1u4 < t2h1uwt5 && t2h1u4 < t2h1dwt5
  && t2h1u4 < t2w1r6 && t2h1u4 < t2w1l6 && t2h1u4 < t2h1u6 && t2h1u4 < t2h1d6 && t2h1u4 < t2w1rwt6 && t2h1u4 < t2w1lwt6 && t2h1u4 < t2h1uwt6 && t2h1u4 < t2h1dwt6
  && t2h1u4 < t2w1r7 && t2h1u4 < t2w1l7 && t2h1u4 < t2h1u7 && t2h1u4 < t2h1d7 && t2h1u4 < t2w1rwt7 && t2h1u4 < t2w1lwt7 && t2h1u4 < t2h1uwt7 && t2h1u4 < t2h1dwt7
  && t2h1u4 < t2w1r8 && t2h1u4 < t2w1l8 && t2h1u4 < t2h1u8 && t2h1u4 < t2h1d8 && t2h1u4 < t2w1rwt8 && t2h1u4 < t2w1lwt8 && t2h1u4 < t2h1uwt8 && t2h1u4 < t2h1dwt8
  && t2h1u4 < t2w1r9 && t2h1u4 < t2w1l9 && t2h1u4 < t2h1u9 && t2h1u4 < t2h1d9 && t2h1u4 < t2w1rwt9 && t2h1u4 < t2w1lwt9 && t2h1u4 < t2h1uwt9 && t2h1u4 < t2h1dwt9
  && t2h1u4 < t2w1r10 && t2h1u4 < t2w1l10 && t2h1u4 < t2h1u10 && t2h1u4 < t2h1d10 && t2h1u4 < t2w1rwt10 && t2h1u4 < t2w1lwt10 && t2h1u4 < t2h1uwt10 && t2h1u4 < t2h1dwt10
  && (louthu4 !=0 && linhu4!=0)){
  i=176;
  }

  if (myu4==-1 && t2h1u4 > 0 && t2h1u4 < t1 
  && t2h1u4 < t2w1r && t2h1u4 < t2w1l && t2h1u4 < t2h1u && t2h1u4 < t2h1d && t2h1u4 < t2w1rwt && t2h1u4 < t2w1lwt && t2h1u4 < t2h1uwt && t2h1u4 < t2h1dwt
  && t2h1u4 < t2w1r1 && t2h1u4 < t2w1l1 && t2h1u4 < t2h1u1 && t2h1u4 < t2h1d1 && t2h1u4 < t2w1rwt1 && t2h1u4 < t2w1lwt1 && t2h1u4 < t2h1uwt1 && t2h1u4 < t2h1dwt1
  && t2h1u4 < t2w1r2 && t2h1u4 < t2w1l2 && t2h1u4 < t2h1u2 && t2h1u4 < t2h1d2 && t2h1u4 < t2w1rwt2 && t2h1u4 < t2w1lwt2 && t2h1u4 < t2h1uwt2 && t2h1u4 < t2h1dwt2
  && t2h1u4 < t2w1r3 && t2h1u4 < t2w1l3 && t2h1u4 < t2h1u3 && t2h1u4 < t2h1d3 && t2h1u4 < t2w1rwt3 && t2h1u4 < t2w1lwt3 && t2h1u4 < t2h1uwt3 && t2h1u4 < t2h1dwt3
  && t2h1u4 < t2w1r4 && t2h1u4 < t2w1l4 && t2h1u4 < t2h1d4 && t2h1u4 < t2w1rwt4 && t2h1u4 < t2w1lwt4 && t2h1u4 < t2h1uwt4 && t2h1u4 < t2h1dwt4
  && t2h1u4 < t2w1r5 && t2h1u4 < t2w1l5 && t2h1u4 < t2h1u5 && t2h1u4 < t2h1d5 && t2h1u4 < t2w1rwt5 && t2h1u4 < t2w1lwt5 && t2h1u4 < t2h1uwt5 && t2h1u4 < t2h1dwt5
  && t2h1u4 < t2w1r6 && t2h1u4 < t2w1l6 && t2h1u4 < t2h1u6 && t2h1u4 < t2h1d6 && t2h1u4 < t2w1rwt6 && t2h1u4 < t2w1lwt6 && t2h1u4 < t2h1uwt6 && t2h1u4 < t2h1dwt6
  && t2h1u4 < t2w1r7 && t2h1u4 < t2w1l7 && t2h1u4 < t2h1u7 && t2h1u4 < t2h1d7 && t2h1u4 < t2w1rwt7 && t2h1u4 < t2w1lwt7 && t2h1u4 < t2h1uwt7 && t2h1u4 < t2h1dwt7
  && t2h1u4 < t2w1r8 && t2h1u4 < t2w1l8 && t2h1u4 < t2h1u8 && t2h1u4 < t2h1d8 && t2h1u4 < t2w1rwt8 && t2h1u4 < t2w1lwt8 && t2h1u4 < t2h1uwt8 && t2h1u4 < t2h1dwt8
  && t2h1u4 < t2w1r9 && t2h1u4 < t2w1l9 && t2h1u4 < t2h1u9 && t2h1u4 < t2h1d9 && t2h1u4 < t2w1rwt9 && t2h1u4 < t2w1lwt9 && t2h1u4 < t2h1uwt9 && t2h1u4 < t2h1dwt9
  && t2h1u4 < t2w1r10 && t2h1u4 < t2w1l10 && t2h1u4 < t2h1u10 && t2h1u4 < t2h1d10 && t2h1u4 < t2w1rwt10 && t2h1u4 < t2w1lwt10 && t2h1u4 < t2h1uwt10 && t2h1u4 < t2h1dwt10
  && ((louthu4!=0 && linhu4==0) || (louthu4==0 && linhu4!=0))){
  i=176;
  }

  if (myu4==-1 && t2h1u4 > 0 && t2h1u4 < t1 
  && t2h1u4 < t2w1r && t2h1u4 < t2w1l && t2h1u4 < t2h1u && t2h1u4 < t2h1d && t2h1u4 < t2w1rwt && t2h1u4 < t2w1lwt && t2h1u4 < t2h1uwt && t2h1u4 < t2h1dwt
  && t2h1u4 < t2w1r1 && t2h1u4 < t2w1l1 && t2h1u4 < t2h1u1 && t2h1u4 < t2h1d1 && t2h1u4 < t2w1rwt1 && t2h1u4 < t2w1lwt1 && t2h1u4 < t2h1uwt1 && t2h1u4 < t2h1dwt1
  && t2h1u4 < t2w1r2 && t2h1u4 < t2w1l2 && t2h1u4 < t2h1u2 && t2h1u4 < t2h1d2 && t2h1u4 < t2w1rwt2 && t2h1u4 < t2w1lwt2 && t2h1u4 < t2h1uwt2 && t2h1u4 < t2h1dwt2
  && t2h1u4 < t2w1r3 && t2h1u4 < t2w1l3 && t2h1u4 < t2h1u3 && t2h1u4 < t2h1d3 && t2h1u4 < t2w1rwt3 && t2h1u4 < t2w1lwt3 && t2h1u4 < t2h1uwt3 && t2h1u4 < t2h1dwt3
  && t2h1u4 < t2w1r4 && t2h1u4 < t2w1l4 && t2h1u4 < t2h1d4 && t2h1u4 < t2w1rwt4 && t2h1u4 < t2w1lwt4 && t2h1u4 < t2h1uwt4 && t2h1u4 < t2h1dwt4
  && t2h1u4 < t2w1r5 && t2h1u4 < t2w1l5 && t2h1u4 < t2h1u5 && t2h1u4 < t2h1d5 && t2h1u4 < t2w1rwt5 && t2h1u4 < t2w1lwt5 && t2h1u4 < t2h1uwt5 && t2h1u4 < t2h1dwt5
  && t2h1u4 < t2w1r6 && t2h1u4 < t2w1l6 && t2h1u4 < t2h1u6 && t2h1u4 < t2h1d6 && t2h1u4 < t2w1rwt6 && t2h1u4 < t2w1lwt6 && t2h1u4 < t2h1uwt6 && t2h1u4 < t2h1dwt6
  && t2h1u4 < t2w1r7 && t2h1u4 < t2w1l7 && t2h1u4 < t2h1u7 && t2h1u4 < t2h1d7 && t2h1u4 < t2w1rwt7 && t2h1u4 < t2w1lwt7 && t2h1u4 < t2h1uwt7 && t2h1u4 < t2h1dwt7
  && t2h1u4 < t2w1r8 && t2h1u4 < t2w1l8 && t2h1u4 < t2h1u8 && t2h1u4 < t2h1d8 && t2h1u4 < t2w1rwt8 && t2h1u4 < t2w1lwt8 && t2h1u4 < t2h1uwt8 && t2h1u4 < t2h1dwt8
  && t2h1u4 < t2w1r9 && t2h1u4 < t2w1l9 && t2h1u4 < t2h1u9 && t2h1u4 < t2h1d9 && t2h1u4 < t2w1rwt9 && t2h1u4 < t2w1lwt9 && t2h1u4 < t2h1uwt9 && t2h1u4 < t2h1dwt9
  && t2h1u4 < t2w1r10 && t2h1u4 < t2w1l10 && t2h1u4 < t2h1u10 && t2h1u4 < t2h1d10 && t2h1u4 < t2w1rwt10 && t2h1u4 < t2w1lwt10 && t2h1u4 < t2h1uwt10 && t2h1u4 < t2h1dwt10
  && (louthu4 == 0 && linhu4 == 0)){
  i=176;
  }

  if (myd4==-1 && t2h1d4 > 0 && t2h1d4 < t1 
  && t2h1d4 < t2w1r && t2h1d4 < t2w1l && t2h1d4 < t2h1u && t2h1d4 < t2h1d && t2h1d4 < t2w1rwt && t2h1d4 < t2w1lwt && t2h1d4 < t2h1uwt && t2h1d4 < t2h1dwt
  && t2h1d4 < t2w1r1 && t2h1d4 < t2w1l1 && t2h1d4 < t2h1u1 && t2h1d4 < t2h1d1 && t2h1d4 < t2w1rwt1 && t2h1d4 < t2w1lwt1 && t2h1d4 < t2h1uwt1 && t2h1d4 < t2h1dwt1
  && t2h1d4 < t2w1r2 && t2h1d4 < t2w1l2 && t2h1d4 < t2h1u2 && t2h1d4 < t2h1d2 && t2h1d4 < t2w1rwt2 && t2h1d4 < t2w1lwt2 && t2h1d4 < t2h1uwt2 && t2h1d4 < t2h1dwt2
  && t2h1d4 < t2w1r3 && t2h1d4 < t2w1l3 && t2h1d4 < t2h1u3 && t2h1d4 < t2h1d3 && t2h1d4 < t2w1rwt3 && t2h1d4 < t2w1lwt3 && t2h1d4 < t2h1uwt3 && t2h1d4 < t2h1dwt3
  && t2h1d4 < t2w1r4 && t2h1d4 < t2w1l4 && t2h1d4 < t2h1u4 && t2h1d4 < t2w1rwt4 && t2h1d4 < t2w1lwt4 && t2h1d4 < t2h1uwt4 && t2h1d4 < t2h1dwt4
  && t2h1d4 < t2w1r5 && t2h1d4 < t2w1l5 && t2h1d4 < t2h1u5 && t2h1d4 < t2h1d5 && t2h1d4 < t2w1rwt5 && t2h1d4 < t2w1lwt5 && t2h1d4 < t2h1uwt5 && t2h1d4 < t2h1dwt5
  && t2h1d4 < t2w1r6 && t2h1d4 < t2w1l6 && t2h1d4 < t2h1u6 && t2h1d4 < t2h1d6 && t2h1d4 < t2w1rwt6 && t2h1d4 < t2w1lwt6 && t2h1d4 < t2h1uwt6 && t2h1d4 < t2h1dwt6
  && t2h1d4 < t2w1r7 && t2h1d4 < t2w1l7 && t2h1d4 < t2h1u7 && t2h1d4 < t2h1d7 && t2h1d4 < t2w1rwt7 && t2h1d4 < t2w1lwt7 && t2h1d4 < t2h1uwt7 && t2h1d4 < t2h1dwt7
  && t2h1d4 < t2w1r8 && t2h1d4 < t2w1l8 && t2h1d4 < t2h1u8 && t2h1d4 < t2h1d8 && t2h1d4 < t2w1rwt8 && t2h1d4 < t2w1lwt8 && t2h1d4 < t2h1uwt8 && t2h1d4 < t2h1dwt8
  && t2h1d4 < t2w1r9 && t2h1d4 < t2w1l9 && t2h1d4 < t2h1u9 && t2h1d4 < t2h1d9 && t2h1d4 < t2w1rwt9 && t2h1d4 < t2w1lwt9 && t2h1d4 < t2h1uwt9 && t2h1d4 < t2h1dwt9
  && t2h1d4 < t2w1r10 && t2h1d4 < t2w1l10 && t2h1d4 < t2h1u10 && t2h1d4 < t2h1d10 && t2h1d4 < t2w1rwt10 && t2h1d4 < t2w1lwt10 && t2h1d4 < t2h1uwt10 && t2h1d4 < t2h1dwt10
  && (louthd4 !=0 && linhd4!=0)){
  i=177;
  }

  if (myd4==-1 && t2h1d4 > 0 && t2h1d4 < t1 
  && t2h1d4 < t2w1r && t2h1d4 < t2w1l && t2h1d4 < t2h1u && t2h1d4 < t2h1d && t2h1d4 < t2w1rwt && t2h1d4 < t2w1lwt && t2h1d4 < t2h1uwt && t2h1d4 < t2h1dwt
  && t2h1d4 < t2w1r1 && t2h1d4 < t2w1l1 && t2h1d4 < t2h1u1 && t2h1d4 < t2h1d1 && t2h1d4 < t2w1rwt1 && t2h1d4 < t2w1lwt1 && t2h1d4 < t2h1uwt1 && t2h1d4 < t2h1dwt1
  && t2h1d4 < t2w1r2 && t2h1d4 < t2w1l2 && t2h1d4 < t2h1u2 && t2h1d4 < t2h1d2 && t2h1d4 < t2w1rwt2 && t2h1d4 < t2w1lwt2 && t2h1d4 < t2h1uwt2 && t2h1d4 < t2h1dwt2
  && t2h1d4 < t2w1r3 && t2h1d4 < t2w1l3 && t2h1d4 < t2h1u3 && t2h1d4 < t2h1d3 && t2h1d4 < t2w1rwt3 && t2h1d4 < t2w1lwt3 && t2h1d4 < t2h1uwt3 && t2h1d4 < t2h1dwt3
  && t2h1d4 < t2w1r4 && t2h1d4 < t2w1l4 && t2h1d4 < t2h1u4 && t2h1d4 < t2w1rwt4 && t2h1d4 < t2w1lwt4 && t2h1d4 < t2h1uwt4 && t2h1d4 < t2h1dwt4
  && t2h1d4 < t2w1r5 && t2h1d4 < t2w1l5 && t2h1d4 < t2h1u5 && t2h1d4 < t2h1d5 && t2h1d4 < t2w1rwt5 && t2h1d4 < t2w1lwt5 && t2h1d4 < t2h1uwt5 && t2h1d4 < t2h1dwt5
  && t2h1d4 < t2w1r6 && t2h1d4 < t2w1l6 && t2h1d4 < t2h1u6 && t2h1d4 < t2h1d6 && t2h1d4 < t2w1rwt6 && t2h1d4 < t2w1lwt6 && t2h1d4 < t2h1uwt6 && t2h1d4 < t2h1dwt6
  && t2h1d4 < t2w1r7 && t2h1d4 < t2w1l7 && t2h1d4 < t2h1u7 && t2h1d4 < t2h1d7 && t2h1d4 < t2w1rwt7 && t2h1d4 < t2w1lwt7 && t2h1d4 < t2h1uwt7 && t2h1d4 < t2h1dwt7
  && t2h1d4 < t2w1r8 && t2h1d4 < t2w1l8 && t2h1d4 < t2h1u8 && t2h1d4 < t2h1d8 && t2h1d4 < t2w1rwt8 && t2h1d4 < t2w1lwt8 && t2h1d4 < t2h1uwt8 && t2h1d4 < t2h1dwt8
  && t2h1d4 < t2w1r9 && t2h1d4 < t2w1l9 && t2h1d4 < t2h1u9 && t2h1d4 < t2h1d9 && t2h1d4 < t2w1rwt9 && t2h1d4 < t2w1lwt9 && t2h1d4 < t2h1uwt9 && t2h1d4 < t2h1dwt9
  && t2h1d4 < t2w1r10 && t2h1d4 < t2w1l10 && t2h1d4 < t2h1u10 && t2h1d4 < t2h1d10 && t2h1d4 < t2w1rwt10 && t2h1d4 < t2w1lwt10 && t2h1d4 < t2h1uwt10 && t2h1d4 < t2h1dwt10
  && ((louthd4 !=0 && linhd4==0) || (louthd4 ==0 && linhd4!=0))){
  i=177;
  }

  if (myd4==-1 && t2h1d4 > 0 && t2h1d4 < t1 
  && t2h1d4 < t2w1r && t2h1d4 < t2w1l && t2h1d4 < t2h1u && t2h1d4 < t2h1d && t2h1d4 < t2w1rwt && t2h1d4 < t2w1lwt && t2h1d4 < t2h1uwt && t2h1d4 < t2h1dwt
  && t2h1d4 < t2w1r1 && t2h1d4 < t2w1l1 && t2h1d4 < t2h1u1 && t2h1d4 < t2h1d1 && t2h1d4 < t2w1rwt1 && t2h1d4 < t2w1lwt1 && t2h1d4 < t2h1uwt1 && t2h1d4 < t2h1dwt1
  && t2h1d4 < t2w1r2 && t2h1d4 < t2w1l2 && t2h1d4 < t2h1u2 && t2h1d4 < t2h1d2 && t2h1d4 < t2w1rwt2 && t2h1d4 < t2w1lwt2 && t2h1d4 < t2h1uwt2 && t2h1d4 < t2h1dwt2
  && t2h1d4 < t2w1r3 && t2h1d4 < t2w1l3 && t2h1d4 < t2h1u3 && t2h1d4 < t2h1d3 && t2h1d4 < t2w1rwt3 && t2h1d4 < t2w1lwt3 && t2h1d4 < t2h1uwt3 && t2h1d4 < t2h1dwt3
  && t2h1d4 < t2w1r4 && t2h1d4 < t2w1l4 && t2h1d4 < t2h1u4 && t2h1d4 < t2w1rwt4 && t2h1d4 < t2w1lwt4 && t2h1d4 < t2h1uwt4 && t2h1d4 < t2h1dwt4
  && t2h1d4 < t2w1r5 && t2h1d4 < t2w1l5 && t2h1d4 < t2h1u5 && t2h1d4 < t2h1d5 && t2h1d4 < t2w1rwt5 && t2h1d4 < t2w1lwt5 && t2h1d4 < t2h1uwt5 && t2h1d4 < t2h1dwt5
  && t2h1d4 < t2w1r6 && t2h1d4 < t2w1l6 && t2h1d4 < t2h1u6 && t2h1d4 < t2h1d6 && t2h1d4 < t2w1rwt6 && t2h1d4 < t2w1lwt6 && t2h1d4 < t2h1uwt6 && t2h1d4 < t2h1dwt6
  && t2h1d4 < t2w1r7 && t2h1d4 < t2w1l7 && t2h1d4 < t2h1u7 && t2h1d4 < t2h1d7 && t2h1d4 < t2w1rwt7 && t2h1d4 < t2w1lwt7 && t2h1d4 < t2h1uwt7 && t2h1d4 < t2h1dwt7
  && t2h1d4 < t2w1r8 && t2h1d4 < t2w1l8 && t2h1d4 < t2h1u8 && t2h1d4 < t2h1d8 && t2h1d4 < t2w1rwt8 && t2h1d4 < t2w1lwt8 && t2h1d4 < t2h1uwt8 && t2h1d4 < t2h1dwt8
  && t2h1d4 < t2w1r9 && t2h1d4 < t2w1l9 && t2h1d4 < t2h1u9 && t2h1d4 < t2h1d9 && t2h1d4 < t2w1rwt9 && t2h1d4 < t2w1lwt9 && t2h1d4 < t2h1uwt9 && t2h1d4 < t2h1dwt9
  && t2h1d4 < t2w1r10 && t2h1d4 < t2w1l10 && t2h1d4 < t2h1u10 && t2h1d4 < t2h1d10 && t2h1d4 < t2w1rwt10 && t2h1d4 < t2w1lwt10 && t2h1d4 < t2h1uwt10 && t2h1d4 < t2h1dwt10
  && (louthd4 == 0 && linhd4 == 0)){
  i=177;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW4!=-1 && t2w1rwt4 > 0 && t2w1rwt4 < t1 
  && t2w1rwt4 < t2w1r && t2w1rwt4 < t2w1l && t2w1rwt4 < t2h1u && t2w1rwt4 < t2h1d && t2w1rwt4 <t2w1rwt && t2w1rwt4 <t2w1lwt && t2w1rwt4 < t2h1uwt && t2w1rwt4 < t2h1dwt
  && t2w1rwt4 < t2w1r1 && t2w1rwt4 < t2w1l1 && t2w1rwt4 < t2h1u1 && t2w1rwt4 < t2h1d1 && t2w1rwt4 <t2w1rwt1 && t2w1rwt4 <t2w1lwt1 && t2w1rwt4 < t2h1uwt1 && t2w1rwt4 < t2h1dwt1
  && t2w1rwt4 < t2w1r2 && t2w1rwt4 < t2w1l2 && t2w1rwt4 < t2h1u2 && t2w1rwt4 < t2h1d2 && t2w1rwt4 <t2w1rwt2 && t2w1rwt4 <t2w1lwt2 && t2w1rwt4 < t2h1uwt2 && t2w1rwt4 < t2h1dwt2
  && t2w1rwt4 < t2w1r3 && t2w1rwt4 < t2w1l3 && t2w1rwt4 < t2h1u3 && t2w1rwt4 < t2h1d3 && t2w1rwt4 <t2w1rwt3 && t2w1rwt4 <t2w1lwt3 && t2w1rwt4 < t2h1uwt3 && t2w1rwt4 < t2h1dwt3
  && t2w1rwt4 < t2w1r4 && t2w1rwt4 < t2w1l4 && t2w1rwt4 < t2h1u4 && t2w1rwt4 < t2h1d4 && t2w1rwt4 <t2w1lwt4 && t2w1rwt4 < t2h1uwt4 && t2w1rwt4 < t2h1dwt4
  && t2w1rwt4 < t2w1r5 && t2w1rwt4 < t2w1l5 && t2w1rwt4 < t2h1u5 && t2w1rwt4 < t2h1d5 && t2w1rwt4 <t2w1rwt5 && t2w1rwt4 <t2w1lwt5 && t2w1rwt4 < t2h1uwt5 && t2w1rwt4 < t2h1dwt5
  && t2w1rwt4 < t2w1r6 && t2w1rwt4 < t2w1l6 && t2w1rwt4 < t2h1u6 && t2w1rwt4 < t2h1d6 && t2w1rwt4 <t2w1rwt6 && t2w1rwt4 <t2w1lwt6 && t2w1rwt4 < t2h1uwt6 && t2w1rwt4 < t2h1dwt6
  && t2w1rwt4 < t2w1r7 && t2w1rwt4 < t2w1l7 && t2w1rwt4 < t2h1u7 && t2w1rwt4 < t2h1d7 && t2w1rwt4 <t2w1rwt7 && t2w1rwt4 <t2w1lwt7 && t2w1rwt4 < t2h1uwt7 && t2w1rwt4 < t2h1dwt7
  && t2w1rwt4 < t2w1r8 && t2w1rwt4 < t2w1l8 && t2w1rwt4 < t2h1u8 && t2w1rwt4 < t2h1d8 && t2w1rwt4 <t2w1rwt8 && t2w1rwt4 <t2w1lwt8 && t2w1rwt4 < t2h1uwt8 && t2w1rwt4 < t2h1dwt8
  && t2w1rwt4 < t2w1r9 && t2w1rwt4 < t2w1l9 && t2w1rwt4 < t2h1u9 && t2w1rwt4 < t2h1d9 && t2w1rwt4 <t2w1rwt9 && t2w1rwt4 <t2w1lwt9 && t2w1rwt4 < t2h1uwt9 && t2w1rwt4 < t2h1dwt9
  && t2w1rwt4 < t2w1r10 && t2w1rwt4 < t2w1l10 && t2w1rwt4 < t2h1u10 && t2w1rwt4 < t2h1d10 && t2w1rwt4 <t2w1rwt10 && t2w1rwt4 <t2w1lwt10 && t2w1rwt4 < t2h1uwt10 && t2w1rwt4 < t2h1dwt10
  && ((linwr4!=0) && (loutwr4!=0) )){	
   if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1rwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1rwt4+z))*(z0hd4+(vz*t2w1rwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1rwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1rwt4+z))*(z0hu4+(vz*t2w1rwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1rwt4+y;
  xtest=vx*t2w1rwt4+x;
  xlimitrwt=-bwrwt4*sqrt(1-((vz*t2w1rwt4+z)+z0wr4)*((vz*t2w1rwt4+z)+z0wr4)/a2wrwt4);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW4 > 0){
  i=182;
  }
  else{
  i=194;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW4!=-1 && t2w1rwt4 > 0 && t2w1rwt4 < t1 
  && t2w1rwt4 < t2w1r && t2w1rwt4 < t2w1l && t2w1rwt4 < t2h1u && t2w1rwt4 < t2h1d && t2w1rwt4 <t2w1rwt && t2w1rwt4 <t2w1lwt && t2w1rwt4 < t2h1uwt && t2w1rwt4 < t2h1dwt
  && t2w1rwt4 < t2w1r1 && t2w1rwt4 < t2w1l1 && t2w1rwt4 < t2h1u1 && t2w1rwt4 < t2h1d1 && t2w1rwt4 <t2w1rwt1 && t2w1rwt4 <t2w1lwt1 && t2w1rwt4 < t2h1uwt1 && t2w1rwt4 < t2h1dwt1
  && t2w1rwt4 < t2w1r2 && t2w1rwt4 < t2w1l2 && t2w1rwt4 < t2h1u2 && t2w1rwt4 < t2h1d2 && t2w1rwt4 <t2w1rwt2 && t2w1rwt4 <t2w1lwt2 && t2w1rwt4 < t2h1uwt2 && t2w1rwt4 < t2h1dwt2
  && t2w1rwt4 < t2w1r3 && t2w1rwt4 < t2w1l3 && t2w1rwt4 < t2h1u3 && t2w1rwt4 < t2h1d3 && t2w1rwt4 <t2w1rwt3 && t2w1rwt4 <t2w1lwt3 && t2w1rwt4 < t2h1uwt3 && t2w1rwt4 < t2h1dwt3
  && t2w1rwt4 < t2w1r4 && t2w1rwt4 < t2w1l4 && t2w1rwt4 < t2h1u4 && t2w1rwt4 < t2h1d4 && t2w1rwt4 <t2w1lwt4 && t2w1rwt4 < t2h1uwt4 && t2w1rwt4 < t2h1dwt4
  && t2w1rwt4 < t2w1r5 && t2w1rwt4 < t2w1l5 && t2w1rwt4 < t2h1u5 && t2w1rwt4 < t2h1d5 && t2w1rwt4 <t2w1rwt5 && t2w1rwt4 <t2w1lwt5 && t2w1rwt4 < t2h1uwt5 && t2w1rwt4 < t2h1dwt5
  && t2w1rwt4 < t2w1r6 && t2w1rwt4 < t2w1l6 && t2w1rwt4 < t2h1u6 && t2w1rwt4 < t2h1d6 && t2w1rwt4 <t2w1rwt6 && t2w1rwt4 <t2w1lwt6 && t2w1rwt4 < t2h1uwt6 && t2w1rwt4 < t2h1dwt6
  && t2w1rwt4 < t2w1r7 && t2w1rwt4 < t2w1l7 && t2w1rwt4 < t2h1u7 && t2w1rwt4 < t2h1d7 && t2w1rwt4 <t2w1rwt7 && t2w1rwt4 <t2w1lwt7 && t2w1rwt4 < t2h1uwt7 && t2w1rwt4 < t2h1dwt7
  && t2w1rwt4 < t2w1r8 && t2w1rwt4 < t2w1l8 && t2w1rwt4 < t2h1u8 && t2w1rwt4 < t2h1d8 && t2w1rwt4 <t2w1rwt8 && t2w1rwt4 <t2w1lwt8 && t2w1rwt4 < t2h1uwt8 && t2w1rwt4 < t2h1dwt8
  && t2w1rwt4 < t2w1r9 && t2w1rwt4 < t2w1l9 && t2w1rwt4 < t2h1u9 && t2w1rwt4 < t2h1d9 && t2w1rwt4 <t2w1rwt9 && t2w1rwt4 <t2w1lwt9 && t2w1rwt4 < t2h1uwt9 && t2w1rwt4 < t2h1dwt9
  && t2w1rwt4 < t2w1r10 && t2w1rwt4 < t2w1l10 && t2w1rwt4 < t2h1u10 && t2w1rwt4 < t2h1d10 && t2w1rwt4 <t2w1rwt10 && t2w1rwt4 <t2w1lwt10 && t2w1rwt4 < t2h1uwt10 && t2w1rwt4 < t2h1dwt10
  && ((loutwr4!=0 && linwr4==0) || (loutwr4==0 && linwr4!=0))){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1rwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1rwt4+z))*(z0hd4+(vz*t2w1rwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1rwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1rwt4+z))*(z0hu4+(vz*t2w1rwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1rwt4+y;
  xtest=vx*t2w1rwt4+x;
  xlimitr=-sqrt((pbwrwt4-(vz*t2w1rwt4+z))/pawrwt4);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW4 > 0){
  i=183; 
  }else{
  i=194;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW4!=-1 && t2w1rwt4 > 0 && t2w1rwt4 < t1 
  && t2w1rwt4 < t2w1r && t2w1rwt4 < t2w1l && t2w1rwt4 < t2h1u && t2w1rwt4 < t2h1d && t2w1rwt4 <t2w1rwt && t2w1rwt4 <t2w1lwt && t2w1rwt4 < t2h1uwt && t2w1rwt4 < t2h1dwt
  && t2w1rwt4 < t2w1r1 && t2w1rwt4 < t2w1l1 && t2w1rwt4 < t2h1u1 && t2w1rwt4 < t2h1d1 && t2w1rwt4 <t2w1rwt1 && t2w1rwt4 <t2w1lwt1 && t2w1rwt4 < t2h1uwt1 && t2w1rwt4 < t2h1dwt1
  && t2w1rwt4 < t2w1r2 && t2w1rwt4 < t2w1l2 && t2w1rwt4 < t2h1u2 && t2w1rwt4 < t2h1d2 && t2w1rwt4 <t2w1rwt2 && t2w1rwt4 <t2w1lwt2 && t2w1rwt4 < t2h1uwt2 && t2w1rwt4 < t2h1dwt2
  && t2w1rwt4 < t2w1r3 && t2w1rwt4 < t2w1l3 && t2w1rwt4 < t2h1u3 && t2w1rwt4 < t2h1d3 && t2w1rwt4 <t2w1rwt3 && t2w1rwt4 <t2w1lwt3 && t2w1rwt4 < t2h1uwt3 && t2w1rwt4 < t2h1dwt3
  && t2w1rwt4 < t2w1r4 && t2w1rwt4 < t2w1l4 && t2w1rwt4 < t2h1u4 && t2w1rwt4 < t2h1d4 && t2w1rwt4 <t2w1lwt4 && t2w1rwt4 < t2h1uwt4 && t2w1rwt4 < t2h1dwt4
  && t2w1rwt4 < t2w1r5 && t2w1rwt4 < t2w1l5 && t2w1rwt4 < t2h1u5 && t2w1rwt4 < t2h1d5 && t2w1rwt4 <t2w1rwt5 && t2w1rwt4 <t2w1lwt5 && t2w1rwt4 < t2h1uwt5 && t2w1rwt4 < t2h1dwt5
  && t2w1rwt4 < t2w1r6 && t2w1rwt4 < t2w1l6 && t2w1rwt4 < t2h1u6 && t2w1rwt4 < t2h1d6 && t2w1rwt4 <t2w1rwt6 && t2w1rwt4 <t2w1lwt6 && t2w1rwt4 < t2h1uwt6 && t2w1rwt4 < t2h1dwt6
  && t2w1rwt4 < t2w1r7 && t2w1rwt4 < t2w1l7 && t2w1rwt4 < t2h1u7 && t2w1rwt4 < t2h1d7 && t2w1rwt4 <t2w1rwt7 && t2w1rwt4 <t2w1lwt7 && t2w1rwt4 < t2h1uwt7 && t2w1rwt4 < t2h1dwt7
  && t2w1rwt4 < t2w1r8 && t2w1rwt4 < t2w1l8 && t2w1rwt4 < t2h1u8 && t2w1rwt4 < t2h1d8 && t2w1rwt4 <t2w1rwt8 && t2w1rwt4 <t2w1lwt8 && t2w1rwt4 < t2h1uwt8 && t2w1rwt4 < t2h1dwt8
  && t2w1rwt4 < t2w1r9 && t2w1rwt4 < t2w1l9 && t2w1rwt4 < t2h1u9 && t2w1rwt4 < t2h1d9 && t2w1rwt4 <t2w1rwt9 && t2w1rwt4 <t2w1lwt9 && t2w1rwt4 < t2h1uwt9 && t2w1rwt4 < t2h1dwt9
  && t2w1rwt4 < t2w1r10 && t2w1rwt4 < t2w1l10 && t2w1rwt4 < t2h1u10 && t2w1rwt4 < t2h1d10 && t2w1rwt4 <t2w1rwt10 && t2w1rwt4 <t2w1lwt10 && t2w1rwt4 < t2h1uwt10 && t2w1rwt4 < t2h1dwt10
  && (loutwr4==0 && linwr4==0)){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1rwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1rwt4+z))*(z0hd4+(vz*t2w1rwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1rwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1rwt4+z))*(z0hu4+(vz*t2w1rwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1rwt4+y; 
  xtest=vx*t2w1rwt4+x;
  xlimitr=-(-w2r4+w1r4)*(vz*t2w1rwt4+z)/l-w1rwt4;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW4>0){
  i=184;
  }else{
  i=194;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW4!=-1 && t2w1lwt4 > 0 && t2w1lwt4 < t1 
  && t2w1lwt4 < t2w1r && t2w1lwt4 < t2w1l && t2w1lwt4 < t2h1u && t2w1lwt4 < t2h1d && t2w1lwt4 <t2w1rwt && t2w1lwt4 <t2w1lwt && t2w1lwt4 < t2h1uwt && t2w1lwt4 < t2h1dwt
  && t2w1lwt4 < t2w1r1 && t2w1lwt4 < t2w1l1 && t2w1lwt4 < t2h1u1 && t2w1lwt4 < t2h1d1 && t2w1lwt4 <t2w1rwt1 && t2w1lwt4 <t2w1lwt1 && t2w1lwt4 < t2h1uwt1 && t2w1lwt4 < t2h1dwt1
  && t2w1lwt4 < t2w1r2 && t2w1lwt4 < t2w1l2 && t2w1lwt4 < t2h1u2 && t2w1lwt4 < t2h1d2 && t2w1lwt4 <t2w1rwt2 && t2w1lwt4 <t2w1lwt2 && t2w1lwt4 < t2h1uwt2 && t2w1lwt4 < t2h1dwt2
  && t2w1lwt4 < t2w1r3 && t2w1lwt4 < t2w1l3 && t2w1lwt4 < t2h1u3 && t2w1lwt4 < t2h1d3 && t2w1lwt4 <t2w1rwt3 && t2w1lwt4 <t2w1lwt3 && t2w1lwt4 < t2h1uwt3 && t2w1lwt4 < t2h1dwt3
  && t2w1lwt4 < t2w1r4 && t2w1lwt4 < t2w1l4 && t2w1lwt4 < t2h1u4 && t2w1lwt4 < t2h1d4 && t2w1lwt4 <t2w1rwt4 && t2w1lwt4 < t2h1uwt4 && t2w1lwt4 < t2h1dwt4
  && t2w1lwt4 < t2w1r5 && t2w1lwt4 < t2w1l5 && t2w1lwt4 < t2h1u5 && t2w1lwt4 < t2h1d5 && t2w1lwt4 <t2w1rwt5 && t2w1lwt4 <t2w1lwt5 && t2w1lwt4 < t2h1uwt5 && t2w1lwt4 < t2h1dwt5
  && t2w1lwt4 < t2w1r6 && t2w1lwt4 < t2w1l6 && t2w1lwt4 < t2h1u6 && t2w1lwt4 < t2h1d6 && t2w1lwt4 <t2w1rwt6 && t2w1lwt4 <t2w1lwt6 && t2w1lwt4 < t2h1uwt6 && t2w1lwt4 < t2h1dwt6
  && t2w1lwt4 < t2w1r7 && t2w1lwt4 < t2w1l7 && t2w1lwt4 < t2h1u7 && t2w1lwt4 < t2h1d7 && t2w1lwt4 <t2w1rwt7 && t2w1lwt4 <t2w1lwt7 && t2w1lwt4 < t2h1uwt7 && t2w1lwt4 < t2h1dwt7
  && t2w1lwt4 < t2w1r8 && t2w1lwt4 < t2w1l8 && t2w1lwt4 < t2h1u8 && t2w1lwt4 < t2h1d8 && t2w1lwt4 <t2w1rwt8 && t2w1lwt4 <t2w1lwt8 && t2w1lwt4 < t2h1uwt8 && t2w1lwt4 < t2h1dwt8
  && t2w1lwt4 < t2w1r9 && t2w1lwt4 < t2w1l9 && t2w1lwt4 < t2h1u9 && t2w1lwt4 < t2h1d9 && t2w1lwt4 <t2w1rwt9 && t2w1lwt4 <t2w1lwt9 && t2w1lwt4 < t2h1uwt9 && t2w1lwt4 < t2h1dwt9
  && t2w1lwt4 < t2w1r10 && t2w1lwt4 < t2w1l10 && t2w1lwt4 < t2h1u10 && t2w1lwt4 < t2h1d10 && t2w1lwt4 <t2w1rwt10 && t2w1lwt4 <t2w1lwt10 && t2w1lwt4 < t2h1uwt10 && t2w1lwt4 < t2h1dwt10
  && ((linwl4!=0) && (loutwl4!=0) )){
  if(linhd4==0 && louthd4==0)
   if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1lwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1lwt4+z))*(z0hd4+(vz*t2w1lwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1lwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1lwt4+z))*(z0hu4+(vz*t2w1lwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1lwt4+y;
  xtest=vx*t2w1lwt4+x;
  xlimitlwt=-bwlwt4*sqrt(1-((vz*t2w1lwt4+z)+z0wl4)*((vz*t2w1lwt4+z)+z0wl4)/a2wlwt4);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW4>0){
  i=185;
  }else{
  i=195;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW4!=-1 && t2w1lwt4 > 0 && t2w1lwt4 < t1 
  && t2w1lwt4 < t2w1r && t2w1lwt4 < t2w1l && t2w1lwt4 < t2h1u && t2w1lwt4 < t2h1d && t2w1lwt4 <t2w1rwt && t2w1lwt4 <t2w1lwt && t2w1lwt4 < t2h1uwt && t2w1lwt4 < t2h1dwt
  && t2w1lwt4 < t2w1r1 && t2w1lwt4 < t2w1l1 && t2w1lwt4 < t2h1u1 && t2w1lwt4 < t2h1d1 && t2w1lwt4 <t2w1rwt1 && t2w1lwt4 <t2w1lwt1 && t2w1lwt4 < t2h1uwt1 && t2w1lwt4 < t2h1dwt1
  && t2w1lwt4 < t2w1r2 && t2w1lwt4 < t2w1l2 && t2w1lwt4 < t2h1u2 && t2w1lwt4 < t2h1d2 && t2w1lwt4 <t2w1rwt2 && t2w1lwt4 <t2w1lwt2 && t2w1lwt4 < t2h1uwt2 && t2w1lwt4 < t2h1dwt2
  && t2w1lwt4 < t2w1r3 && t2w1lwt4 < t2w1l3 && t2w1lwt4 < t2h1u3 && t2w1lwt4 < t2h1d3 && t2w1lwt4 <t2w1rwt3 && t2w1lwt4 <t2w1lwt3 && t2w1lwt4 < t2h1uwt3 && t2w1lwt4 < t2h1dwt3
  && t2w1lwt4 < t2w1r4 && t2w1lwt4 < t2w1l4 && t2w1lwt4 < t2h1u4 && t2w1lwt4 < t2h1d4 && t2w1lwt4 <t2w1rwt4 && t2w1lwt4 < t2h1uwt4 && t2w1lwt4 < t2h1dwt4
  && t2w1lwt4 < t2w1r5 && t2w1lwt4 < t2w1l5 && t2w1lwt4 < t2h1u5 && t2w1lwt4 < t2h1d5 && t2w1lwt4 <t2w1rwt5 && t2w1lwt4 <t2w1lwt5 && t2w1lwt4 < t2h1uwt5 && t2w1lwt4 < t2h1dwt5
  && t2w1lwt4 < t2w1r6 && t2w1lwt4 < t2w1l6 && t2w1lwt4 < t2h1u6 && t2w1lwt4 < t2h1d6 && t2w1lwt4 <t2w1rwt6 && t2w1lwt4 <t2w1lwt6 && t2w1lwt4 < t2h1uwt6 && t2w1lwt4 < t2h1dwt6
  && t2w1lwt4 < t2w1r7 && t2w1lwt4 < t2w1l7 && t2w1lwt4 < t2h1u7 && t2w1lwt4 < t2h1d7 && t2w1lwt4 <t2w1rwt7 && t2w1lwt4 <t2w1lwt7 && t2w1lwt4 < t2h1uwt7 && t2w1lwt4 < t2h1dwt7
  && t2w1lwt4 < t2w1r8 && t2w1lwt4 < t2w1l8 && t2w1lwt4 < t2h1u8 && t2w1lwt4 < t2h1d8 && t2w1lwt4 <t2w1rwt8 && t2w1lwt4 <t2w1lwt8 && t2w1lwt4 < t2h1uwt8 && t2w1lwt4 < t2h1dwt8
  && t2w1lwt4 < t2w1r9 && t2w1lwt4 < t2w1l9 && t2w1lwt4 < t2h1u9 && t2w1lwt4 < t2h1d9 && t2w1lwt4 <t2w1rwt9 && t2w1lwt4 <t2w1lwt9 && t2w1lwt4 < t2h1uwt9 && t2w1lwt4 < t2h1dwt9
  && t2w1lwt4 < t2w1r10 && t2w1lwt4 < t2w1l10 && t2w1lwt4 < t2h1u10 && t2w1lwt4 < t2h1d10 && t2w1lwt4 <t2w1rwt10 && t2w1lwt4 <t2w1lwt10 && t2w1lwt4 < t2h1uwt10 && t2w1lwt4 < t2h1dwt10
  && ((loutwl4!=0 && linwl4==0) || (loutwl4==0 && linwl4!=0))){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1lwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1lwt4+z))*(z0hd4+(vz*t2w1lwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1lwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1lwt4+z))*(z0hu4+(vz*t2w1lwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1lwt4+y;
  xtest=vx*t2w1lwt4+x;
  xlimitl=-sqrt((pbwlwt4-(vz*t2w1lwt4+z))/pawlwt4);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW4>0){
  i=186;
  }else{
  i=195;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW4!=-1 && t2w1lwt4 > 0 && t2w1lwt4 < t1 
  && t2w1lwt4 < t2w1r && t2w1lwt4 < t2w1l && t2w1lwt4 < t2h1u && t2w1lwt4 < t2h1d && t2w1lwt4 <t2w1rwt && t2w1lwt4 <t2w1lwt && t2w1lwt4 < t2h1uwt && t2w1lwt4 < t2h1dwt
  && t2w1lwt4 < t2w1r1 && t2w1lwt4 < t2w1l1 && t2w1lwt4 < t2h1u1 && t2w1lwt4 < t2h1d1 && t2w1lwt4 <t2w1rwt1 && t2w1lwt4 <t2w1lwt1 && t2w1lwt4 < t2h1uwt1 && t2w1lwt4 < t2h1dwt1
  && t2w1lwt4 < t2w1r2 && t2w1lwt4 < t2w1l2 && t2w1lwt4 < t2h1u2 && t2w1lwt4 < t2h1d2 && t2w1lwt4 <t2w1rwt2 && t2w1lwt4 <t2w1lwt2 && t2w1lwt4 < t2h1uwt2 && t2w1lwt4 < t2h1dwt2
  && t2w1lwt4 < t2w1r3 && t2w1lwt4 < t2w1l3 && t2w1lwt4 < t2h1u3 && t2w1lwt4 < t2h1d3 && t2w1lwt4 <t2w1rwt3 && t2w1lwt4 <t2w1lwt3 && t2w1lwt4 < t2h1uwt3 && t2w1lwt4 < t2h1dwt3
  && t2w1lwt4 < t2w1r4 && t2w1lwt4 < t2w1l4 && t2w1lwt4 < t2h1u4 && t2w1lwt4 < t2h1d4 && t2w1lwt4 <t2w1rwt4 && t2w1lwt4 < t2h1uwt4 && t2w1lwt4 < t2h1dwt4
  && t2w1lwt4 < t2w1r5 && t2w1lwt4 < t2w1l5 && t2w1lwt4 < t2h1u5 && t2w1lwt4 < t2h1d5 && t2w1lwt4 <t2w1rwt5 && t2w1lwt4 <t2w1lwt5 && t2w1lwt4 < t2h1uwt5 && t2w1lwt4 < t2h1dwt5
  && t2w1lwt4 < t2w1r6 && t2w1lwt4 < t2w1l6 && t2w1lwt4 < t2h1u6 && t2w1lwt4 < t2h1d6 && t2w1lwt4 <t2w1rwt6 && t2w1lwt4 <t2w1lwt6 && t2w1lwt4 < t2h1uwt6 && t2w1lwt4 < t2h1dwt6
  && t2w1lwt4 < t2w1r7 && t2w1lwt4 < t2w1l7 && t2w1lwt4 < t2h1u7 && t2w1lwt4 < t2h1d7 && t2w1lwt4 <t2w1rwt7 && t2w1lwt4 <t2w1lwt7 && t2w1lwt4 < t2h1uwt7 && t2w1lwt4 < t2h1dwt7
  && t2w1lwt4 < t2w1r8 && t2w1lwt4 < t2w1l8 && t2w1lwt4 < t2h1u8 && t2w1lwt4 < t2h1d8 && t2w1lwt4 <t2w1rwt8 && t2w1lwt4 <t2w1lwt8 && t2w1lwt4 < t2h1uwt8 && t2w1lwt4 < t2h1dwt8
  && t2w1lwt4 < t2w1r9 && t2w1lwt4 < t2w1l9 && t2w1lwt4 < t2h1u9 && t2w1lwt4 < t2h1d9 && t2w1lwt4 <t2w1rwt9 && t2w1lwt4 <t2w1lwt9 && t2w1lwt4 < t2h1uwt9 && t2w1lwt4 < t2h1dwt9
  && t2w1lwt4 < t2w1r10 && t2w1lwt4 < t2w1l10 && t2w1lwt4 < t2h1u10 && t2w1lwt4 < t2h1d10 && t2w1lwt4 <t2w1rwt10 && t2w1lwt4 <t2w1lwt10 && t2w1lwt4 < t2h1uwt10 && t2w1lwt4 < t2h1dwt10
  && (loutwl4==0 && linwl4==0)){
  if(linhd4==0 && louthd4==0)
   {
      ylimitd=(-h2d4+h1d4)/l*(vz*t2w1lwt4+z)-h1dwt4;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ylimitd=-bhdwt4*sqrt(1-((z0hd4+(vz*t2w1lwt4+z))*(z0hd4+(vz*t2w1lwt4+z)))/a2hdwt4);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt4+z)-pbhdwt4)/-pahdwt4);
      }
   }
   if(linhu4==0 && louthu4==0)
    {
     ylimitu=(h2u4-h1u4)/l*(vz*t2w1lwt4+z)+h1uwt4;
    }else{
     if(linhu4!=0 && louthu4!=0)
     {
     ylimitu=bhuwt4*sqrt(1-((z0hu4+(vz*t2w1lwt4+z))*(z0hu4+(vz*t2w1lwt4+z)))/a2huwt4);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt4+z)-pbhuwt4)/-pahuwt4);
    }
    }
  ytest=vy*t2w1lwt4+y; 
  xtest=vx*t2w1lwt4+x;
  xlimitl=(w2l4-w1l4)*(vz*t2w1lwt4+z)/l+w1lwt4;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW4>0){
  i=187;
  }else{
  i=195;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW4!=-1 && t2h1uwt4 > 0 && t2h1uwt4 < t1 
  && t2h1uwt4 < t2w1r && t2h1uwt4 < t2w1l && t2h1uwt4 < t2h1u && t2h1uwt4 < t2h1d && t2h1uwt4 < t2w1rwt && t2h1uwt4 < t2w1lwt && t2h1uwt4 < t2h1uwt && t2h1uwt4 < t2h1dwt 
  && t2h1uwt4 < t2w1r1 && t2h1uwt4 < t2w1l1 && t2h1uwt4 < t2h1u1 && t2h1uwt4 < t2h1d1 && t2h1uwt4 < t2w1rwt1 && t2h1uwt4 < t2w1lwt1 && t2h1uwt4 < t2h1uwt1 && t2h1uwt4 < t2h1dwt1
  && t2h1uwt4 < t2w1r2 && t2h1uwt4 < t2w1l2 && t2h1uwt4 < t2h1u2 && t2h1uwt4 < t2h1d2 && t2h1uwt4 < t2w1rwt2 && t2h1uwt4 < t2w1lwt2 && t2h1uwt4 < t2h1uwt2 && t2h1uwt4 < t2h1dwt2
  && t2h1uwt4 < t2w1r3 && t2h1uwt4 < t2w1l3 && t2h1uwt4 < t2h1u3 && t2h1uwt4 < t2h1d3 && t2h1uwt4 < t2w1rwt3 && t2h1uwt4 < t2w1lwt3 && t2h1uwt4 < t2h1uwt3 && t2h1uwt4 < t2h1dwt3
  && t2h1uwt4 < t2w1r4 && t2h1uwt4 < t2w1l4 && t2h1uwt4 < t2h1u4 && t2h1uwt4 < t2h1d4 && t2h1uwt4 < t2w1rwt4 && t2h1uwt4 < t2w1lwt4 && t2h1uwt4 < t2h1dwt4
  && t2h1uwt4 < t2w1r5 && t2h1uwt4 < t2w1l5 && t2h1uwt4 < t2h1u5 && t2h1uwt4 < t2h1d5 && t2h1uwt4 < t2w1rwt5 && t2h1uwt4 < t2w1lwt5 && t2h1uwt4 < t2h1uwt5 && t2h1uwt4 < t2h1dwt5
  && t2h1uwt4 < t2w1r6 && t2h1uwt4 < t2w1l6 && t2h1uwt4 < t2h1u6 && t2h1uwt4 < t2h1d6 && t2h1uwt4 < t2w1rwt6 && t2h1uwt4 < t2w1lwt6 && t2h1uwt4 < t2h1uwt6 && t2h1uwt4 < t2h1dwt6
  && t2h1uwt4 < t2w1r7 && t2h1uwt4 < t2w1l7 && t2h1uwt4 < t2h1u7 && t2h1uwt4 < t2h1d7 && t2h1uwt4 < t2w1rwt7 && t2h1uwt4 < t2w1lwt7 && t2h1uwt4 < t2h1uwt7 && t2h1uwt4 < t2h1dwt7
  && t2h1uwt4 < t2w1r8 && t2h1uwt4 < t2w1l8 && t2h1uwt4 < t2h1u8 && t2h1uwt4 < t2h1d8 && t2h1uwt4 < t2w1rwt8 && t2h1uwt4 < t2w1lwt8 && t2h1uwt4 < t2h1uwt8 && t2h1uwt4 < t2h1dwt8
  && t2h1uwt4 < t2w1r9 && t2h1uwt4 < t2w1l9 && t2h1uwt4 < t2h1u9 && t2h1uwt4 < t2h1d9 && t2h1uwt4 < t2w1rwt9 && t2h1uwt4 < t2w1lwt9 && t2h1uwt4 < t2h1uwt9 && t2h1uwt4 < t2h1dwt9
  && t2h1uwt4 < t2w1r10 && t2h1uwt4 < t2w1l10 && t2h1uwt4 < t2h1u10 && t2h1uwt4 < t2h1d10 && t2h1uwt4 < t2w1rwt10 && t2h1uwt4 < t2w1lwt10 && t2h1uwt4 < t2h1uwt10 && t2h1uwt4 < t2h1dwt10
  && (louthu4 !=0 && linhu4!=0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1uwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1uwt4+z))*(z0wr4+(vz*t2h1uwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1uwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1uwt4+z))*(z0wl4+(vz*t2h1uwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1uwt4+x;
  ytest=vy*t2w1lwt4+y;
  ylimitu=bhuwt4*sqrt(1-((vz*t2h1uwt4+z)+z0hu4)*((vz*t2h1uwt4+z)+z0hu4)/a2huwt4);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW4>0 ){
  i=188;
  }else{
  i=196;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW4!=-1 && t2h1uwt4 > 0 && t2h1uwt4 < t1 
  && t2h1uwt4 < t2w1r && t2h1uwt4 < t2w1l && t2h1uwt4 < t2h1u && t2h1uwt4 < t2h1d && t2h1uwt4 < t2w1rwt && t2h1uwt4 < t2w1lwt && t2h1uwt4 < t2h1uwt && t2h1uwt4 < t2h1dwt 
  && t2h1uwt4 < t2w1r1 && t2h1uwt4 < t2w1l1 && t2h1uwt4 < t2h1u1 && t2h1uwt4 < t2h1d1 && t2h1uwt4 < t2w1rwt1 && t2h1uwt4 < t2w1lwt1 && t2h1uwt4 < t2h1uwt1 && t2h1uwt4 < t2h1dwt1
  && t2h1uwt4 < t2w1r2 && t2h1uwt4 < t2w1l2 && t2h1uwt4 < t2h1u2 && t2h1uwt4 < t2h1d2 && t2h1uwt4 < t2w1rwt2 && t2h1uwt4 < t2w1lwt2 && t2h1uwt4 < t2h1uwt2 && t2h1uwt4 < t2h1dwt2
  && t2h1uwt4 < t2w1r3 && t2h1uwt4 < t2w1l3 && t2h1uwt4 < t2h1u3 && t2h1uwt4 < t2h1d3 && t2h1uwt4 < t2w1rwt3 && t2h1uwt4 < t2w1lwt3 && t2h1uwt4 < t2h1uwt3 && t2h1uwt4 < t2h1dwt3
  && t2h1uwt4 < t2w1r4 && t2h1uwt4 < t2w1l4 && t2h1uwt4 < t2h1u4 && t2h1uwt4 < t2h1d4 && t2h1uwt4 < t2w1rwt4 && t2h1uwt4 < t2w1lwt4 && t2h1uwt4 < t2h1dwt4
  && t2h1uwt4 < t2w1r5 && t2h1uwt4 < t2w1l5 && t2h1uwt4 < t2h1u5 && t2h1uwt4 < t2h1d5 && t2h1uwt4 < t2w1rwt5 && t2h1uwt4 < t2w1lwt5 && t2h1uwt4 < t2h1uwt5 && t2h1uwt4 < t2h1dwt5
  && t2h1uwt4 < t2w1r6 && t2h1uwt4 < t2w1l6 && t2h1uwt4 < t2h1u6 && t2h1uwt4 < t2h1d6 && t2h1uwt4 < t2w1rwt6 && t2h1uwt4 < t2w1lwt6 && t2h1uwt4 < t2h1uwt6 && t2h1uwt4 < t2h1dwt6
  && t2h1uwt4 < t2w1r7 && t2h1uwt4 < t2w1l7 && t2h1uwt4 < t2h1u7 && t2h1uwt4 < t2h1d7 && t2h1uwt4 < t2w1rwt7 && t2h1uwt4 < t2w1lwt7 && t2h1uwt4 < t2h1uwt7 && t2h1uwt4 < t2h1dwt7
  && t2h1uwt4 < t2w1r8 && t2h1uwt4 < t2w1l8 && t2h1uwt4 < t2h1u8 && t2h1uwt4 < t2h1d8 && t2h1uwt4 < t2w1rwt8 && t2h1uwt4 < t2w1lwt8 && t2h1uwt4 < t2h1uwt8 && t2h1uwt4 < t2h1dwt8
  && t2h1uwt4 < t2w1r9 && t2h1uwt4 < t2w1l9 && t2h1uwt4 < t2h1u9 && t2h1uwt4 < t2h1d9 && t2h1uwt4 < t2w1rwt9 && t2h1uwt4 < t2w1lwt9 && t2h1uwt4 < t2h1uwt9 && t2h1uwt4 < t2h1dwt9
  && t2h1uwt4 < t2w1r10 && t2h1uwt4 < t2w1l10 && t2h1uwt4 < t2h1u10 && t2h1uwt4 < t2h1d10 && t2h1uwt4 < t2w1rwt10 && t2h1uwt4 < t2w1lwt10 && t2h1uwt4 < t2h1uwt10 && t2h1uwt4 < t2h1dwt10
  && ((louthu4!=0 && linhu4==0) || (louthu4==0 && linhu4!=0))){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1uwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1uwt4+z))*(z0wr4+(vz*t2h1uwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1uwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1uwt4+z))*(z0wl4+(vz*t2h1uwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1uwt4+x;
  ytest=vy*t2w1lwt4+y;
  ylimitu=sqrt((pbhuwt4-(vz*t2h1uwt4+z))/pahuwt4);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW4>0){
  i=189;
  }else{
  i=196;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW4!=-1 && t2h1uwt4 > 0 && t2h1uwt4 < t1 
  && t2h1uwt4 < t2w1r && t2h1uwt4 < t2w1l && t2h1uwt4 < t2h1u && t2h1uwt4 < t2h1d && t2h1uwt4 < t2w1rwt && t2h1uwt4 < t2w1lwt && t2h1uwt4 < t2h1uwt && t2h1uwt4 < t2h1dwt 
  && t2h1uwt4 < t2w1r1 && t2h1uwt4 < t2w1l1 && t2h1uwt4 < t2h1u1 && t2h1uwt4 < t2h1d1 && t2h1uwt4 < t2w1rwt1 && t2h1uwt4 < t2w1lwt1 && t2h1uwt4 < t2h1uwt1 && t2h1uwt4 < t2h1dwt1
  && t2h1uwt4 < t2w1r2 && t2h1uwt4 < t2w1l2 && t2h1uwt4 < t2h1u2 && t2h1uwt4 < t2h1d2 && t2h1uwt4 < t2w1rwt2 && t2h1uwt4 < t2w1lwt2 && t2h1uwt4 < t2h1uwt2 && t2h1uwt4 < t2h1dwt2
  && t2h1uwt4 < t2w1r3 && t2h1uwt4 < t2w1l3 && t2h1uwt4 < t2h1u3 && t2h1uwt4 < t2h1d3 && t2h1uwt4 < t2w1rwt3 && t2h1uwt4 < t2w1lwt3 && t2h1uwt4 < t2h1uwt3 && t2h1uwt4 < t2h1dwt3
  && t2h1uwt4 < t2w1r4 && t2h1uwt4 < t2w1l4 && t2h1uwt4 < t2h1u4 && t2h1uwt4 < t2h1d4 && t2h1uwt4 < t2w1rwt4 && t2h1uwt4 < t2w1lwt4 && t2h1uwt4 < t2h1dwt4
  && t2h1uwt4 < t2w1r5 && t2h1uwt4 < t2w1l5 && t2h1uwt4 < t2h1u5 && t2h1uwt4 < t2h1d5 && t2h1uwt4 < t2w1rwt5 && t2h1uwt4 < t2w1lwt5 && t2h1uwt4 < t2h1uwt5 && t2h1uwt4 < t2h1dwt5
  && t2h1uwt4 < t2w1r6 && t2h1uwt4 < t2w1l6 && t2h1uwt4 < t2h1u6 && t2h1uwt4 < t2h1d6 && t2h1uwt4 < t2w1rwt6 && t2h1uwt4 < t2w1lwt6 && t2h1uwt4 < t2h1uwt6 && t2h1uwt4 < t2h1dwt6
  && t2h1uwt4 < t2w1r7 && t2h1uwt4 < t2w1l7 && t2h1uwt4 < t2h1u7 && t2h1uwt4 < t2h1d7 && t2h1uwt4 < t2w1rwt7 && t2h1uwt4 < t2w1lwt7 && t2h1uwt4 < t2h1uwt7 && t2h1uwt4 < t2h1dwt7
  && t2h1uwt4 < t2w1r8 && t2h1uwt4 < t2w1l8 && t2h1uwt4 < t2h1u8 && t2h1uwt4 < t2h1d8 && t2h1uwt4 < t2w1rwt8 && t2h1uwt4 < t2w1lwt8 && t2h1uwt4 < t2h1uwt8 && t2h1uwt4 < t2h1dwt8
  && t2h1uwt4 < t2w1r9 && t2h1uwt4 < t2w1l9 && t2h1uwt4 < t2h1u9 && t2h1uwt4 < t2h1d9 && t2h1uwt4 < t2w1rwt9 && t2h1uwt4 < t2w1lwt9 && t2h1uwt4 < t2h1uwt9 && t2h1uwt4 < t2h1dwt9
  && t2h1uwt4 < t2w1r10 && t2h1uwt4 < t2w1l10 && t2h1uwt4 < t2h1u10 && t2h1uwt4 < t2h1d10 && t2h1uwt4 < t2w1rwt10 && t2h1uwt4 < t2w1lwt10 && t2h1uwt4 < t2h1uwt10 && t2h1uwt4 < t2h1dwt10
  && (louthu4 == 0 && linhu4 == 0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1uwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1uwt4+z))*(z0wr4+(vz*t2h1uwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1uwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1uwt4+z))*(z0wl4+(vz*t2h1uwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1uwt4+x;
  ytest=vy*t2w1lwt4+y;
  ylimitu=(h2u4-h1u4)*(vz*t2h1uwt4+z)/l+h1uwt4;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW4>0 ){
  i=190;
  }else{
  i=196;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW4!=-1 && t2h1dwt4 > 0 && t2h1dwt4 < t1 
  && t2h1dwt4 < t2w1r && t2h1dwt4 < t2w1l && t2h1dwt4 < t2h1u && t2h1dwt4 < t2h1d && t2h1dwt4 < t2w1rwt && t2h1dwt4 < t2w1lwt && t2h1dwt4 < t2h1uwt && t2h1dwt4 < t2h1dwt 
  && t2h1dwt4 < t2w1r1 && t2h1dwt4 < t2w1l1 && t2h1dwt4 < t2h1u1 && t2h1dwt4 < t2h1d1 && t2h1dwt4 < t2w1rwt1 && t2h1dwt4 < t2w1lwt1 && t2h1dwt4 < t2h1uwt1 && t2h1dwt4 < t2h1dwt1
  && t2h1dwt4 < t2w1r2 && t2h1dwt4 < t2w1l2 && t2h1dwt4 < t2h1u2 && t2h1dwt4 < t2h1d2 && t2h1dwt4 < t2w1rwt2 && t2h1dwt4 < t2w1lwt2 && t2h1dwt4 < t2h1uwt2 && t2h1dwt4 < t2h1dwt2 
  && t2h1dwt4 < t2w1r3 && t2h1dwt4 < t2w1l3 && t2h1dwt4 < t2h1u3 && t2h1dwt4 < t2h1d3 && t2h1dwt4 < t2w1rwt3 && t2h1dwt4 < t2w1lwt3 && t2h1dwt4 < t2h1uwt3 && t2h1dwt4 < t2h1dwt3
  && t2h1dwt4 < t2w1r4 && t2h1dwt4 < t2w1l4 && t2h1dwt4 < t2h1u4 && t2h1dwt4 < t2h1d4 && t2h1dwt4 < t2w1rwt4 && t2h1dwt4 < t2w1lwt4 && t2h1dwt4 < t2h1uwt4 
  && t2h1dwt4 < t2w1r5 && t2h1dwt4 < t2w1l5 && t2h1dwt4 < t2h1u5 && t2h1dwt4 < t2h1d5 && t2h1dwt4 < t2w1rwt5 && t2h1dwt4 < t2w1lwt5 && t2h1dwt4 < t2h1uwt5 && t2h1dwt4 < t2h1dwt5
  && t2h1dwt4 < t2w1r6 && t2h1dwt4 < t2w1l6 && t2h1dwt4 < t2h1u6 && t2h1dwt4 < t2h1d6 && t2h1dwt4 < t2w1rwt6 && t2h1dwt4 < t2w1lwt6 && t2h1dwt4 < t2h1uwt6 && t2h1dwt4 < t2h1dwt6
  && t2h1dwt4 < t2w1r7 && t2h1dwt4 < t2w1l7 && t2h1dwt4 < t2h1u7 && t2h1dwt4 < t2h1d7 && t2h1dwt4 < t2w1rwt7 && t2h1dwt4 < t2w1lwt7 && t2h1dwt4 < t2h1uwt7 && t2h1dwt4 < t2h1dwt7 
  && t2h1dwt4 < t2w1r8 && t2h1dwt4 < t2w1l8 && t2h1dwt4 < t2h1u8 && t2h1dwt4 < t2h1d8 && t2h1dwt4 < t2w1rwt8 && t2h1dwt4 < t2w1lwt8 && t2h1dwt4 < t2h1uwt8 && t2h1dwt4 < t2h1dwt8
  && t2h1dwt4 < t2w1r9 && t2h1dwt4 < t2w1l9 && t2h1dwt4 < t2h1u9 && t2h1dwt4 < t2h1d9 && t2h1dwt4 < t2w1rwt9 && t2h1dwt4 < t2w1lwt9 && t2h1dwt4 < t2h1uwt9 && t2h1dwt4 < t2h1dwt9 
  && t2h1dwt4 < t2w1r10 && t2h1dwt4 < t2w1l10 && t2h1dwt4 < t2h1u10 && t2h1dwt4 < t2h1d10 && t2h1dwt4 < t2w1rwt10 && t2h1dwt4 < t2w1lwt10 && t2h1dwt4 < t2h1uwt10 && t2h1dwt4 < t2h1dwt10  
  && (louthd4 !=0 && linhd4!=0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1dwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1dwt4+z))*(z0wr4+(vz*t2h1dwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1dwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1dwt4+z))*(z0wl4+(vz*t2h1dwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1dwt4+x;
  ytest=vy*t2w1lwt4+y;
  ylimitd=-bhdwt4*sqrt(1-((vz*t2h1dwt4+z)+z0hd4)*((vz*t2h1dwt4+z)+z0hd4)/a2hdwt4);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW4>0){
  i=191;
  }else{
  i=197;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW4!=-1 && t2h1dwt4 > 0 && t2h1dwt4 < t1 
  && t2h1dwt4 < t2w1r && t2h1dwt4 < t2w1l && t2h1dwt4 < t2h1u && t2h1dwt4 < t2h1d && t2h1dwt4 < t2w1rwt && t2h1dwt4 < t2w1lwt && t2h1dwt4 < t2h1uwt && t2h1dwt4 < t2h1dwt 
  && t2h1dwt4 < t2w1r1 && t2h1dwt4 < t2w1l1 && t2h1dwt4 < t2h1u1 && t2h1dwt4 < t2h1d1 && t2h1dwt4 < t2w1rwt1 && t2h1dwt4 < t2w1lwt1 && t2h1dwt4 < t2h1uwt1 && t2h1dwt4 < t2h1dwt1
  && t2h1dwt4 < t2w1r2 && t2h1dwt4 < t2w1l2 && t2h1dwt4 < t2h1u2 && t2h1dwt4 < t2h1d2 && t2h1dwt4 < t2w1rwt2 && t2h1dwt4 < t2w1lwt2 && t2h1dwt4 < t2h1uwt2 && t2h1dwt4 < t2h1dwt2 
  && t2h1dwt4 < t2w1r3 && t2h1dwt4 < t2w1l3 && t2h1dwt4 < t2h1u3 && t2h1dwt4 < t2h1d3 && t2h1dwt4 < t2w1rwt3 && t2h1dwt4 < t2w1lwt3 && t2h1dwt4 < t2h1uwt3 && t2h1dwt4 < t2h1dwt3
  && t2h1dwt4 < t2w1r4 && t2h1dwt4 < t2w1l4 && t2h1dwt4 < t2h1u4 && t2h1dwt4 < t2h1d4 && t2h1dwt4 < t2w1rwt4 && t2h1dwt4 < t2w1lwt4 && t2h1dwt4 < t2h1uwt4 
  && t2h1dwt4 < t2w1r5 && t2h1dwt4 < t2w1l5 && t2h1dwt4 < t2h1u5 && t2h1dwt4 < t2h1d5 && t2h1dwt4 < t2w1rwt5 && t2h1dwt4 < t2w1lwt5 && t2h1dwt4 < t2h1uwt5 && t2h1dwt4 < t2h1dwt5
  && t2h1dwt4 < t2w1r6 && t2h1dwt4 < t2w1l6 && t2h1dwt4 < t2h1u6 && t2h1dwt4 < t2h1d6 && t2h1dwt4 < t2w1rwt6 && t2h1dwt4 < t2w1lwt6 && t2h1dwt4 < t2h1uwt6 && t2h1dwt4 < t2h1dwt6
  && t2h1dwt4 < t2w1r7 && t2h1dwt4 < t2w1l7 && t2h1dwt4 < t2h1u7 && t2h1dwt4 < t2h1d7 && t2h1dwt4 < t2w1rwt7 && t2h1dwt4 < t2w1lwt7 && t2h1dwt4 < t2h1uwt7 && t2h1dwt4 < t2h1dwt7 
  && t2h1dwt4 < t2w1r8 && t2h1dwt4 < t2w1l8 && t2h1dwt4 < t2h1u8 && t2h1dwt4 < t2h1d8 && t2h1dwt4 < t2w1rwt8 && t2h1dwt4 < t2w1lwt8 && t2h1dwt4 < t2h1uwt8 && t2h1dwt4 < t2h1dwt8
  && t2h1dwt4 < t2w1r9 && t2h1dwt4 < t2w1l9 && t2h1dwt4 < t2h1u9 && t2h1dwt4 < t2h1d9 && t2h1dwt4 < t2w1rwt9 && t2h1dwt4 < t2w1lwt9 && t2h1dwt4 < t2h1uwt9 && t2h1dwt4 < t2h1dwt9 
  && t2h1dwt4 < t2w1r10 && t2h1dwt4 < t2w1l10 && t2h1dwt4 < t2h1u10 && t2h1dwt4 < t2h1d10 && t2h1dwt4 < t2w1rwt10 && t2h1dwt4 < t2w1lwt10 && t2h1dwt4 < t2h1uwt10 && t2h1dwt4 < t2h1dwt10
  && ((louthd4 !=0 && linhd4==0) || (louthd4 ==0 && linhd4!=0))){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1dwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1dwt4+z))*(z0wr4+(vz*t2h1dwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
     xlimitl=(w2l4-w1l4)/l*(vz*t2h1dwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1dwt4+z))*(z0wl4+(vz*t2h1dwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1dwt4+x;
  ytest=vy*t2w1lwt4+y;
  ylimitd=-sqrt((pbhdwt4-(vz*t2h1dwt4+z))/pahdwt4);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW4>0 ){
  i=192;
  }else{
  i=197;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW4!=-1 && t2h1dwt4 > 0 && t2h1dwt4 < t1 
  && t2h1dwt4 < t2w1r && t2h1dwt4 < t2w1l && t2h1dwt4 < t2h1u && t2h1dwt4 < t2h1d && t2h1dwt4 < t2w1rwt && t2h1dwt4 < t2w1lwt && t2h1dwt4 < t2h1uwt && t2h1dwt4 < t2h1dwt 
  && t2h1dwt4 < t2w1r1 && t2h1dwt4 < t2w1l1 && t2h1dwt4 < t2h1u1 && t2h1dwt4 < t2h1d1 && t2h1dwt4 < t2w1rwt1 && t2h1dwt4 < t2w1lwt1 && t2h1dwt4 < t2h1uwt1 && t2h1dwt4 < t2h1dwt1
  && t2h1dwt4 < t2w1r2 && t2h1dwt4 < t2w1l2 && t2h1dwt4 < t2h1u2 && t2h1dwt4 < t2h1d2 && t2h1dwt4 < t2w1rwt2 && t2h1dwt4 < t2w1lwt2 && t2h1dwt4 < t2h1uwt2 && t2h1dwt4 < t2h1dwt2 
  && t2h1dwt4 < t2w1r3 && t2h1dwt4 < t2w1l3 && t2h1dwt4 < t2h1u3 && t2h1dwt4 < t2h1d3 && t2h1dwt4 < t2w1rwt3 && t2h1dwt4 < t2w1lwt3 && t2h1dwt4 < t2h1uwt3 && t2h1dwt4 < t2h1dwt3
  && t2h1dwt4 < t2w1r4 && t2h1dwt4 < t2w1l4 && t2h1dwt4 < t2h1u4 && t2h1dwt4 < t2h1d4 && t2h1dwt4 < t2w1rwt4 && t2h1dwt4 < t2w1lwt4 && t2h1dwt4 < t2h1uwt4 
  && t2h1dwt4 < t2w1r5 && t2h1dwt4 < t2w1l5 && t2h1dwt4 < t2h1u5 && t2h1dwt4 < t2h1d5 && t2h1dwt4 < t2w1rwt5 && t2h1dwt4 < t2w1lwt5 && t2h1dwt4 < t2h1uwt5 && t2h1dwt4 < t2h1dwt5
  && t2h1dwt4 < t2w1r6 && t2h1dwt4 < t2w1l6 && t2h1dwt4 < t2h1u6 && t2h1dwt4 < t2h1d6 && t2h1dwt4 < t2w1rwt6 && t2h1dwt4 < t2w1lwt6 && t2h1dwt4 < t2h1uwt6 && t2h1dwt4 < t2h1dwt6
  && t2h1dwt4 < t2w1r7 && t2h1dwt4 < t2w1l7 && t2h1dwt4 < t2h1u7 && t2h1dwt4 < t2h1d7 && t2h1dwt4 < t2w1rwt7 && t2h1dwt4 < t2w1lwt7 && t2h1dwt4 < t2h1uwt7 && t2h1dwt4 < t2h1dwt7 
  && t2h1dwt4 < t2w1r8 && t2h1dwt4 < t2w1l8 && t2h1dwt4 < t2h1u8 && t2h1dwt4 < t2h1d8 && t2h1dwt4 < t2w1rwt8 && t2h1dwt4 < t2w1lwt8 && t2h1dwt4 < t2h1uwt8 && t2h1dwt4 < t2h1dwt8
  && t2h1dwt4 < t2w1r9 && t2h1dwt4 < t2w1l9 && t2h1dwt4 < t2h1u9 && t2h1dwt4 < t2h1d9 && t2h1dwt4 < t2w1rwt9 && t2h1dwt4 < t2w1lwt9 && t2h1dwt4 < t2h1uwt9 && t2h1dwt4 < t2h1dwt9 
  && t2h1dwt4 < t2w1r10 && t2h1dwt4 < t2w1l10 && t2h1dwt4 < t2h1u10 && t2h1dwt4 < t2h1d10 && t2h1dwt4 < t2w1rwt10 && t2h1dwt4 < t2w1lwt10 && t2h1dwt4 < t2h1uwt10 && t2h1dwt4 < t2h1dwt10
  && (louthd4 == 0 && linhd4 == 0)){
  if(linwr4==0 && loutwr4==0)
  {
    xlimitr=(-w2r4+w1r4)/l*(vz*t2h1dwt4+z)-w1rwt4;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xlimitr=-bwrwt4*sqrt(1-((z0wr4+(vz*t2h1dwt4+z))*(z0wr4+(vz*t2h1dwt4+z)))/a2wrwt4);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt4+z)-pbwrwt4)/-pawrwt4);
    }
  }
  if(linwl4==0 && loutwl4 == 0)
   {
      xlimitl=(w2l4-w1l4)/l*(vz*t2h1dwt4+z)+w1lwt4;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xlimitl=bwlwt4*sqrt(1-((z0wl4+(vz*t2h1dwt4+z))*(z0wl4+(vz*t2h1dwt4+z)))/a2wlwt4);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt4+z)-pbwlwt4)/-pawlwt4);
      }
   }
  xtest=vx*t2h1dwt4+x;
  ytest=vy*t2w1lwt4+y;
  ylimitd=(-h2d4+h1d4)*(vz*t2h1dwt4+z)/l-h1dwt4;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW4>0 ){
  i=193;
  }else{
  i=197;
  }
  }


  if (mxrOW4==-1 && t2w1rwt4 > 0 && t2w1rwt4 < t1 
  && t2w1rwt4 < t2w1r && t2w1rwt4 < t2w1l && t2w1rwt4 < t2h1u && t2w1rwt4 < t2h1d && t2w1rwt4 <t2w1rwt && t2w1rwt4 <t2w1lwt && t2w1rwt4 < t2h1uwt && t2w1rwt4 < t2h1dwt
  && t2w1rwt4 < t2w1r1 && t2w1rwt4 < t2w1l1 && t2w1rwt4 < t2h1u1 && t2w1rwt4 < t2h1d1 && t2w1rwt4 <t2w1rwt1 && t2w1rwt4 <t2w1lwt1 && t2w1rwt4 < t2h1uwt1 && t2w1rwt4 < t2h1dwt1
  && t2w1rwt4 < t2w1r2 && t2w1rwt4 < t2w1l2 && t2w1rwt4 < t2h1u2 && t2w1rwt4 < t2h1d2 && t2w1rwt4 <t2w1rwt2 && t2w1rwt4 <t2w1lwt2 && t2w1rwt4 < t2h1uwt2 && t2w1rwt4 < t2h1dwt2
  && t2w1rwt4 < t2w1r3 && t2w1rwt4 < t2w1l3 && t2w1rwt4 < t2h1u3 && t2w1rwt4 < t2h1d3 && t2w1rwt4 <t2w1rwt3 && t2w1rwt4 <t2w1lwt3 && t2w1rwt4 < t2h1uwt3 && t2w1rwt4 < t2h1dwt3
  && t2w1rwt4 < t2w1r4 && t2w1rwt4 < t2w1l4 && t2w1rwt4 < t2h1u4 && t2w1rwt4 < t2h1d4 && t2w1rwt4 <t2w1lwt4 && t2w1rwt4 < t2h1uwt4 && t2w1rwt4 < t2h1dwt4
  && t2w1rwt4 < t2w1r5 && t2w1rwt4 < t2w1l5 && t2w1rwt4 < t2h1u5 && t2w1rwt4 < t2h1d5 && t2w1rwt4 <t2w1rwt5 && t2w1rwt4 <t2w1lwt5 && t2w1rwt4 < t2h1uwt5 && t2w1rwt4 < t2h1dwt5
  && t2w1rwt4 < t2w1r6 && t2w1rwt4 < t2w1l6 && t2w1rwt4 < t2h1u6 && t2w1rwt4 < t2h1d6 && t2w1rwt4 <t2w1rwt6 && t2w1rwt4 <t2w1lwt6 && t2w1rwt4 < t2h1uwt6 && t2w1rwt4 < t2h1dwt6
  && t2w1rwt4 < t2w1r7 && t2w1rwt4 < t2w1l7 && t2w1rwt4 < t2h1u7 && t2w1rwt4 < t2h1d7 && t2w1rwt4 <t2w1rwt7 && t2w1rwt4 <t2w1lwt7 && t2w1rwt4 < t2h1uwt7 && t2w1rwt4 < t2h1dwt7
  && t2w1rwt4 < t2w1r8 && t2w1rwt4 < t2w1l8 && t2w1rwt4 < t2h1u8 && t2w1rwt4 < t2h1d8 && t2w1rwt4 <t2w1rwt8 && t2w1rwt4 <t2w1lwt8 && t2w1rwt4 < t2h1uwt8 && t2w1rwt4 < t2h1dwt8
  && t2w1rwt4 < t2w1r9 && t2w1rwt4 < t2w1l9 && t2w1rwt4 < t2h1u9 && t2w1rwt4 < t2h1d9 && t2w1rwt4 <t2w1rwt9 && t2w1rwt4 <t2w1lwt9 && t2w1rwt4 < t2h1uwt9 && t2w1rwt4 < t2h1dwt9
  && t2w1rwt4 < t2w1r10 && t2w1rwt4 < t2w1l10 && t2w1rwt4 < t2h1u10 && t2w1rwt4 < t2h1d10 && t2w1rwt4 <t2w1rwt10 && t2w1rwt4 <t2w1lwt10 && t2w1rwt4 < t2h1uwt10 && t2w1rwt4 < t2h1dwt10
  && ((linwr4!=0) && (loutwr4!=0) )){
  i=198;
  }

  if (mxrOW4==-1 && t2w1rwt4 > 0 && t2w1rwt4 < t1 
  && t2w1rwt4 < t2w1r && t2w1rwt4 < t2w1l && t2w1rwt4 < t2h1u && t2w1rwt4 < t2h1d && t2w1rwt4 <t2w1rwt && t2w1rwt4 <t2w1lwt && t2w1rwt4 < t2h1uwt && t2w1rwt4 < t2h1dwt
  && t2w1rwt4 < t2w1r1 && t2w1rwt4 < t2w1l1 && t2w1rwt4 < t2h1u1 && t2w1rwt4 < t2h1d1 && t2w1rwt4 <t2w1rwt1 && t2w1rwt4 <t2w1lwt1 && t2w1rwt4 < t2h1uwt1 && t2w1rwt4 < t2h1dwt1
  && t2w1rwt4 < t2w1r2 && t2w1rwt4 < t2w1l2 && t2w1rwt4 < t2h1u2 && t2w1rwt4 < t2h1d2 && t2w1rwt4 <t2w1rwt2 && t2w1rwt4 <t2w1lwt2 && t2w1rwt4 < t2h1uwt2 && t2w1rwt4 < t2h1dwt2
  && t2w1rwt4 < t2w1r3 && t2w1rwt4 < t2w1l3 && t2w1rwt4 < t2h1u3 && t2w1rwt4 < t2h1d3 && t2w1rwt4 <t2w1rwt3 && t2w1rwt4 <t2w1lwt3 && t2w1rwt4 < t2h1uwt3 && t2w1rwt4 < t2h1dwt3
  && t2w1rwt4 < t2w1r4 && t2w1rwt4 < t2w1l4 && t2w1rwt4 < t2h1u4 && t2w1rwt4 < t2h1d4 && t2w1rwt4 <t2w1lwt4 && t2w1rwt4 < t2h1uwt4 && t2w1rwt4 < t2h1dwt4
  && t2w1rwt4 < t2w1r5 && t2w1rwt4 < t2w1l5 && t2w1rwt4 < t2h1u5 && t2w1rwt4 < t2h1d5 && t2w1rwt4 <t2w1rwt5 && t2w1rwt4 <t2w1lwt5 && t2w1rwt4 < t2h1uwt5 && t2w1rwt4 < t2h1dwt5
  && t2w1rwt4 < t2w1r6 && t2w1rwt4 < t2w1l6 && t2w1rwt4 < t2h1u6 && t2w1rwt4 < t2h1d6 && t2w1rwt4 <t2w1rwt6 && t2w1rwt4 <t2w1lwt6 && t2w1rwt4 < t2h1uwt6 && t2w1rwt4 < t2h1dwt6
  && t2w1rwt4 < t2w1r7 && t2w1rwt4 < t2w1l7 && t2w1rwt4 < t2h1u7 && t2w1rwt4 < t2h1d7 && t2w1rwt4 <t2w1rwt7 && t2w1rwt4 <t2w1lwt7 && t2w1rwt4 < t2h1uwt7 && t2w1rwt4 < t2h1dwt7
  && t2w1rwt4 < t2w1r8 && t2w1rwt4 < t2w1l8 && t2w1rwt4 < t2h1u8 && t2w1rwt4 < t2h1d8 && t2w1rwt4 <t2w1rwt8 && t2w1rwt4 <t2w1lwt8 && t2w1rwt4 < t2h1uwt8 && t2w1rwt4 < t2h1dwt8
  && t2w1rwt4 < t2w1r9 && t2w1rwt4 < t2w1l9 && t2w1rwt4 < t2h1u9 && t2w1rwt4 < t2h1d9 && t2w1rwt4 <t2w1rwt9 && t2w1rwt4 <t2w1lwt9 && t2w1rwt4 < t2h1uwt9 && t2w1rwt4 < t2h1dwt9
  && t2w1rwt4 < t2w1r10 && t2w1rwt4 < t2w1l10 && t2w1rwt4 < t2h1u10 && t2w1rwt4 < t2h1d10 && t2w1rwt4 <t2w1rwt10 && t2w1rwt4 <t2w1lwt10 && t2w1rwt4 < t2h1uwt10 && t2w1rwt4 < t2h1dwt10
  && ((loutwr4!=0 && linwr4==0) || (loutwr4==0 && linwr4!=0))){
  i=198;
  }

  if (mxrOW4==-1 && t2w1rwt4 > 0 && t2w1rwt4 < t1 
  && t2w1rwt4 < t2w1r && t2w1rwt4 < t2w1l && t2w1rwt4 < t2h1u && t2w1rwt4 < t2h1d && t2w1rwt4 <t2w1rwt && t2w1rwt4 <t2w1lwt && t2w1rwt4 < t2h1uwt && t2w1rwt4 < t2h1dwt
  && t2w1rwt4 < t2w1r1 && t2w1rwt4 < t2w1l1 && t2w1rwt4 < t2h1u1 && t2w1rwt4 < t2h1d1 && t2w1rwt4 <t2w1rwt1 && t2w1rwt4 <t2w1lwt1 && t2w1rwt4 < t2h1uwt1 && t2w1rwt4 < t2h1dwt1
  && t2w1rwt4 < t2w1r2 && t2w1rwt4 < t2w1l2 && t2w1rwt4 < t2h1u2 && t2w1rwt4 < t2h1d2 && t2w1rwt4 <t2w1rwt2 && t2w1rwt4 <t2w1lwt2 && t2w1rwt4 < t2h1uwt2 && t2w1rwt4 < t2h1dwt2
  && t2w1rwt4 < t2w1r3 && t2w1rwt4 < t2w1l3 && t2w1rwt4 < t2h1u3 && t2w1rwt4 < t2h1d3 && t2w1rwt4 <t2w1rwt3 && t2w1rwt4 <t2w1lwt3 && t2w1rwt4 < t2h1uwt3 && t2w1rwt4 < t2h1dwt3
  && t2w1rwt4 < t2w1r4 && t2w1rwt4 < t2w1l4 && t2w1rwt4 < t2h1u4 && t2w1rwt4 < t2h1d4 && t2w1rwt4 <t2w1lwt4 && t2w1rwt4 < t2h1uwt4 && t2w1rwt4 < t2h1dwt4
  && t2w1rwt4 < t2w1r5 && t2w1rwt4 < t2w1l5 && t2w1rwt4 < t2h1u5 && t2w1rwt4 < t2h1d5 && t2w1rwt4 <t2w1rwt5 && t2w1rwt4 <t2w1lwt5 && t2w1rwt4 < t2h1uwt5 && t2w1rwt4 < t2h1dwt5
  && t2w1rwt4 < t2w1r6 && t2w1rwt4 < t2w1l6 && t2w1rwt4 < t2h1u6 && t2w1rwt4 < t2h1d6 && t2w1rwt4 <t2w1rwt6 && t2w1rwt4 <t2w1lwt6 && t2w1rwt4 < t2h1uwt6 && t2w1rwt4 < t2h1dwt6
  && t2w1rwt4 < t2w1r7 && t2w1rwt4 < t2w1l7 && t2w1rwt4 < t2h1u7 && t2w1rwt4 < t2h1d7 && t2w1rwt4 <t2w1rwt7 && t2w1rwt4 <t2w1lwt7 && t2w1rwt4 < t2h1uwt7 && t2w1rwt4 < t2h1dwt7
  && t2w1rwt4 < t2w1r8 && t2w1rwt4 < t2w1l8 && t2w1rwt4 < t2h1u8 && t2w1rwt4 < t2h1d8 && t2w1rwt4 <t2w1rwt8 && t2w1rwt4 <t2w1lwt8 && t2w1rwt4 < t2h1uwt8 && t2w1rwt4 < t2h1dwt8
  && t2w1rwt4 < t2w1r9 && t2w1rwt4 < t2w1l9 && t2w1rwt4 < t2h1u9 && t2w1rwt4 < t2h1d9 && t2w1rwt4 <t2w1rwt9 && t2w1rwt4 <t2w1lwt9 && t2w1rwt4 < t2h1uwt9 && t2w1rwt4 < t2h1dwt9
  && t2w1rwt4 < t2w1r10 && t2w1rwt4 < t2w1l10 && t2w1rwt4 < t2h1u10 && t2w1rwt4 < t2h1d10 && t2w1rwt4 <t2w1rwt10 && t2w1rwt4 <t2w1lwt10 && t2w1rwt4 < t2h1uwt10 && t2w1rwt4 < t2h1dwt10
  && (loutwr4==0 && linwr4==0)){
  i=198;
  }

  if (mxlOW4==-1 && t2w1lwt4 > 0 && t2w1lwt4 < t1 
  && t2w1lwt4 < t2w1r && t2w1lwt4 < t2w1l && t2w1lwt4 < t2h1u && t2w1lwt4 < t2h1d && t2w1lwt4 <t2w1rwt && t2w1lwt4 <t2w1lwt && t2w1lwt4 < t2h1uwt && t2w1lwt4 < t2h1dwt
  && t2w1lwt4 < t2w1r1 && t2w1lwt4 < t2w1l1 && t2w1lwt4 < t2h1u1 && t2w1lwt4 < t2h1d1 && t2w1lwt4 <t2w1rwt1 && t2w1lwt4 <t2w1lwt1 && t2w1lwt4 < t2h1uwt1 && t2w1lwt4 < t2h1dwt1
  && t2w1lwt4 < t2w1r2 && t2w1lwt4 < t2w1l2 && t2w1lwt4 < t2h1u2 && t2w1lwt4 < t2h1d2 && t2w1lwt4 <t2w1rwt2 && t2w1lwt4 <t2w1lwt2 && t2w1lwt4 < t2h1uwt2 && t2w1lwt4 < t2h1dwt2
  && t2w1lwt4 < t2w1r3 && t2w1lwt4 < t2w1l3 && t2w1lwt4 < t2h1u3 && t2w1lwt4 < t2h1d3 && t2w1lwt4 <t2w1rwt3 && t2w1lwt4 <t2w1lwt3 && t2w1lwt4 < t2h1uwt3 && t2w1lwt4 < t2h1dwt3
  && t2w1lwt4 < t2w1r4 && t2w1lwt4 < t2w1l4 && t2w1lwt4 < t2h1u4 && t2w1lwt4 < t2h1d4 && t2w1lwt4 <t2w1rwt4 && t2w1lwt4 < t2h1uwt4 && t2w1lwt4 < t2h1dwt4
  && t2w1lwt4 < t2w1r5 && t2w1lwt4 < t2w1l5 && t2w1lwt4 < t2h1u5 && t2w1lwt4 < t2h1d5 && t2w1lwt4 <t2w1rwt5 && t2w1lwt4 <t2w1lwt5 && t2w1lwt4 < t2h1uwt5 && t2w1lwt4 < t2h1dwt5
  && t2w1lwt4 < t2w1r6 && t2w1lwt4 < t2w1l6 && t2w1lwt4 < t2h1u6 && t2w1lwt4 < t2h1d6 && t2w1lwt4 <t2w1rwt6 && t2w1lwt4 <t2w1lwt6 && t2w1lwt4 < t2h1uwt6 && t2w1lwt4 < t2h1dwt6
  && t2w1lwt4 < t2w1r7 && t2w1lwt4 < t2w1l7 && t2w1lwt4 < t2h1u7 && t2w1lwt4 < t2h1d7 && t2w1lwt4 <t2w1rwt7 && t2w1lwt4 <t2w1lwt7 && t2w1lwt4 < t2h1uwt7 && t2w1lwt4 < t2h1dwt7
  && t2w1lwt4 < t2w1r8 && t2w1lwt4 < t2w1l8 && t2w1lwt4 < t2h1u8 && t2w1lwt4 < t2h1d8 && t2w1lwt4 <t2w1rwt8 && t2w1lwt4 <t2w1lwt8 && t2w1lwt4 < t2h1uwt8 && t2w1lwt4 < t2h1dwt8
  && t2w1lwt4 < t2w1r9 && t2w1lwt4 < t2w1l9 && t2w1lwt4 < t2h1u9 && t2w1lwt4 < t2h1d9 && t2w1lwt4 <t2w1rwt9 && t2w1lwt4 <t2w1lwt9 && t2w1lwt4 < t2h1uwt9 && t2w1lwt4 < t2h1dwt9
  && t2w1lwt4 < t2w1r10 && t2w1lwt4 < t2w1l10 && t2w1lwt4 < t2h1u10 && t2w1lwt4 < t2h1d10 && t2w1lwt4 <t2w1rwt10 && t2w1lwt4 <t2w1lwt10 && t2w1lwt4 < t2h1uwt10 && t2w1lwt4 < t2h1dwt10
  && ((linwl4!=0) && (loutwl4!=0) )){
  i=199;
  }

  if (mxlOW4==-1 && t2w1lwt4 > 0 && t2w1lwt4 < t1 
  && t2w1lwt4 < t2w1r && t2w1lwt4 < t2w1l && t2w1lwt4 < t2h1u && t2w1lwt4 < t2h1d && t2w1lwt4 <t2w1rwt && t2w1lwt4 <t2w1lwt && t2w1lwt4 < t2h1uwt && t2w1lwt4 < t2h1dwt
  && t2w1lwt4 < t2w1r1 && t2w1lwt4 < t2w1l1 && t2w1lwt4 < t2h1u1 && t2w1lwt4 < t2h1d1 && t2w1lwt4 <t2w1rwt1 && t2w1lwt4 <t2w1lwt1 && t2w1lwt4 < t2h1uwt1 && t2w1lwt4 < t2h1dwt1
  && t2w1lwt4 < t2w1r2 && t2w1lwt4 < t2w1l2 && t2w1lwt4 < t2h1u2 && t2w1lwt4 < t2h1d2 && t2w1lwt4 <t2w1rwt2 && t2w1lwt4 <t2w1lwt2 && t2w1lwt4 < t2h1uwt2 && t2w1lwt4 < t2h1dwt2
  && t2w1lwt4 < t2w1r3 && t2w1lwt4 < t2w1l3 && t2w1lwt4 < t2h1u3 && t2w1lwt4 < t2h1d3 && t2w1lwt4 <t2w1rwt3 && t2w1lwt4 <t2w1lwt3 && t2w1lwt4 < t2h1uwt3 && t2w1lwt4 < t2h1dwt3
  && t2w1lwt4 < t2w1r4 && t2w1lwt4 < t2w1l4 && t2w1lwt4 < t2h1u4 && t2w1lwt4 < t2h1d4 && t2w1lwt4 <t2w1rwt4 && t2w1lwt4 < t2h1uwt4 && t2w1lwt4 < t2h1dwt4
  && t2w1lwt4 < t2w1r5 && t2w1lwt4 < t2w1l5 && t2w1lwt4 < t2h1u5 && t2w1lwt4 < t2h1d5 && t2w1lwt4 <t2w1rwt5 && t2w1lwt4 <t2w1lwt5 && t2w1lwt4 < t2h1uwt5 && t2w1lwt4 < t2h1dwt5
  && t2w1lwt4 < t2w1r6 && t2w1lwt4 < t2w1l6 && t2w1lwt4 < t2h1u6 && t2w1lwt4 < t2h1d6 && t2w1lwt4 <t2w1rwt6 && t2w1lwt4 <t2w1lwt6 && t2w1lwt4 < t2h1uwt6 && t2w1lwt4 < t2h1dwt6
  && t2w1lwt4 < t2w1r7 && t2w1lwt4 < t2w1l7 && t2w1lwt4 < t2h1u7 && t2w1lwt4 < t2h1d7 && t2w1lwt4 <t2w1rwt7 && t2w1lwt4 <t2w1lwt7 && t2w1lwt4 < t2h1uwt7 && t2w1lwt4 < t2h1dwt7
  && t2w1lwt4 < t2w1r8 && t2w1lwt4 < t2w1l8 && t2w1lwt4 < t2h1u8 && t2w1lwt4 < t2h1d8 && t2w1lwt4 <t2w1rwt8 && t2w1lwt4 <t2w1lwt8 && t2w1lwt4 < t2h1uwt8 && t2w1lwt4 < t2h1dwt8
  && t2w1lwt4 < t2w1r9 && t2w1lwt4 < t2w1l9 && t2w1lwt4 < t2h1u9 && t2w1lwt4 < t2h1d9 && t2w1lwt4 <t2w1rwt9 && t2w1lwt4 <t2w1lwt9 && t2w1lwt4 < t2h1uwt9 && t2w1lwt4 < t2h1dwt9
  && t2w1lwt4 < t2w1r10 && t2w1lwt4 < t2w1l10 && t2w1lwt4 < t2h1u10 && t2w1lwt4 < t2h1d10 && t2w1lwt4 <t2w1rwt10 && t2w1lwt4 <t2w1lwt10 && t2w1lwt4 < t2h1uwt10 && t2w1lwt4 < t2h1dwt10
  && ((loutwl4!=0 && linwl4==0) || (loutwl4==0 && linwl4!=0))){
  i=199;
  }

  if (mxlOW4==-1 && t2w1lwt4 > 0 && t2w1lwt4 < t1 
  && t2w1lwt4 < t2w1r && t2w1lwt4 < t2w1l && t2w1lwt4 < t2h1u && t2w1lwt4 < t2h1d && t2w1lwt4 <t2w1rwt && t2w1lwt4 <t2w1lwt && t2w1lwt4 < t2h1uwt && t2w1lwt4 < t2h1dwt
  && t2w1lwt4 < t2w1r1 && t2w1lwt4 < t2w1l1 && t2w1lwt4 < t2h1u1 && t2w1lwt4 < t2h1d1 && t2w1lwt4 <t2w1rwt1 && t2w1lwt4 <t2w1lwt1 && t2w1lwt4 < t2h1uwt1 && t2w1lwt4 < t2h1dwt1
  && t2w1lwt4 < t2w1r2 && t2w1lwt4 < t2w1l2 && t2w1lwt4 < t2h1u2 && t2w1lwt4 < t2h1d2 && t2w1lwt4 <t2w1rwt2 && t2w1lwt4 <t2w1lwt2 && t2w1lwt4 < t2h1uwt2 && t2w1lwt4 < t2h1dwt2
  && t2w1lwt4 < t2w1r3 && t2w1lwt4 < t2w1l3 && t2w1lwt4 < t2h1u3 && t2w1lwt4 < t2h1d3 && t2w1lwt4 <t2w1rwt3 && t2w1lwt4 <t2w1lwt3 && t2w1lwt4 < t2h1uwt3 && t2w1lwt4 < t2h1dwt3
  && t2w1lwt4 < t2w1r4 && t2w1lwt4 < t2w1l4 && t2w1lwt4 < t2h1u4 && t2w1lwt4 < t2h1d4 && t2w1lwt4 <t2w1rwt4 && t2w1lwt4 < t2h1uwt4 && t2w1lwt4 < t2h1dwt4
  && t2w1lwt4 < t2w1r5 && t2w1lwt4 < t2w1l5 && t2w1lwt4 < t2h1u5 && t2w1lwt4 < t2h1d5 && t2w1lwt4 <t2w1rwt5 && t2w1lwt4 <t2w1lwt5 && t2w1lwt4 < t2h1uwt5 && t2w1lwt4 < t2h1dwt5
  && t2w1lwt4 < t2w1r6 && t2w1lwt4 < t2w1l6 && t2w1lwt4 < t2h1u6 && t2w1lwt4 < t2h1d6 && t2w1lwt4 <t2w1rwt6 && t2w1lwt4 <t2w1lwt6 && t2w1lwt4 < t2h1uwt6 && t2w1lwt4 < t2h1dwt6
  && t2w1lwt4 < t2w1r7 && t2w1lwt4 < t2w1l7 && t2w1lwt4 < t2h1u7 && t2w1lwt4 < t2h1d7 && t2w1lwt4 <t2w1rwt7 && t2w1lwt4 <t2w1lwt7 && t2w1lwt4 < t2h1uwt7 && t2w1lwt4 < t2h1dwt7
  && t2w1lwt4 < t2w1r8 && t2w1lwt4 < t2w1l8 && t2w1lwt4 < t2h1u8 && t2w1lwt4 < t2h1d8 && t2w1lwt4 <t2w1rwt8 && t2w1lwt4 <t2w1lwt8 && t2w1lwt4 < t2h1uwt8 && t2w1lwt4 < t2h1dwt8
  && t2w1lwt4 < t2w1r9 && t2w1lwt4 < t2w1l9 && t2w1lwt4 < t2h1u9 && t2w1lwt4 < t2h1d9 && t2w1lwt4 <t2w1rwt9 && t2w1lwt4 <t2w1lwt9 && t2w1lwt4 < t2h1uwt9 && t2w1lwt4 < t2h1dwt9
  && t2w1lwt4 < t2w1r10 && t2w1lwt4 < t2w1l10 && t2w1lwt4 < t2h1u10 && t2w1lwt4 < t2h1d10 && t2w1lwt4 <t2w1rwt10 && t2w1lwt4 <t2w1lwt10 && t2w1lwt4 < t2h1uwt10 && t2w1lwt4 < t2h1dwt10
  && (loutwl4==0 && linwl4==0)){
  i=199;}

  if (myuOW4==-1 && t2h1uwt4 > 0 && t2h1uwt4 < t1 
  && t2h1uwt4 < t2w1r && t2h1uwt4 < t2w1l && t2h1uwt4 < t2h1u && t2h1uwt4 < t2h1d && t2h1uwt4 < t2w1rwt && t2h1uwt4 < t2w1lwt && t2h1uwt4 < t2h1uwt && t2h1uwt4 < t2h1dwt 
  && t2h1uwt4 < t2w1r1 && t2h1uwt4 < t2w1l1 && t2h1uwt4 < t2h1u1 && t2h1uwt4 < t2h1d1 && t2h1uwt4 < t2w1rwt1 && t2h1uwt4 < t2w1lwt1 && t2h1uwt4 < t2h1uwt1 && t2h1uwt4 < t2h1dwt1
  && t2h1uwt4 < t2w1r2 && t2h1uwt4 < t2w1l2 && t2h1uwt4 < t2h1u2 && t2h1uwt4 < t2h1d2 && t2h1uwt4 < t2w1rwt2 && t2h1uwt4 < t2w1lwt2 && t2h1uwt4 < t2h1uwt2 && t2h1uwt4 < t2h1dwt2
  && t2h1uwt4 < t2w1r3 && t2h1uwt4 < t2w1l3 && t2h1uwt4 < t2h1u3 && t2h1uwt4 < t2h1d3 && t2h1uwt4 < t2w1rwt3 && t2h1uwt4 < t2w1lwt3 && t2h1uwt4 < t2h1uwt3 && t2h1uwt4 < t2h1dwt3
  && t2h1uwt4 < t2w1r4 && t2h1uwt4 < t2w1l4 && t2h1uwt4 < t2h1u4 && t2h1uwt4 < t2h1d4 && t2h1uwt4 < t2w1rwt4 && t2h1uwt4 < t2w1lwt4 && t2h1uwt4 < t2h1dwt4
  && t2h1uwt4 < t2w1r5 && t2h1uwt4 < t2w1l5 && t2h1uwt4 < t2h1u5 && t2h1uwt4 < t2h1d5 && t2h1uwt4 < t2w1rwt5 && t2h1uwt4 < t2w1lwt5 && t2h1uwt4 < t2h1uwt5 && t2h1uwt4 < t2h1dwt5
  && t2h1uwt4 < t2w1r6 && t2h1uwt4 < t2w1l6 && t2h1uwt4 < t2h1u6 && t2h1uwt4 < t2h1d6 && t2h1uwt4 < t2w1rwt6 && t2h1uwt4 < t2w1lwt6 && t2h1uwt4 < t2h1uwt6 && t2h1uwt4 < t2h1dwt6
  && t2h1uwt4 < t2w1r7 && t2h1uwt4 < t2w1l7 && t2h1uwt4 < t2h1u7 && t2h1uwt4 < t2h1d7 && t2h1uwt4 < t2w1rwt7 && t2h1uwt4 < t2w1lwt7 && t2h1uwt4 < t2h1uwt7 && t2h1uwt4 < t2h1dwt7
  && t2h1uwt4 < t2w1r8 && t2h1uwt4 < t2w1l8 && t2h1uwt4 < t2h1u8 && t2h1uwt4 < t2h1d8 && t2h1uwt4 < t2w1rwt8 && t2h1uwt4 < t2w1lwt8 && t2h1uwt4 < t2h1uwt8 && t2h1uwt4 < t2h1dwt8
  && t2h1uwt4 < t2w1r9 && t2h1uwt4 < t2w1l9 && t2h1uwt4 < t2h1u9 && t2h1uwt4 < t2h1d9 && t2h1uwt4 < t2w1rwt9 && t2h1uwt4 < t2w1lwt9 && t2h1uwt4 < t2h1uwt9 && t2h1uwt4 < t2h1dwt9
  && t2h1uwt4 < t2w1r10 && t2h1uwt4 < t2w1l10 && t2h1uwt4 < t2h1u10 && t2h1uwt4 < t2h1d10 && t2h1uwt4 < t2w1rwt10 && t2h1uwt4 < t2w1lwt10 && t2h1uwt4 < t2h1uwt10 && t2h1uwt4 < t2h1dwt10
  && (louthu4 !=0 && linhu4!=0)){
  i=200;
  }

  if (myuOW4==-1 && t2h1uwt4 > 0 && t2h1uwt4 < t1 
  && t2h1uwt4 < t2w1r && t2h1uwt4 < t2w1l && t2h1uwt4 < t2h1u && t2h1uwt4 < t2h1d && t2h1uwt4 < t2w1rwt && t2h1uwt4 < t2w1lwt && t2h1uwt4 < t2h1uwt && t2h1uwt4 < t2h1dwt 
  && t2h1uwt4 < t2w1r1 && t2h1uwt4 < t2w1l1 && t2h1uwt4 < t2h1u1 && t2h1uwt4 < t2h1d1 && t2h1uwt4 < t2w1rwt1 && t2h1uwt4 < t2w1lwt1 && t2h1uwt4 < t2h1uwt1 && t2h1uwt4 < t2h1dwt1
  && t2h1uwt4 < t2w1r2 && t2h1uwt4 < t2w1l2 && t2h1uwt4 < t2h1u2 && t2h1uwt4 < t2h1d2 && t2h1uwt4 < t2w1rwt2 && t2h1uwt4 < t2w1lwt2 && t2h1uwt4 < t2h1uwt2 && t2h1uwt4 < t2h1dwt2
  && t2h1uwt4 < t2w1r3 && t2h1uwt4 < t2w1l3 && t2h1uwt4 < t2h1u3 && t2h1uwt4 < t2h1d3 && t2h1uwt4 < t2w1rwt3 && t2h1uwt4 < t2w1lwt3 && t2h1uwt4 < t2h1uwt3 && t2h1uwt4 < t2h1dwt3
  && t2h1uwt4 < t2w1r4 && t2h1uwt4 < t2w1l4 && t2h1uwt4 < t2h1u4 && t2h1uwt4 < t2h1d4 && t2h1uwt4 < t2w1rwt4 && t2h1uwt4 < t2w1lwt4 && t2h1uwt4 < t2h1dwt4
  && t2h1uwt4 < t2w1r5 && t2h1uwt4 < t2w1l5 && t2h1uwt4 < t2h1u5 && t2h1uwt4 < t2h1d5 && t2h1uwt4 < t2w1rwt5 && t2h1uwt4 < t2w1lwt5 && t2h1uwt4 < t2h1uwt5 && t2h1uwt4 < t2h1dwt5
  && t2h1uwt4 < t2w1r6 && t2h1uwt4 < t2w1l6 && t2h1uwt4 < t2h1u6 && t2h1uwt4 < t2h1d6 && t2h1uwt4 < t2w1rwt6 && t2h1uwt4 < t2w1lwt6 && t2h1uwt4 < t2h1uwt6 && t2h1uwt4 < t2h1dwt6
  && t2h1uwt4 < t2w1r7 && t2h1uwt4 < t2w1l7 && t2h1uwt4 < t2h1u7 && t2h1uwt4 < t2h1d7 && t2h1uwt4 < t2w1rwt7 && t2h1uwt4 < t2w1lwt7 && t2h1uwt4 < t2h1uwt7 && t2h1uwt4 < t2h1dwt7
  && t2h1uwt4 < t2w1r8 && t2h1uwt4 < t2w1l8 && t2h1uwt4 < t2h1u8 && t2h1uwt4 < t2h1d8 && t2h1uwt4 < t2w1rwt8 && t2h1uwt4 < t2w1lwt8 && t2h1uwt4 < t2h1uwt8 && t2h1uwt4 < t2h1dwt8
  && t2h1uwt4 < t2w1r9 && t2h1uwt4 < t2w1l9 && t2h1uwt4 < t2h1u9 && t2h1uwt4 < t2h1d9 && t2h1uwt4 < t2w1rwt9 && t2h1uwt4 < t2w1lwt9 && t2h1uwt4 < t2h1uwt9 && t2h1uwt4 < t2h1dwt9
  && t2h1uwt4 < t2w1r10 && t2h1uwt4 < t2w1l10 && t2h1uwt4 < t2h1u10 && t2h1uwt4 < t2h1d10 && t2h1uwt4 < t2w1rwt10 && t2h1uwt4 < t2w1lwt10 && t2h1uwt4 < t2h1uwt10 && t2h1uwt4 < t2h1dwt10
  && ((louthu4!=0 && linhu4==0) || (louthu4==0 && linhu4!=0))){
  i=200;
  }

  if (myuOW4==-1 && t2h1uwt4 > 0 && t2h1uwt4 < t1 
  && t2h1uwt4 < t2w1r && t2h1uwt4 < t2w1l && t2h1uwt4 < t2h1u && t2h1uwt4 < t2h1d && t2h1uwt4 < t2w1rwt && t2h1uwt4 < t2w1lwt && t2h1uwt4 < t2h1uwt && t2h1uwt4 < t2h1dwt 
  && t2h1uwt4 < t2w1r1 && t2h1uwt4 < t2w1l1 && t2h1uwt4 < t2h1u1 && t2h1uwt4 < t2h1d1 && t2h1uwt4 < t2w1rwt1 && t2h1uwt4 < t2w1lwt1 && t2h1uwt4 < t2h1uwt1 && t2h1uwt4 < t2h1dwt1
  && t2h1uwt4 < t2w1r2 && t2h1uwt4 < t2w1l2 && t2h1uwt4 < t2h1u2 && t2h1uwt4 < t2h1d2 && t2h1uwt4 < t2w1rwt2 && t2h1uwt4 < t2w1lwt2 && t2h1uwt4 < t2h1uwt2 && t2h1uwt4 < t2h1dwt2
  && t2h1uwt4 < t2w1r3 && t2h1uwt4 < t2w1l3 && t2h1uwt4 < t2h1u3 && t2h1uwt4 < t2h1d3 && t2h1uwt4 < t2w1rwt3 && t2h1uwt4 < t2w1lwt3 && t2h1uwt4 < t2h1uwt3 && t2h1uwt4 < t2h1dwt3
  && t2h1uwt4 < t2w1r4 && t2h1uwt4 < t2w1l4 && t2h1uwt4 < t2h1u4 && t2h1uwt4 < t2h1d4 && t2h1uwt4 < t2w1rwt4 && t2h1uwt4 < t2w1lwt4 && t2h1uwt4 < t2h1dwt4
  && t2h1uwt4 < t2w1r5 && t2h1uwt4 < t2w1l5 && t2h1uwt4 < t2h1u5 && t2h1uwt4 < t2h1d5 && t2h1uwt4 < t2w1rwt5 && t2h1uwt4 < t2w1lwt5 && t2h1uwt4 < t2h1uwt5 && t2h1uwt4 < t2h1dwt5
  && t2h1uwt4 < t2w1r6 && t2h1uwt4 < t2w1l6 && t2h1uwt4 < t2h1u6 && t2h1uwt4 < t2h1d6 && t2h1uwt4 < t2w1rwt6 && t2h1uwt4 < t2w1lwt6 && t2h1uwt4 < t2h1uwt6 && t2h1uwt4 < t2h1dwt6
  && t2h1uwt4 < t2w1r7 && t2h1uwt4 < t2w1l7 && t2h1uwt4 < t2h1u7 && t2h1uwt4 < t2h1d7 && t2h1uwt4 < t2w1rwt7 && t2h1uwt4 < t2w1lwt7 && t2h1uwt4 < t2h1uwt7 && t2h1uwt4 < t2h1dwt7
  && t2h1uwt4 < t2w1r8 && t2h1uwt4 < t2w1l8 && t2h1uwt4 < t2h1u8 && t2h1uwt4 < t2h1d8 && t2h1uwt4 < t2w1rwt8 && t2h1uwt4 < t2w1lwt8 && t2h1uwt4 < t2h1uwt8 && t2h1uwt4 < t2h1dwt8
  && t2h1uwt4 < t2w1r9 && t2h1uwt4 < t2w1l9 && t2h1uwt4 < t2h1u9 && t2h1uwt4 < t2h1d9 && t2h1uwt4 < t2w1rwt9 && t2h1uwt4 < t2w1lwt9 && t2h1uwt4 < t2h1uwt9 && t2h1uwt4 < t2h1dwt9
  && t2h1uwt4 < t2w1r10 && t2h1uwt4 < t2w1l10 && t2h1uwt4 < t2h1u10 && t2h1uwt4 < t2h1d10 && t2h1uwt4 < t2w1rwt10 && t2h1uwt4 < t2w1lwt10 && t2h1uwt4 < t2h1uwt10 && t2h1uwt4 < t2h1dwt10
  && (louthu4 == 0 && linhu4 == 0)){
  i=200;
  }

  if (mydOW4==-1 && t2h1dwt4 > 0 && t2h1dwt4 < t1 
  && t2h1dwt4 < t2w1r && t2h1dwt4 < t2w1l && t2h1dwt4 < t2h1u && t2h1dwt4 < t2h1d && t2h1dwt4 < t2w1rwt && t2h1dwt4 < t2w1lwt && t2h1dwt4 < t2h1uwt && t2h1dwt4 < t2h1dwt 
  && t2h1dwt4 < t2w1r1 && t2h1dwt4 < t2w1l1 && t2h1dwt4 < t2h1u1 && t2h1dwt4 < t2h1d1 && t2h1dwt4 < t2w1rwt1 && t2h1dwt4 < t2w1lwt1 && t2h1dwt4 < t2h1uwt1 && t2h1dwt4 < t2h1dwt1
  && t2h1dwt4 < t2w1r2 && t2h1dwt4 < t2w1l2 && t2h1dwt4 < t2h1u2 && t2h1dwt4 < t2h1d2 && t2h1dwt4 < t2w1rwt2 && t2h1dwt4 < t2w1lwt2 && t2h1dwt4 < t2h1uwt2 && t2h1dwt4 < t2h1dwt2 
  && t2h1dwt4 < t2w1r3 && t2h1dwt4 < t2w1l3 && t2h1dwt4 < t2h1u3 && t2h1dwt4 < t2h1d3 && t2h1dwt4 < t2w1rwt3 && t2h1dwt4 < t2w1lwt3 && t2h1dwt4 < t2h1uwt3 && t2h1dwt4 < t2h1dwt3
  && t2h1dwt4 < t2w1r4 && t2h1dwt4 < t2w1l4 && t2h1dwt4 < t2h1u4 && t2h1dwt4 < t2h1d4 && t2h1dwt4 < t2w1rwt4 && t2h1dwt4 < t2w1lwt4 && t2h1dwt4 < t2h1uwt4 
  && t2h1dwt4 < t2w1r5 && t2h1dwt4 < t2w1l5 && t2h1dwt4 < t2h1u5 && t2h1dwt4 < t2h1d5 && t2h1dwt4 < t2w1rwt5 && t2h1dwt4 < t2w1lwt5 && t2h1dwt4 < t2h1uwt5 && t2h1dwt4 < t2h1dwt5
  && t2h1dwt4 < t2w1r6 && t2h1dwt4 < t2w1l6 && t2h1dwt4 < t2h1u6 && t2h1dwt4 < t2h1d6 && t2h1dwt4 < t2w1rwt6 && t2h1dwt4 < t2w1lwt6 && t2h1dwt4 < t2h1uwt6 && t2h1dwt4 < t2h1dwt6
  && t2h1dwt4 < t2w1r7 && t2h1dwt4 < t2w1l7 && t2h1dwt4 < t2h1u7 && t2h1dwt4 < t2h1d7 && t2h1dwt4 < t2w1rwt7 && t2h1dwt4 < t2w1lwt7 && t2h1dwt4 < t2h1uwt7 && t2h1dwt4 < t2h1dwt7 
  && t2h1dwt4 < t2w1r8 && t2h1dwt4 < t2w1l8 && t2h1dwt4 < t2h1u8 && t2h1dwt4 < t2h1d8 && t2h1dwt4 < t2w1rwt8 && t2h1dwt4 < t2w1lwt8 && t2h1dwt4 < t2h1uwt8 && t2h1dwt4 < t2h1dwt8
  && t2h1dwt4 < t2w1r9 && t2h1dwt4 < t2w1l9 && t2h1dwt4 < t2h1u9 && t2h1dwt4 < t2h1d9 && t2h1dwt4 < t2w1rwt9 && t2h1dwt4 < t2w1lwt9 && t2h1dwt4 < t2h1uwt9 && t2h1dwt4 < t2h1dwt9 
  && t2h1dwt4 < t2w1r10 && t2h1dwt4 < t2w1l10 && t2h1dwt4 < t2h1u10 && t2h1dwt4 < t2h1d10 && t2h1dwt4 < t2w1rwt10 && t2h1dwt4 < t2w1lwt10 && t2h1dwt4 < t2h1uwt10 && t2h1dwt4 < t2h1dwt10  
  && (louthd4 !=0 && linhd4!=0)){
  i=201;
  }

  if (mydOW4==-1 && t2h1dwt4 > 0 && t2h1dwt4 < t1 
  && t2h1dwt4 < t2w1r && t2h1dwt4 < t2w1l && t2h1dwt4 < t2h1u && t2h1dwt4 < t2h1d && t2h1dwt4 < t2w1rwt && t2h1dwt4 < t2w1lwt && t2h1dwt4 < t2h1uwt && t2h1dwt4 < t2h1dwt 
  && t2h1dwt4 < t2w1r1 && t2h1dwt4 < t2w1l1 && t2h1dwt4 < t2h1u1 && t2h1dwt4 < t2h1d1 && t2h1dwt4 < t2w1rwt1 && t2h1dwt4 < t2w1lwt1 && t2h1dwt4 < t2h1uwt1 && t2h1dwt4 < t2h1dwt1
  && t2h1dwt4 < t2w1r2 && t2h1dwt4 < t2w1l2 && t2h1dwt4 < t2h1u2 && t2h1dwt4 < t2h1d2 && t2h1dwt4 < t2w1rwt2 && t2h1dwt4 < t2w1lwt2 && t2h1dwt4 < t2h1uwt2 && t2h1dwt4 < t2h1dwt2 
  && t2h1dwt4 < t2w1r3 && t2h1dwt4 < t2w1l3 && t2h1dwt4 < t2h1u3 && t2h1dwt4 < t2h1d3 && t2h1dwt4 < t2w1rwt3 && t2h1dwt4 < t2w1lwt3 && t2h1dwt4 < t2h1uwt3 && t2h1dwt4 < t2h1dwt3
  && t2h1dwt4 < t2w1r4 && t2h1dwt4 < t2w1l4 && t2h1dwt4 < t2h1u4 && t2h1dwt4 < t2h1d4 && t2h1dwt4 < t2w1rwt4 && t2h1dwt4 < t2w1lwt4 && t2h1dwt4 < t2h1uwt4 
  && t2h1dwt4 < t2w1r5 && t2h1dwt4 < t2w1l5 && t2h1dwt4 < t2h1u5 && t2h1dwt4 < t2h1d5 && t2h1dwt4 < t2w1rwt5 && t2h1dwt4 < t2w1lwt5 && t2h1dwt4 < t2h1uwt5 && t2h1dwt4 < t2h1dwt5
  && t2h1dwt4 < t2w1r6 && t2h1dwt4 < t2w1l6 && t2h1dwt4 < t2h1u6 && t2h1dwt4 < t2h1d6 && t2h1dwt4 < t2w1rwt6 && t2h1dwt4 < t2w1lwt6 && t2h1dwt4 < t2h1uwt6 && t2h1dwt4 < t2h1dwt6
  && t2h1dwt4 < t2w1r7 && t2h1dwt4 < t2w1l7 && t2h1dwt4 < t2h1u7 && t2h1dwt4 < t2h1d7 && t2h1dwt4 < t2w1rwt7 && t2h1dwt4 < t2w1lwt7 && t2h1dwt4 < t2h1uwt7 && t2h1dwt4 < t2h1dwt7 
  && t2h1dwt4 < t2w1r8 && t2h1dwt4 < t2w1l8 && t2h1dwt4 < t2h1u8 && t2h1dwt4 < t2h1d8 && t2h1dwt4 < t2w1rwt8 && t2h1dwt4 < t2w1lwt8 && t2h1dwt4 < t2h1uwt8 && t2h1dwt4 < t2h1dwt8
  && t2h1dwt4 < t2w1r9 && t2h1dwt4 < t2w1l9 && t2h1dwt4 < t2h1u9 && t2h1dwt4 < t2h1d9 && t2h1dwt4 < t2w1rwt9 && t2h1dwt4 < t2w1lwt9 && t2h1dwt4 < t2h1uwt9 && t2h1dwt4 < t2h1dwt9 
  && t2h1dwt4 < t2w1r10 && t2h1dwt4 < t2w1l10 && t2h1dwt4 < t2h1u10 && t2h1dwt4 < t2h1d10 && t2h1dwt4 < t2w1rwt10 && t2h1dwt4 < t2w1lwt10 && t2h1dwt4 < t2h1uwt10 && t2h1dwt4 < t2h1dwt10
  && ((louthd4 !=0 && linhd4==0) || (louthd4 ==0 && linhd4!=0))){
  i=201;
  }

  if (mydOW4==-1 && t2h1dwt4 > 0 && t2h1dwt4 < t1 
  && t2h1dwt4 < t2w1r && t2h1dwt4 < t2w1l && t2h1dwt4 < t2h1u && t2h1dwt4 < t2h1d && t2h1dwt4 < t2w1rwt && t2h1dwt4 < t2w1lwt && t2h1dwt4 < t2h1uwt && t2h1dwt4 < t2h1dwt 
  && t2h1dwt4 < t2w1r1 && t2h1dwt4 < t2w1l1 && t2h1dwt4 < t2h1u1 && t2h1dwt4 < t2h1d1 && t2h1dwt4 < t2w1rwt1 && t2h1dwt4 < t2w1lwt1 && t2h1dwt4 < t2h1uwt1 && t2h1dwt4 < t2h1dwt1
  && t2h1dwt4 < t2w1r2 && t2h1dwt4 < t2w1l2 && t2h1dwt4 < t2h1u2 && t2h1dwt4 < t2h1d2 && t2h1dwt4 < t2w1rwt2 && t2h1dwt4 < t2w1lwt2 && t2h1dwt4 < t2h1uwt2 && t2h1dwt4 < t2h1dwt2 
  && t2h1dwt4 < t2w1r3 && t2h1dwt4 < t2w1l3 && t2h1dwt4 < t2h1u3 && t2h1dwt4 < t2h1d3 && t2h1dwt4 < t2w1rwt3 && t2h1dwt4 < t2w1lwt3 && t2h1dwt4 < t2h1uwt3 && t2h1dwt4 < t2h1dwt3
  && t2h1dwt4 < t2w1r4 && t2h1dwt4 < t2w1l4 && t2h1dwt4 < t2h1u4 && t2h1dwt4 < t2h1d4 && t2h1dwt4 < t2w1rwt4 && t2h1dwt4 < t2w1lwt4 && t2h1dwt4 < t2h1uwt4 
  && t2h1dwt4 < t2w1r5 && t2h1dwt4 < t2w1l5 && t2h1dwt4 < t2h1u5 && t2h1dwt4 < t2h1d5 && t2h1dwt4 < t2w1rwt5 && t2h1dwt4 < t2w1lwt5 && t2h1dwt4 < t2h1uwt5 && t2h1dwt4 < t2h1dwt5
  && t2h1dwt4 < t2w1r6 && t2h1dwt4 < t2w1l6 && t2h1dwt4 < t2h1u6 && t2h1dwt4 < t2h1d6 && t2h1dwt4 < t2w1rwt6 && t2h1dwt4 < t2w1lwt6 && t2h1dwt4 < t2h1uwt6 && t2h1dwt4 < t2h1dwt6
  && t2h1dwt4 < t2w1r7 && t2h1dwt4 < t2w1l7 && t2h1dwt4 < t2h1u7 && t2h1dwt4 < t2h1d7 && t2h1dwt4 < t2w1rwt7 && t2h1dwt4 < t2w1lwt7 && t2h1dwt4 < t2h1uwt7 && t2h1dwt4 < t2h1dwt7 
  && t2h1dwt4 < t2w1r8 && t2h1dwt4 < t2w1l8 && t2h1dwt4 < t2h1u8 && t2h1dwt4 < t2h1d8 && t2h1dwt4 < t2w1rwt8 && t2h1dwt4 < t2w1lwt8 && t2h1dwt4 < t2h1uwt8 && t2h1dwt4 < t2h1dwt8
  && t2h1dwt4 < t2w1r9 && t2h1dwt4 < t2w1l9 && t2h1dwt4 < t2h1u9 && t2h1dwt4 < t2h1d9 && t2h1dwt4 < t2w1rwt9 && t2h1dwt4 < t2w1lwt9 && t2h1dwt4 < t2h1uwt9 && t2h1dwt4 < t2h1dwt9 
  && t2h1dwt4 < t2w1r10 && t2h1dwt4 < t2w1l10 && t2h1dwt4 < t2h1u10 && t2h1dwt4 < t2h1d10 && t2h1dwt4 < t2w1rwt10 && t2h1dwt4 < t2w1lwt10 && t2h1dwt4 < t2h1uwt10 && t2h1dwt4 < t2h1dwt10
  && (louthd4 == 0 && linhd4 == 0)){ 
  i=201;
  }


  if (mxr5!=-1 && t2w1r5 > 0 && t2w1r5 < t1 
     && t2w1r5 < t2w1r && t2w1r5 < t2w1l && t2w1r5 < t2h1u && t2w1r5 < t2h1d && t2w1r5 < t2w1rwt && t2w1r5 < t2w1lwt && t2w1r5 < t2h1uwt && t2w1r5 < t2h1dwt
     && t2w1r5 < t2w1r1 && t2w1r5 < t2w1l1 && t2w1r5 < t2h1u1 && t2w1r5 < t2h1d1 && t2w1r5 < t2w1rwt1 && t2w1r5 < t2w1lwt1 && t2w1r5 < t2h1uwt1 && t2w1r5 < t2h1dwt1
     && t2w1r5 < t2w1r2 && t2w1r5 < t2w1l2 && t2w1r5 < t2h1u2 && t2w1r5 < t2h1d2 && t2w1r5 < t2w1rwt2 && t2w1r5 < t2w1lwt2 && t2w1r5 < t2h1uwt2 && t2w1r5 < t2h1dwt2 
     && t2w1r5 < t2w1r3 && t2w1r5 < t2w1l3 && t2w1r5 < t2h1u3 && t2w1r5 < t2h1d3 && t2w1r5 < t2w1rwt3 && t2w1r5 < t2w1lwt3 && t2w1r5 < t2h1uwt3 && t2w1r5 < t2h1dwt3
     && t2w1r5 < t2w1r4 && t2w1r5 < t2w1l4 && t2w1r5 < t2h1u4 && t2w1r5 < t2h1d4 && t2w1r5 < t2w1rwt4 && t2w1r5 < t2w1lwt4 && t2w1r5 < t2h1uwt4 && t2w1r5 < t2h1dwt4
     && t2w1r5 < t2w1l5 && t2w1r5 < t2h1u5 && t2w1r5 < t2h1d5 && t2w1r5 < t2w1rwt5 && t2w1r5 < t2w1lwt5 && t2w1r5 < t2h1uwt5 && t2w1r5 < t2h1dwt5
     && t2w1r5 < t2w1r6 && t2w1r5 < t2w1l6 && t2w1r5 < t2h1u6 && t2w1r5 < t2h1d6 && t2w1r5 < t2w1rwt6 && t2w1r5 < t2w1lwt6 && t2w1r5 < t2h1uwt6 && t2w1r5 < t2h1dwt6
     && t2w1r5 < t2w1r7 && t2w1r5 < t2w1l7 && t2w1r5 < t2h1u7 && t2w1r5 < t2h1d7 && t2w1r5 < t2w1rwt7 && t2w1r5 < t2w1lwt7 && t2w1r5 < t2h1uwt7 && t2w1r5 < t2h1dwt7
     && t2w1r5 < t2w1r8 && t2w1r5 < t2w1l8 && t2w1r5 < t2h1u8 && t2w1r5 < t2h1d8 && t2w1r5 < t2w1rwt8 && t2w1r5 < t2w1lwt8 && t2w1r5 < t2h1uwt8 && t2w1r5 < t2h1dwt8
     && t2w1r5 < t2w1r9 && t2w1r5 < t2w1l9 && t2w1r5 < t2h1u9 && t2w1r5 < t2h1d9 && t2w1r5 < t2w1rwt9 && t2w1r5 < t2w1lwt9 && t2w1r5 < t2h1uwt9 && t2w1r5 < t2h1dwt9
     && t2w1r5 < t2w1r10 && t2w1r5 < t2w1l10 && t2w1r5 < t2h1u10 && t2w1r5 < t2h1d10 && t2w1r5 < t2w1rwt10 && t2w1r5 < t2w1lwt10 && t2w1r5 < t2h1uwt10 && t2w1r5 < t2h1dwt10
     && ((linwr5!=0) && (loutwr5!=0) )) {	
    if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1r5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1r5+z))*(z0hd5+(vz*t2w1r5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1r5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1r5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1r5+z))*(z0hu5+(vz*t2w1r5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1r5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1r5+y;
  xlimitr=bwr5*sqrt(1-((vz*t2w1r5+z)+z0wr5)*((vz*t2w1r5+z)+z0wr5)/a2wr5);
  xtest=vx*t2w1r5+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr5 > 0){
  i=202;
  }else{
  i=218;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr5!=-1 && t2w1r5 > 0 && t2w1r5 < t1 
     && t2w1r5 < t2w1r && t2w1r5 < t2w1l && t2w1r5 < t2h1u && t2w1r5 < t2h1d && t2w1r5 < t2w1rwt && t2w1r5 < t2w1lwt && t2w1r5 < t2h1uwt && t2w1r5 < t2h1dwt
     && t2w1r5 < t2w1r1 && t2w1r5 < t2w1l1 && t2w1r5 < t2h1u1 && t2w1r5 < t2h1d1 && t2w1r5 < t2w1rwt1 && t2w1r5 < t2w1lwt1 && t2w1r5 < t2h1uwt1 && t2w1r5 < t2h1dwt1
     && t2w1r5 < t2w1r2 && t2w1r5 < t2w1l2 && t2w1r5 < t2h1u2 && t2w1r5 < t2h1d2 && t2w1r5 < t2w1rwt2 && t2w1r5 < t2w1lwt2 && t2w1r5 < t2h1uwt2 && t2w1r5 < t2h1dwt2 
     && t2w1r5 < t2w1r3 && t2w1r5 < t2w1l3 && t2w1r5 < t2h1u3 && t2w1r5 < t2h1d3 && t2w1r5 < t2w1rwt3 && t2w1r5 < t2w1lwt3 && t2w1r5 < t2h1uwt3 && t2w1r5 < t2h1dwt3
     && t2w1r5 < t2w1r4 && t2w1r5 < t2w1l4 && t2w1r5 < t2h1u4 && t2w1r5 < t2h1d4 && t2w1r5 < t2w1rwt4 && t2w1r5 < t2w1lwt4 && t2w1r5 < t2h1uwt4 && t2w1r5 < t2h1dwt4
     && t2w1r5 < t2w1l5 && t2w1r5 < t2h1u5 && t2w1r5 < t2h1d5 && t2w1r5 < t2w1rwt5 && t2w1r5 < t2w1lwt5 && t2w1r5 < t2h1uwt5 && t2w1r5 < t2h1dwt5
     && t2w1r5 < t2w1r6 && t2w1r5 < t2w1l6 && t2w1r5 < t2h1u6 && t2w1r5 < t2h1d6 && t2w1r5 < t2w1rwt6 && t2w1r5 < t2w1lwt6 && t2w1r5 < t2h1uwt6 && t2w1r5 < t2h1dwt6
     && t2w1r5 < t2w1r7 && t2w1r5 < t2w1l7 && t2w1r5 < t2h1u7 && t2w1r5 < t2h1d7 && t2w1r5 < t2w1rwt7 && t2w1r5 < t2w1lwt7 && t2w1r5 < t2h1uwt7 && t2w1r5 < t2h1dwt7
     && t2w1r5 < t2w1r8 && t2w1r5 < t2w1l8 && t2w1r5 < t2h1u8 && t2w1r5 < t2h1d8 && t2w1r5 < t2w1rwt8 && t2w1r5 < t2w1lwt8 && t2w1r5 < t2h1uwt8 && t2w1r5 < t2h1dwt8
     && t2w1r5 < t2w1r9 && t2w1r5 < t2w1l9 && t2w1r5 < t2h1u9 && t2w1r5 < t2h1d9 && t2w1r5 < t2w1rwt9 && t2w1r5 < t2w1lwt9 && t2w1r5 < t2h1uwt9 && t2w1r5 < t2h1dwt9
     && t2w1r5 < t2w1r10 && t2w1r5 < t2w1l10 && t2w1r5 < t2h1u10 && t2w1r5 < t2h1d10 && t2w1r5 < t2w1rwt10 && t2w1r5 < t2w1lwt10 && t2w1r5 < t2h1uwt10 && t2w1r5 < t2h1dwt10
     && ((loutwr5!=0 && linwr5==0) || (loutwr5==0 && linwr5!=0))){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1r5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1r5+z))*(z0hd5+(vz*t2w1r5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1r5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1r5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1r5+z))*(z0hu5+(vz*t2w1r5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1r5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1r5+y;
  xtest=vx*t2w1r5+x;
  xlimitr=-sqrt(pbwr5-(vz*t2w1r5+z)/pawr5);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr5 > 0){
  i=203;
  }else{
  i=218;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr5!=-1 && t2w1r5 > 0 && t2w1r5 < t1 
     && t2w1r5 < t2w1r && t2w1r5 < t2w1l && t2w1r5 < t2h1u && t2w1r5 < t2h1d && t2w1r5 < t2w1rwt && t2w1r5 < t2w1lwt && t2w1r5 < t2h1uwt && t2w1r5 < t2h1dwt
     && t2w1r5 < t2w1r1 && t2w1r5 < t2w1l1 && t2w1r5 < t2h1u1 && t2w1r5 < t2h1d1 && t2w1r5 < t2w1rwt1 && t2w1r5 < t2w1lwt1 && t2w1r5 < t2h1uwt1 && t2w1r5 < t2h1dwt1
     && t2w1r5 < t2w1r2 && t2w1r5 < t2w1l2 && t2w1r5 < t2h1u2 && t2w1r5 < t2h1d2 && t2w1r5 < t2w1rwt2 && t2w1r5 < t2w1lwt2 && t2w1r5 < t2h1uwt2 && t2w1r5 < t2h1dwt2 
     && t2w1r5 < t2w1r3 && t2w1r5 < t2w1l3 && t2w1r5 < t2h1u3 && t2w1r5 < t2h1d3 && t2w1r5 < t2w1rwt3 && t2w1r5 < t2w1lwt3 && t2w1r5 < t2h1uwt3 && t2w1r5 < t2h1dwt3
     && t2w1r5 < t2w1r4 && t2w1r5 < t2w1l4 && t2w1r5 < t2h1u4 && t2w1r5 < t2h1d4 && t2w1r5 < t2w1rwt4 && t2w1r5 < t2w1lwt4 && t2w1r5 < t2h1uwt4 && t2w1r5 < t2h1dwt4
     && t2w1r5 < t2w1l5 && t2w1r5 < t2h1u5 && t2w1r5 < t2h1d5 && t2w1r5 < t2w1rwt5 && t2w1r5 < t2w1lwt5 && t2w1r5 < t2h1uwt5 && t2w1r5 < t2h1dwt5
     && t2w1r5 < t2w1r6 && t2w1r5 < t2w1l6 && t2w1r5 < t2h1u6 && t2w1r5 < t2h1d6 && t2w1r5 < t2w1rwt6 && t2w1r5 < t2w1lwt6 && t2w1r5 < t2h1uwt6 && t2w1r5 < t2h1dwt6
     && t2w1r5 < t2w1r7 && t2w1r5 < t2w1l7 && t2w1r5 < t2h1u7 && t2w1r5 < t2h1d7 && t2w1r5 < t2w1rwt7 && t2w1r5 < t2w1lwt7 && t2w1r5 < t2h1uwt7 && t2w1r5 < t2h1dwt7
     && t2w1r5 < t2w1r8 && t2w1r5 < t2w1l8 && t2w1r5 < t2h1u8 && t2w1r5 < t2h1d8 && t2w1r5 < t2w1rwt8 && t2w1r5 < t2w1lwt8 && t2w1r5 < t2h1uwt8 && t2w1r5 < t2h1dwt8
     && t2w1r5 < t2w1r9 && t2w1r5 < t2w1l9 && t2w1r5 < t2h1u9 && t2w1r5 < t2h1d9 && t2w1r5 < t2w1rwt9 && t2w1r5 < t2w1lwt9 && t2w1r5 < t2h1uwt9 && t2w1r5 < t2h1dwt9
     && t2w1r5 < t2w1r10 && t2w1r5 < t2w1l10 && t2w1r5 < t2h1u10 && t2w1r5 < t2h1d10 && t2w1r5 < t2w1rwt10 && t2w1r5 < t2w1lwt10 && t2w1r5 < t2h1uwt10 && t2w1r5 < t2h1dwt10
     && (loutwr5==0 && linwr5==0)){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1r5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1r5+z))*(z0hd5+(vz*t2w1r5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1r5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1r5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1r5+z))*(z0hu5+(vz*t2w1r5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1r5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1r5+y;
  xtest=vx*t2w1r5+x;
  xlimitr=-(w2r5+w1r5)*(vz*t2w1r5+z)/l-w1r5;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr5>0){
  i=204;
  }else{
  i=218;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl5!=-1 && t2w1l5 > 0 && t2w1l5 < t1 
      && t2w1l5 < t2w1r && t2w1l5 < t2w1l && t2w1l5 < t2h1u && t2w1l5 < t2h1d && t2w1l5 < t2w1rwt && t2w1l5 < t2w1lwt && t2w1l5 < t2h1uwt && t2w1l5 < t2h1dwt
      && t2w1l5 < t2w1r1 && t2w1l5 < t2w1l1 && t2w1l5 < t2h1u1 && t2w1l5 < t2h1d1 && t2w1l5 < t2w1rwt1 && t2w1l5 < t2w1lwt1 && t2w1l5 < t2h1uwt1 && t2w1l5 < t2h1dwt1
      && t2w1l5 < t2w1r2 && t2w1l5 < t2w1l2 && t2w1l5 < t2h1u2 && t2w1l5 < t2h1d2 && t2w1l5 < t2w1rwt2 && t2w1l5 < t2w1lwt2 && t2w1l5 < t2h1uwt2 && t2w1l5 < t2h1dwt2
      && t2w1l5 < t2w1r3 && t2w1l5 < t2w1l3 && t2w1l5 < t2h1u3 && t2w1l5 < t2h1d3 && t2w1l5 < t2w1rwt3 && t2w1l5 < t2w1lwt3 && t2w1l5 < t2h1uwt3 && t2w1l5 < t2h1dwt3
      && t2w1l5 < t2w1r4 && t2w1l5 < t2w1l4 && t2w1l5 < t2h1u4 && t2w1l5 < t2h1d4 && t2w1l5 < t2w1rwt4 && t2w1l5 < t2w1lwt4 && t2w1l5 < t2h1uwt4 && t2w1l5 < t2h1dwt4
      && t2w1l5 < t2w1r5 && t2w1l5 < t2h1u5 && t2w1l5 < t2h1d5 && t2w1l5 < t2w1rwt5 && t2w1l5 < t2w1lwt5 && t2w1l5 < t2h1uwt5 && t2w1l5 < t2h1dwt5
      && t2w1l5 < t2w1r6 && t2w1l5 < t2w1l6 && t2w1l5 < t2h1u6 && t2w1l5 < t2h1d6 && t2w1l5 < t2w1rwt6 && t2w1l5 < t2w1lwt6 && t2w1l5 < t2h1uwt6 && t2w1l5 < t2h1dwt6
      && t2w1l5 < t2w1r7 && t2w1l5 < t2w1l7 && t2w1l5 < t2h1u7 && t2w1l5 < t2h1d7 && t2w1l5 < t2w1rwt7 && t2w1l5 < t2w1lwt7 && t2w1l5 < t2h1uwt7 && t2w1l5 < t2h1dwt7
      && t2w1l5 < t2w1r8 && t2w1l5 < t2w1l8 && t2w1l5 < t2h1u8 && t2w1l5 < t2h1d8 && t2w1l5 < t2w1rwt8 && t2w1l5 < t2w1lwt8 && t2w1l5 < t2h1uwt8 && t2w1l5 < t2h1dwt8
      && t2w1l5 < t2w1r9 && t2w1l5 < t2w1l9 && t2w1l5 < t2h1u9 && t2w1l5 < t2h1d9 && t2w1l5 < t2w1rwt9 && t2w1l5 < t2w1lwt9 && t2w1l5 < t2h1uwt9 && t2w1l5 < t2h1dwt9
      && t2w1l5 < t2w1r10 && t2w1l5 < t2w1l10 && t2w1l5 < t2h1u10 && t2w1l5 < t2h1d10 && t2w1l5 < t2w1rwt10 && t2w1l5 < t2w1lwt10 && t2w1l5 < t2h1uwt10 && t2w1l5 < t2h1dwt10
      && ((linwl5!=0) && (loutwl5!=0) )){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1l5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1l5+z))*(z0hd5+(vz*t2w1l5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1l5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1l5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1l5+z))*(z0hu5+(vz*t2w1l5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1l5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1l5+y;
  xlimitl=bwl5*sqrt(1-((vz*t2w1l5+z)+z0wl5)*((vz*t2w1l5+z)+z0wl5)/a2wl5);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl5>0){
  i=205;
  }else{
  i=219;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl5!=-1 && t2w1l5 > 0 && t2w1l5 < t1 
      && t2w1l5 < t2w1r && t2w1l5 < t2w1l && t2w1l5 < t2h1u && t2w1l5 < t2h1d && t2w1l5 < t2w1rwt && t2w1l5 < t2w1lwt && t2w1l5 < t2h1uwt && t2w1l5 < t2h1dwt
      && t2w1l5 < t2w1r1 && t2w1l5 < t2w1l1 && t2w1l5 < t2h1u1 && t2w1l5 < t2h1d1 && t2w1l5 < t2w1rwt1 && t2w1l5 < t2w1lwt1 && t2w1l5 < t2h1uwt1 && t2w1l5 < t2h1dwt1
      && t2w1l5 < t2w1r2 && t2w1l5 < t2w1l2 && t2w1l5 < t2h1u2 && t2w1l5 < t2h1d2 && t2w1l5 < t2w1rwt2 && t2w1l5 < t2w1lwt2 && t2w1l5 < t2h1uwt2 && t2w1l5 < t2h1dwt2
      && t2w1l5 < t2w1r3 && t2w1l5 < t2w1l3 && t2w1l5 < t2h1u3 && t2w1l5 < t2h1d3 && t2w1l5 < t2w1rwt3 && t2w1l5 < t2w1lwt3 && t2w1l5 < t2h1uwt3 && t2w1l5 < t2h1dwt3
      && t2w1l5 < t2w1r4 && t2w1l5 < t2w1l4 && t2w1l5 < t2h1u4 && t2w1l5 < t2h1d4 && t2w1l5 < t2w1rwt4 && t2w1l5 < t2w1lwt4 && t2w1l5 < t2h1uwt4 && t2w1l5 < t2h1dwt4
      && t2w1l5 < t2w1r5 && t2w1l5 < t2h1u5 && t2w1l5 < t2h1d5 && t2w1l5 < t2w1rwt5 && t2w1l5 < t2w1lwt5 && t2w1l5 < t2h1uwt5 && t2w1l5 < t2h1dwt5
      && t2w1l5 < t2w1r6 && t2w1l5 < t2w1l6 && t2w1l5 < t2h1u6 && t2w1l5 < t2h1d6 && t2w1l5 < t2w1rwt6 && t2w1l5 < t2w1lwt6 && t2w1l5 < t2h1uwt6 && t2w1l5 < t2h1dwt6
      && t2w1l5 < t2w1r7 && t2w1l5 < t2w1l7 && t2w1l5 < t2h1u7 && t2w1l5 < t2h1d7 && t2w1l5 < t2w1rwt7 && t2w1l5 < t2w1lwt7 && t2w1l5 < t2h1uwt7 && t2w1l5 < t2h1dwt7
      && t2w1l5 < t2w1r8 && t2w1l5 < t2w1l8 && t2w1l5 < t2h1u8 && t2w1l5 < t2h1d8 && t2w1l5 < t2w1rwt8 && t2w1l5 < t2w1lwt8 && t2w1l5 < t2h1uwt8 && t2w1l5 < t2h1dwt8
      && t2w1l5 < t2w1r9 && t2w1l5 < t2w1l9 && t2w1l5 < t2h1u9 && t2w1l5 < t2h1d9 && t2w1l5 < t2w1rwt9 && t2w1l5 < t2w1lwt9 && t2w1l5 < t2h1uwt9 && t2w1l5 < t2h1dwt9
      && t2w1l5 < t2w1r10 && t2w1l5 < t2w1l10 && t2w1l5 < t2h1u10 && t2w1l5 < t2h1d10 && t2w1l5 < t2w1rwt10 && t2w1l5 < t2w1lwt10 && t2w1l5 < t2h1uwt10 && t2w1l5 < t2h1dwt10
      && ((loutwl5!=0 && linwl5==0) || (loutwl5==0 && linwl5!=0))){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1l5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1l5+z))*(z0hd5+(vz*t2w1l5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1l5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1l5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1l5+z))*(z0hu5+(vz*t2w1l5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1l5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1l5+y;
  xlimitl=sqrt(pbwl5-(vz*t2w1l5+z)/pawl5);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl5>0){
  i=206;
  }else{
  i=219;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl5!=-1 && t2w1l5 > 0 && t2w1l5 < t1 
      && t2w1l5 < t2w1r && t2w1l5 < t2w1l && t2w1l5 < t2h1u && t2w1l5 < t2h1d && t2w1l5 < t2w1rwt && t2w1l5 < t2w1lwt && t2w1l5 < t2h1uwt && t2w1l5 < t2h1dwt
      && t2w1l5 < t2w1r1 && t2w1l5 < t2w1l1 && t2w1l5 < t2h1u1 && t2w1l5 < t2h1d1 && t2w1l5 < t2w1rwt1 && t2w1l5 < t2w1lwt1 && t2w1l5 < t2h1uwt1 && t2w1l5 < t2h1dwt1
      && t2w1l5 < t2w1r2 && t2w1l5 < t2w1l2 && t2w1l5 < t2h1u2 && t2w1l5 < t2h1d2 && t2w1l5 < t2w1rwt2 && t2w1l5 < t2w1lwt2 && t2w1l5 < t2h1uwt2 && t2w1l5 < t2h1dwt2
      && t2w1l5 < t2w1r3 && t2w1l5 < t2w1l3 && t2w1l5 < t2h1u3 && t2w1l5 < t2h1d3 && t2w1l5 < t2w1rwt3 && t2w1l5 < t2w1lwt3 && t2w1l5 < t2h1uwt3 && t2w1l5 < t2h1dwt3
      && t2w1l5 < t2w1r4 && t2w1l5 < t2w1l4 && t2w1l5 < t2h1u4 && t2w1l5 < t2h1d4 && t2w1l5 < t2w1rwt4 && t2w1l5 < t2w1lwt4 && t2w1l5 < t2h1uwt4 && t2w1l5 < t2h1dwt4
      && t2w1l5 < t2w1r5 && t2w1l5 < t2h1u5 && t2w1l5 < t2h1d5 && t2w1l5 < t2w1rwt5 && t2w1l5 < t2w1lwt5 && t2w1l5 < t2h1uwt5 && t2w1l5 < t2h1dwt5
      && t2w1l5 < t2w1r6 && t2w1l5 < t2w1l6 && t2w1l5 < t2h1u6 && t2w1l5 < t2h1d6 && t2w1l5 < t2w1rwt6 && t2w1l5 < t2w1lwt6 && t2w1l5 < t2h1uwt6 && t2w1l5 < t2h1dwt6
      && t2w1l5 < t2w1r7 && t2w1l5 < t2w1l7 && t2w1l5 < t2h1u7 && t2w1l5 < t2h1d7 && t2w1l5 < t2w1rwt7 && t2w1l5 < t2w1lwt7 && t2w1l5 < t2h1uwt7 && t2w1l5 < t2h1dwt7
      && t2w1l5 < t2w1r8 && t2w1l5 < t2w1l8 && t2w1l5 < t2h1u8 && t2w1l5 < t2h1d8 && t2w1l5 < t2w1rwt8 && t2w1l5 < t2w1lwt8 && t2w1l5 < t2h1uwt8 && t2w1l5 < t2h1dwt8
      && t2w1l5 < t2w1r9 && t2w1l5 < t2w1l9 && t2w1l5 < t2h1u9 && t2w1l5 < t2h1d9 && t2w1l5 < t2w1rwt9 && t2w1l5 < t2w1lwt9 && t2w1l5 < t2h1uwt9 && t2w1l5 < t2h1dwt9
      && t2w1l5 < t2w1r10 && t2w1l5 < t2w1l10 && t2w1l5 < t2h1u10 && t2w1l5 < t2h1d10 && t2w1l5 < t2w1rwt10 && t2w1l5 < t2w1lwt10 && t2w1l5 < t2h1uwt10 && t2w1l5 < t2h1dwt10
      && (loutwl5==0 && linwl5==0)){
 if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1l5+z)-h1d5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhd5*sqrt(1-((z0hd5+(vz*t2w1l5+z))*(z0hd5+(vz*t2w1l5+z)))/a2hd5);
      }else{
      ylimitd=-sqrt(((vz*t2w1l5+z)-pbhd5)/-pahd5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1l5+z)+h1u5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhu5*sqrt(1-((z0hu5+(vz*t2w1l5+z))*(z0hu5+(vz*t2w1l5+z)))/a2hu5);
     }else{
     ylimitu=sqrt(((vz*t2w1l5+z)-pbhu5)/-pahu5);
    }
    }
  ytest=vy*t2w1l5+y;
  xlimitl=(w2l5-w1l5)*(vz*t2w1l5+z)/l+w1l5;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl5>0){
  i=207;
  }else{
  i=219;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu5!=-1 && t2h1u5 > 0 && t2h1u5 < t1 
  && t2h1u5 < t2w1r && t2h1u5 < t2w1l && t2h1u5 < t2h1u && t2h1u5 < t2h1d && t2h1u5 < t2w1rwt && t2h1u5 < t2w1lwt && t2h1u5 < t2h1uwt && t2h1u5 < t2h1dwt
  && t2h1u5 < t2w1r1 && t2h1u5 < t2w1l1 && t2h1u5 < t2h1u1 && t2h1u5 < t2h1d1 && t2h1u5 < t2w1rwt1 && t2h1u5 < t2w1lwt1 && t2h1u5 < t2h1uwt1 && t2h1u5 < t2h1dwt1
  && t2h1u5 < t2w1r2 && t2h1u5 < t2w1l2 && t2h1u5 < t2h1u2 && t2h1u5 < t2h1d2 && t2h1u5 < t2w1rwt2 && t2h1u5 < t2w1lwt2 && t2h1u5 < t2h1uwt2 && t2h1u5 < t2h1dwt2
  && t2h1u5 < t2w1r3 && t2h1u5 < t2w1l3 && t2h1u5 < t2h1u3 && t2h1u5 < t2h1d3 && t2h1u5 < t2w1rwt3 && t2h1u5 < t2w1lwt3 && t2h1u5 < t2h1uwt3 && t2h1u5 < t2h1dwt3
  && t2h1u5 < t2w1r4 && t2h1u5 < t2w1l4 && t2h1u5 < t2h1u4 && t2h1u5 < t2h1d4 && t2h1u5 < t2w1rwt4 && t2h1u5 < t2w1lwt4 && t2h1u5 < t2h1uwt4 && t2h1u5 < t2h1dwt4
  && t2h1u5 < t2w1r5 && t2h1u5 < t2w1l5 && t2h1u5 < t2h1d5 && t2h1u5 < t2w1rwt5 && t2h1u5 < t2w1lwt5 && t2h1u5 < t2h1uwt5 && t2h1u5 < t2h1dwt5
  && t2h1u5 < t2w1r6 && t2h1u5 < t2w1l6 && t2h1u5 < t2h1u6 && t2h1u5 < t2h1d6 && t2h1u5 < t2w1rwt6 && t2h1u5 < t2w1lwt6 && t2h1u5 < t2h1uwt6 && t2h1u5 < t2h1dwt6
  && t2h1u5 < t2w1r7 && t2h1u5 < t2w1l7 && t2h1u5 < t2h1u7 && t2h1u5 < t2h1d7 && t2h1u5 < t2w1rwt7 && t2h1u5 < t2w1lwt7 && t2h1u5 < t2h1uwt7 && t2h1u5 < t2h1dwt7
  && t2h1u5 < t2w1r8 && t2h1u5 < t2w1l8 && t2h1u5 < t2h1u8 && t2h1u5 < t2h1d8 && t2h1u5 < t2w1rwt8 && t2h1u5 < t2w1lwt8 && t2h1u5 < t2h1uwt8 && t2h1u5 < t2h1dwt8
  && t2h1u5 < t2w1r9 && t2h1u5 < t2w1l9 && t2h1u5 < t2h1u9 && t2h1u5 < t2h1d9 && t2h1u5 < t2w1rwt9 && t2h1u5 < t2w1lwt9 && t2h1u5 < t2h1uwt9 && t2h1u5 < t2h1dwt9
  && t2h1u5 < t2w1r10 && t2h1u5 < t2w1l10 && t2h1u5 < t2h1u10 && t2h1u5 < t2h1d10 && t2h1u5 < t2w1rwt10 && t2h1u5 < t2w1lwt10 && t2h1u5 < t2h1uwt10 && t2h1u5 < t2h1dwt10
  && (louthu5 !=0 && linhu5!=0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1u5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1u5+z))*(z0wr5+(vz*t2h1u5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1u5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1u5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1u5+z))*(z0wl5+(vz*t2h1u5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1u5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1u5+x;
  ylimitu=bhu5*sqrt(1-((vz*t2h1u5+z)+z0hu5)*((vz*t2h1u5+z)+z0hu5)/a2hu5);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu5>0 ){
  i=208;
  }else{
  i=220;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu5!=-1 && t2h1u5 > 0 && t2h1u5 < t1
  && t2h1u5 < t2w1r && t2h1u5 < t2w1l && t2h1u5 < t2h1u && t2h1u5 < t2h1d && t2h1u5 < t2w1rwt && t2h1u5 < t2w1lwt && t2h1u5 < t2h1uwt && t2h1u5 < t2h1dwt
  && t2h1u5 < t2w1r1 && t2h1u5 < t2w1l1 && t2h1u5 < t2h1u1 && t2h1u5 < t2h1d1 && t2h1u5 < t2w1rwt1 && t2h1u5 < t2w1lwt1 && t2h1u5 < t2h1uwt1 && t2h1u5 < t2h1dwt1
  && t2h1u5 < t2w1r2 && t2h1u5 < t2w1l2 && t2h1u5 < t2h1u2 && t2h1u5 < t2h1d2 && t2h1u5 < t2w1rwt2 && t2h1u5 < t2w1lwt2 && t2h1u5 < t2h1uwt2 && t2h1u5 < t2h1dwt2
  && t2h1u5 < t2w1r3 && t2h1u5 < t2w1l3 && t2h1u5 < t2h1u3 && t2h1u5 < t2h1d3 && t2h1u5 < t2w1rwt3 && t2h1u5 < t2w1lwt3 && t2h1u5 < t2h1uwt3 && t2h1u5 < t2h1dwt3
  && t2h1u5 < t2w1r4 && t2h1u5 < t2w1l4 && t2h1u5 < t2h1u4 && t2h1u5 < t2h1d4 && t2h1u5 < t2w1rwt4 && t2h1u5 < t2w1lwt4 && t2h1u5 < t2h1uwt4 && t2h1u5 < t2h1dwt4
  && t2h1u5 < t2w1r5 && t2h1u5 < t2w1l5 && t2h1u5 < t2h1d5 && t2h1u5 < t2w1rwt5 && t2h1u5 < t2w1lwt5 && t2h1u5 < t2h1uwt5 && t2h1u5 < t2h1dwt5
  && t2h1u5 < t2w1r6 && t2h1u5 < t2w1l6 && t2h1u5 < t2h1u6 && t2h1u5 < t2h1d6 && t2h1u5 < t2w1rwt6 && t2h1u5 < t2w1lwt6 && t2h1u5 < t2h1uwt6 && t2h1u5 < t2h1dwt6
  && t2h1u5 < t2w1r7 && t2h1u5 < t2w1l7 && t2h1u5 < t2h1u7 && t2h1u5 < t2h1d7 && t2h1u5 < t2w1rwt7 && t2h1u5 < t2w1lwt7 && t2h1u5 < t2h1uwt7 && t2h1u5 < t2h1dwt7
  && t2h1u5 < t2w1r8 && t2h1u5 < t2w1l8 && t2h1u5 < t2h1u8 && t2h1u5 < t2h1d8 && t2h1u5 < t2w1rwt8 && t2h1u5 < t2w1lwt8 && t2h1u5 < t2h1uwt8 && t2h1u5 < t2h1dwt8
  && t2h1u5 < t2w1r9 && t2h1u5 < t2w1l9 && t2h1u5 < t2h1u9 && t2h1u5 < t2h1d9 && t2h1u5 < t2w1rwt9 && t2h1u5 < t2w1lwt9 && t2h1u5 < t2h1uwt9 && t2h1u5 < t2h1dwt9
  && t2h1u5 < t2w1r10 && t2h1u5 < t2w1l10 && t2h1u5 < t2h1u10 && t2h1u5 < t2h1d10 && t2h1u5 < t2w1rwt10 && t2h1u5 < t2w1lwt10 && t2h1u5 < t2h1uwt10 && t2h1u5 < t2h1dwt10 
  && ((louthu5!=0 && linhu5==0) || (louthu5==0 && linhu5!=0))){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1u5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1u5+z))*(z0wr5+(vz*t2h1u5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1u5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1u5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1u5+z))*(z0wl5+(vz*t2h1u5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1u5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1u5+x;
  ylimitu=sqrt(pbhu5-(vz*t2h1u5+z)/pahu5);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu5>0){
  i=209;
  }else{
  i=220;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu5!=-1 && t2h1u5 > 0 && t2h1u5 < t1
  && t2h1u5 < t2w1r && t2h1u5 < t2w1l && t2h1u5 < t2h1u && t2h1u5 < t2h1d && t2h1u5 < t2w1rwt && t2h1u5 < t2w1lwt && t2h1u5 < t2h1uwt && t2h1u5 < t2h1dwt
  && t2h1u5 < t2w1r1 && t2h1u5 < t2w1l1 && t2h1u5 < t2h1u1 && t2h1u5 < t2h1d1 && t2h1u5 < t2w1rwt1 && t2h1u5 < t2w1lwt1 && t2h1u5 < t2h1uwt1 && t2h1u5 < t2h1dwt1
  && t2h1u5 < t2w1r2 && t2h1u5 < t2w1l2 && t2h1u5 < t2h1u2 && t2h1u5 < t2h1d2 && t2h1u5 < t2w1rwt2 && t2h1u5 < t2w1lwt2 && t2h1u5 < t2h1uwt2 && t2h1u5 < t2h1dwt2
  && t2h1u5 < t2w1r3 && t2h1u5 < t2w1l3 && t2h1u5 < t2h1u3 && t2h1u5 < t2h1d3 && t2h1u5 < t2w1rwt3 && t2h1u5 < t2w1lwt3 && t2h1u5 < t2h1uwt3 && t2h1u5 < t2h1dwt3
  && t2h1u5 < t2w1r4 && t2h1u5 < t2w1l4 && t2h1u5 < t2h1u4 && t2h1u5 < t2h1d4 && t2h1u5 < t2w1rwt4 && t2h1u5 < t2w1lwt4 && t2h1u5 < t2h1uwt4 && t2h1u5 < t2h1dwt4
  && t2h1u5 < t2w1r5 && t2h1u5 < t2w1l5 && t2h1u5 < t2h1d5 && t2h1u5 < t2w1rwt5 && t2h1u5 < t2w1lwt5 && t2h1u5 < t2h1uwt5 && t2h1u5 < t2h1dwt5
  && t2h1u5 < t2w1r6 && t2h1u5 < t2w1l6 && t2h1u5 < t2h1u6 && t2h1u5 < t2h1d6 && t2h1u5 < t2w1rwt6 && t2h1u5 < t2w1lwt6 && t2h1u5 < t2h1uwt6 && t2h1u5 < t2h1dwt6
  && t2h1u5 < t2w1r7 && t2h1u5 < t2w1l7 && t2h1u5 < t2h1u7 && t2h1u5 < t2h1d7 && t2h1u5 < t2w1rwt7 && t2h1u5 < t2w1lwt7 && t2h1u5 < t2h1uwt7 && t2h1u5 < t2h1dwt7
  && t2h1u5 < t2w1r8 && t2h1u5 < t2w1l8 && t2h1u5 < t2h1u8 && t2h1u5 < t2h1d8 && t2h1u5 < t2w1rwt8 && t2h1u5 < t2w1lwt8 && t2h1u5 < t2h1uwt8 && t2h1u5 < t2h1dwt8
  && t2h1u5 < t2w1r9 && t2h1u5 < t2w1l9 && t2h1u5 < t2h1u9 && t2h1u5 < t2h1d9 && t2h1u5 < t2w1rwt9 && t2h1u5 < t2w1lwt9 && t2h1u5 < t2h1uwt9 && t2h1u5 < t2h1dwt9
  && t2h1u5 < t2w1r10 && t2h1u5 < t2w1l10 && t2h1u5 < t2h1u10 && t2h1u5 < t2h1d10 && t2h1u5 < t2w1rwt10 && t2h1u5 < t2w1lwt10 && t2h1u5 < t2h1uwt10 && t2h1u5 < t2h1dwt10
  && (louthu5 == 0 && linhu5 == 0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1u5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1u5+z))*(z0wr5+(vz*t2h1u5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1u5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1u5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1u5+z))*(z0wl5+(vz*t2h1u5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1u5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1u5+x;
  ylimitu=(h2u5-h1u5)*(vz*t2h1u5+z)/l+h1u5;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu5>0 ){
  i=210;
  }else{
  i=220;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd5!=-1 && t2h1d5 > 0 && t2h1d5 < t1 
  && t2h1d5 < t2w1r && t2h1d5 < t2w1l && t2h1d5 < t2h1u && t2h1d5 < t2h1d && t2h1d5 < t2w1rwt && t2h1d5 < t2w1lwt && t2h1d5 < t2h1uwt && t2h1d5 < t2h1dwt
  && t2h1d5 < t2w1r1 && t2h1d5 < t2w1l1 && t2h1d5 < t2h1u1 && t2h1d5 < t2h1d1 && t2h1d5 < t2w1rwt1 && t2h1d5 < t2w1lwt1 && t2h1d5 < t2h1uwt1 && t2h1d5 < t2h1dwt1
  && t2h1d5 < t2w1r2 && t2h1d5 < t2w1l2 && t2h1d5 < t2h1u2 && t2h1d5 < t2h1d2 && t2h1d5 < t2w1rwt2 && t2h1d5 < t2w1lwt2 && t2h1d5 < t2h1uwt2 && t2h1d5 < t2h1dwt2
  && t2h1d5 < t2w1r3 && t2h1d5 < t2w1l3 && t2h1d5 < t2h1u3 && t2h1d5 < t2h1d3 && t2h1d5 < t2w1rwt3 && t2h1d5 < t2w1lwt3 && t2h1d5 < t2h1uwt3 && t2h1d5 < t2h1dwt3
  && t2h1d5 < t2w1r4 && t2h1d5 < t2w1l4 && t2h1d5 < t2h1u4 && t2h1d5 < t2h1d4 && t2h1d5 < t2w1rwt4 && t2h1d5 < t2w1lwt4 && t2h1d5 < t2h1uwt4 && t2h1d5 < t2h1dwt4
  && t2h1d5 < t2w1r5 && t2h1d5 < t2w1l5 && t2h1d5 < t2h1u5 && t2h1d5 < t2w1rwt5 && t2h1d5 < t2w1lwt5 && t2h1d5 < t2h1uwt5 && t2h1d5 < t2h1dwt5
  && t2h1d5 < t2w1r6 && t2h1d5 < t2w1l6 && t2h1d5 < t2h1u6 && t2h1d5 < t2h1d6 && t2h1d5 < t2w1rwt6 && t2h1d5 < t2w1lwt6 && t2h1d5 < t2h1uwt6 && t2h1d5 < t2h1dwt6
  && t2h1d5 < t2w1r7 && t2h1d5 < t2w1l7 && t2h1d5 < t2h1u7 && t2h1d5 < t2h1d7 && t2h1d5 < t2w1rwt7 && t2h1d5 < t2w1lwt7 && t2h1d5 < t2h1uwt7 && t2h1d5 < t2h1dwt7
  && t2h1d5 < t2w1r8 && t2h1d5 < t2w1l8 && t2h1d5 < t2h1u8 && t2h1d5 < t2h1d8 && t2h1d5 < t2w1rwt8 && t2h1d5 < t2w1lwt8 && t2h1d5 < t2h1uwt8 && t2h1d5 < t2h1dwt8
  && t2h1d5 < t2w1r9 && t2h1d5 < t2w1l9 && t2h1d5 < t2h1u9 && t2h1d5 < t2h1d9 && t2h1d5 < t2w1rwt9 && t2h1d5 < t2w1lwt9 && t2h1d5 < t2h1uwt9 && t2h1d5 < t2h1dwt9
  && t2h1d5 < t2w1r10 && t2h1d5 < t2w1l10 && t2h1d5 < t2h1u10 && t2h1d5 < t2h1d10 && t2h1d5 < t2w1rwt10 && t2h1d5 < t2w1lwt10 && t2h1d5 < t2h1uwt10 && t2h1d5 < t2h1dwt10
  && (louthd5 !=0 && linhd5!=0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1d5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1d5+z))*(z0wr5+(vz*t2h1d5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1d5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1d5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1d5+z))*(z0wl5+(vz*t2h1d5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1d5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1d5+x;
  ylimitd=-bhd5*sqrt(1-((vz*t2h1d5+z)+z0hd5)*((vz*t2h1d5+z)+z0hd5)/a2hd5);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd5>0){
  i=211;
  }else{
  i=221;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd5!=-1 && t2h1d5 > 0 && t2h1d5 < t1 
  && t2h1d5 < t2w1r && t2h1d5 < t2w1l && t2h1d5 < t2h1u && t2h1d5 < t2h1d && t2h1d5 < t2w1rwt && t2h1d5 < t2w1lwt && t2h1d5 < t2h1uwt && t2h1d5 < t2h1dwt
  && t2h1d5 < t2w1r1 && t2h1d5 < t2w1l1 && t2h1d5 < t2h1u1 && t2h1d5 < t2h1d1 && t2h1d5 < t2w1rwt1 && t2h1d5 < t2w1lwt1 && t2h1d5 < t2h1uwt1 && t2h1d5 < t2h1dwt1
  && t2h1d5 < t2w1r2 && t2h1d5 < t2w1l2 && t2h1d5 < t2h1u2 && t2h1d5 < t2h1d2 && t2h1d5 < t2w1rwt2 && t2h1d5 < t2w1lwt2 && t2h1d5 < t2h1uwt2 && t2h1d5 < t2h1dwt2
  && t2h1d5 < t2w1r3 && t2h1d5 < t2w1l3 && t2h1d5 < t2h1u3 && t2h1d5 < t2h1d3 && t2h1d5 < t2w1rwt3 && t2h1d5 < t2w1lwt3 && t2h1d5 < t2h1uwt3 && t2h1d5 < t2h1dwt3
  && t2h1d5 < t2w1r4 && t2h1d5 < t2w1l4 && t2h1d5 < t2h1u4 && t2h1d5 < t2h1d4 && t2h1d5 < t2w1rwt4 && t2h1d5 < t2w1lwt4 && t2h1d5 < t2h1uwt4 && t2h1d5 < t2h1dwt4
  && t2h1d5 < t2w1r5 && t2h1d5 < t2w1l5 && t2h1d5 < t2h1u5 && t2h1d5 < t2w1rwt5 && t2h1d5 < t2w1lwt5 && t2h1d5 < t2h1uwt5 && t2h1d5 < t2h1dwt5
  && t2h1d5 < t2w1r6 && t2h1d5 < t2w1l6 && t2h1d5 < t2h1u6 && t2h1d5 < t2h1d6 && t2h1d5 < t2w1rwt6 && t2h1d5 < t2w1lwt6 && t2h1d5 < t2h1uwt6 && t2h1d5 < t2h1dwt6
  && t2h1d5 < t2w1r7 && t2h1d5 < t2w1l7 && t2h1d5 < t2h1u7 && t2h1d5 < t2h1d7 && t2h1d5 < t2w1rwt7 && t2h1d5 < t2w1lwt7 && t2h1d5 < t2h1uwt7 && t2h1d5 < t2h1dwt7
  && t2h1d5 < t2w1r8 && t2h1d5 < t2w1l8 && t2h1d5 < t2h1u8 && t2h1d5 < t2h1d8 && t2h1d5 < t2w1rwt8 && t2h1d5 < t2w1lwt8 && t2h1d5 < t2h1uwt8 && t2h1d5 < t2h1dwt8
  && t2h1d5 < t2w1r9 && t2h1d5 < t2w1l9 && t2h1d5 < t2h1u9 && t2h1d5 < t2h1d9 && t2h1d5 < t2w1rwt9 && t2h1d5 < t2w1lwt9 && t2h1d5 < t2h1uwt9 && t2h1d5 < t2h1dwt9
  && t2h1d5 < t2w1r10 && t2h1d5 < t2w1l10 && t2h1d5 < t2h1u10 && t2h1d5 < t2h1d10 && t2h1d5 < t2w1rwt10 && t2h1d5 < t2w1lwt10 && t2h1d5 < t2h1uwt10 && t2h1d5 < t2h1dwt10
  && ((louthd5 !=0 && linhd5==0) || (louthd5 ==0 && linhd5!=0))){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1d5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1d5+z))*(z0wr5+(vz*t2h1d5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1d5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1d5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1d5+z))*(z0wl5+(vz*t2h1d5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1d5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1d5+x;
  ylimitd=-sqrt(pbhd5-(vz*t2h1d5+z)/pahd5);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd5>0 ){
  i=212;
  }else{
  i=221;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd5!=-1 && t2h1d5 > 0 && t2h1d5 < t1 
  && t2h1d5 < t2w1r && t2h1d5 < t2w1l && t2h1d5 < t2h1u && t2h1d5 < t2h1d && t2h1d5 < t2w1rwt && t2h1d5 < t2w1lwt && t2h1d5 < t2h1uwt && t2h1d5 < t2h1dwt
  && t2h1d5 < t2w1r1 && t2h1d5 < t2w1l1 && t2h1d5 < t2h1u1 && t2h1d5 < t2h1d1 && t2h1d5 < t2w1rwt1 && t2h1d5 < t2w1lwt1 && t2h1d5 < t2h1uwt1 && t2h1d5 < t2h1dwt1
  && t2h1d5 < t2w1r2 && t2h1d5 < t2w1l2 && t2h1d5 < t2h1u2 && t2h1d5 < t2h1d2 && t2h1d5 < t2w1rwt2 && t2h1d5 < t2w1lwt2 && t2h1d5 < t2h1uwt2 && t2h1d5 < t2h1dwt2
  && t2h1d5 < t2w1r3 && t2h1d5 < t2w1l3 && t2h1d5 < t2h1u3 && t2h1d5 < t2h1d3 && t2h1d5 < t2w1rwt3 && t2h1d5 < t2w1lwt3 && t2h1d5 < t2h1uwt3 && t2h1d5 < t2h1dwt3
  && t2h1d5 < t2w1r4 && t2h1d5 < t2w1l4 && t2h1d5 < t2h1u4 && t2h1d5 < t2h1d4 && t2h1d5 < t2w1rwt4 && t2h1d5 < t2w1lwt4 && t2h1d5 < t2h1uwt4 && t2h1d5 < t2h1dwt4
  && t2h1d5 < t2w1r5 && t2h1d5 < t2w1l5 && t2h1d5 < t2h1u5 && t2h1d5 < t2w1rwt5 && t2h1d5 < t2w1lwt5 && t2h1d5 < t2h1uwt5 && t2h1d5 < t2h1dwt5
  && t2h1d5 < t2w1r6 && t2h1d5 < t2w1l6 && t2h1d5 < t2h1u6 && t2h1d5 < t2h1d6 && t2h1d5 < t2w1rwt6 && t2h1d5 < t2w1lwt6 && t2h1d5 < t2h1uwt6 && t2h1d5 < t2h1dwt6
  && t2h1d5 < t2w1r7 && t2h1d5 < t2w1l7 && t2h1d5 < t2h1u7 && t2h1d5 < t2h1d7 && t2h1d5 < t2w1rwt7 && t2h1d5 < t2w1lwt7 && t2h1d5 < t2h1uwt7 && t2h1d5 < t2h1dwt7
  && t2h1d5 < t2w1r8 && t2h1d5 < t2w1l8 && t2h1d5 < t2h1u8 && t2h1d5 < t2h1d8 && t2h1d5 < t2w1rwt8 && t2h1d5 < t2w1lwt8 && t2h1d5 < t2h1uwt8 && t2h1d5 < t2h1dwt8
  && t2h1d5 < t2w1r9 && t2h1d5 < t2w1l9 && t2h1d5 < t2h1u9 && t2h1d5 < t2h1d9 && t2h1d5 < t2w1rwt9 && t2h1d5 < t2w1lwt9 && t2h1d5 < t2h1uwt9 && t2h1d5 < t2h1dwt9
  && t2h1d5 < t2w1r10 && t2h1d5 < t2w1l10 && t2h1d5 < t2h1u10 && t2h1d5 < t2h1d10 && t2h1d5 < t2w1rwt10 && t2h1d5 < t2w1lwt10 && t2h1d5 < t2h1uwt10 && t2h1d5 < t2h1dwt10
  && (louthd5 == 0 && linhd5 == 0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1d5+z)-w1r5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwr5*sqrt(1-((z0wr5+(vz*t2h1d5+z))*(z0wr5+(vz*t2h1d5+z)))/a2wr5);
    }else{
    xlimitr=-sqrt(((vz*t2h1d5+z)-pbwr5)/-pawr5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1d5+z)+w1l5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwl5*sqrt(1-((z0wl5+(vz*t2h1d5+z))*(z0wl5+(vz*t2h1d5+z)))/a2wl5);
      }else{
      xlimitl=sqrt(((vz*t2h1d5+z)-pbwl5)/-pawl5);
      }
   }
  xtest=vx*t2h1d5+x;
  ylimitd=(-h2d5+h1d5)*(vz*t2h1d5+z)/l-h1d5;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd5>0 ){
  i=213;
  }else{
  i=221;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr5==-1 && t2w1r5 > 0 && t2w1r5 < t1 
     && t2w1r5 < t2w1r && t2w1r5 < t2w1l && t2w1r5 < t2h1u && t2w1r5 < t2h1d && t2w1r5 < t2w1rwt && t2w1r5 < t2w1lwt && t2w1r5 < t2h1uwt && t2w1r5 < t2h1dwt
     && t2w1r5 < t2w1r1 && t2w1r5 < t2w1l1 && t2w1r5 < t2h1u1 && t2w1r5 < t2h1d1 && t2w1r5 < t2w1rwt1 && t2w1r5 < t2w1lwt1 && t2w1r5 < t2h1uwt1 && t2w1r5 < t2h1dwt1
     && t2w1r5 < t2w1r2 && t2w1r5 < t2w1l2 && t2w1r5 < t2h1u2 && t2w1r5 < t2h1d2 && t2w1r5 < t2w1rwt2 && t2w1r5 < t2w1lwt2 && t2w1r5 < t2h1uwt2 && t2w1r5 < t2h1dwt2 
     && t2w1r5 < t2w1r3 && t2w1r5 < t2w1l3 && t2w1r5 < t2h1u3 && t2w1r5 < t2h1d3 && t2w1r5 < t2w1rwt3 && t2w1r5 < t2w1lwt3 && t2w1r5 < t2h1uwt3 && t2w1r5 < t2h1dwt3
     && t2w1r5 < t2w1r4 && t2w1r5 < t2w1l4 && t2w1r5 < t2h1u4 && t2w1r5 < t2h1d4 && t2w1r5 < t2w1rwt4 && t2w1r5 < t2w1lwt4 && t2w1r5 < t2h1uwt4 && t2w1r5 < t2h1dwt4
     && t2w1r5 < t2w1l5 && t2w1r5 < t2h1u5 && t2w1r5 < t2h1d5 && t2w1r5 < t2w1rwt5 && t2w1r5 < t2w1lwt5 && t2w1r5 < t2h1uwt5 && t2w1r5 < t2h1dwt5
     && t2w1r5 < t2w1r6 && t2w1r5 < t2w1l6 && t2w1r5 < t2h1u6 && t2w1r5 < t2h1d6 && t2w1r5 < t2w1rwt6 && t2w1r5 < t2w1lwt6 && t2w1r5 < t2h1uwt6 && t2w1r5 < t2h1dwt6
     && t2w1r5 < t2w1r7 && t2w1r5 < t2w1l7 && t2w1r5 < t2h1u7 && t2w1r5 < t2h1d7 && t2w1r5 < t2w1rwt7 && t2w1r5 < t2w1lwt7 && t2w1r5 < t2h1uwt7 && t2w1r5 < t2h1dwt7
     && t2w1r5 < t2w1r8 && t2w1r5 < t2w1l8 && t2w1r5 < t2h1u8 && t2w1r5 < t2h1d8 && t2w1r5 < t2w1rwt8 && t2w1r5 < t2w1lwt8 && t2w1r5 < t2h1uwt8 && t2w1r5 < t2h1dwt8
     && t2w1r5 < t2w1r9 && t2w1r5 < t2w1l9 && t2w1r5 < t2h1u9 && t2w1r5 < t2h1d9 && t2w1r5 < t2w1rwt9 && t2w1r5 < t2w1lwt9 && t2w1r5 < t2h1uwt9 && t2w1r5 < t2h1dwt9
     && t2w1r5 < t2w1r10 && t2w1r5 < t2w1l10 && t2w1r5 < t2h1u10 && t2w1r5 < t2h1d10 && t2w1r5 < t2w1rwt10 && t2w1r5 < t2w1lwt10 && t2w1r5 < t2h1uwt10 && t2w1r5 < t2h1dwt10
     && ((linwr5!=0) && (loutwr5!=0) )) {
  i=214;
  }

  if (mxr5==-1 && t2w1r5 > 0 && t2w1r5 < t1 
     && t2w1r5 < t2w1r && t2w1r5 < t2w1l && t2w1r5 < t2h1u && t2w1r5 < t2h1d && t2w1r5 < t2w1rwt && t2w1r5 < t2w1lwt && t2w1r5 < t2h1uwt && t2w1r5 < t2h1dwt
     && t2w1r5 < t2w1r1 && t2w1r5 < t2w1l1 && t2w1r5 < t2h1u1 && t2w1r5 < t2h1d1 && t2w1r5 < t2w1rwt1 && t2w1r5 < t2w1lwt1 && t2w1r5 < t2h1uwt1 && t2w1r5 < t2h1dwt1
     && t2w1r5 < t2w1r2 && t2w1r5 < t2w1l2 && t2w1r5 < t2h1u2 && t2w1r5 < t2h1d2 && t2w1r5 < t2w1rwt2 && t2w1r5 < t2w1lwt2 && t2w1r5 < t2h1uwt2 && t2w1r5 < t2h1dwt2 
     && t2w1r5 < t2w1r3 && t2w1r5 < t2w1l3 && t2w1r5 < t2h1u3 && t2w1r5 < t2h1d3 && t2w1r5 < t2w1rwt3 && t2w1r5 < t2w1lwt3 && t2w1r5 < t2h1uwt3 && t2w1r5 < t2h1dwt3
     && t2w1r5 < t2w1r4 && t2w1r5 < t2w1l4 && t2w1r5 < t2h1u4 && t2w1r5 < t2h1d4 && t2w1r5 < t2w1rwt4 && t2w1r5 < t2w1lwt4 && t2w1r5 < t2h1uwt4 && t2w1r5 < t2h1dwt4
     && t2w1r5 < t2w1l5 && t2w1r5 < t2h1u5 && t2w1r5 < t2h1d5 && t2w1r5 < t2w1rwt5 && t2w1r5 < t2w1lwt5 && t2w1r5 < t2h1uwt5 && t2w1r5 < t2h1dwt5
     && t2w1r5 < t2w1r6 && t2w1r5 < t2w1l6 && t2w1r5 < t2h1u6 && t2w1r5 < t2h1d6 && t2w1r5 < t2w1rwt6 && t2w1r5 < t2w1lwt6 && t2w1r5 < t2h1uwt6 && t2w1r5 < t2h1dwt6
     && t2w1r5 < t2w1r7 && t2w1r5 < t2w1l7 && t2w1r5 < t2h1u7 && t2w1r5 < t2h1d7 && t2w1r5 < t2w1rwt7 && t2w1r5 < t2w1lwt7 && t2w1r5 < t2h1uwt7 && t2w1r5 < t2h1dwt7
     && t2w1r5 < t2w1r8 && t2w1r5 < t2w1l8 && t2w1r5 < t2h1u8 && t2w1r5 < t2h1d8 && t2w1r5 < t2w1rwt8 && t2w1r5 < t2w1lwt8 && t2w1r5 < t2h1uwt8 && t2w1r5 < t2h1dwt8
     && t2w1r5 < t2w1r9 && t2w1r5 < t2w1l9 && t2w1r5 < t2h1u9 && t2w1r5 < t2h1d9 && t2w1r5 < t2w1rwt9 && t2w1r5 < t2w1lwt9 && t2w1r5 < t2h1uwt9 && t2w1r5 < t2h1dwt9
     && t2w1r5 < t2w1r10 && t2w1r5 < t2w1l10 && t2w1r5 < t2h1u10 && t2w1r5 < t2h1d10 && t2w1r5 < t2w1rwt10 && t2w1r5 < t2w1lwt10 && t2w1r5 < t2h1uwt10 && t2w1r5 < t2h1dwt10
     && ((loutwr5!=0 && linwr5==0) || (loutwr5==0 && linwr5!=0))){
  i=214;
  }

  if (mxr5==-1 && t2w1r5 > 0 && t2w1r5 < t1 
     && t2w1r5 < t2w1r && t2w1r5 < t2w1l && t2w1r5 < t2h1u && t2w1r5 < t2h1d && t2w1r5 < t2w1rwt && t2w1r5 < t2w1lwt && t2w1r5 < t2h1uwt && t2w1r5 < t2h1dwt
     && t2w1r5 < t2w1r1 && t2w1r5 < t2w1l1 && t2w1r5 < t2h1u1 && t2w1r5 < t2h1d1 && t2w1r5 < t2w1rwt1 && t2w1r5 < t2w1lwt1 && t2w1r5 < t2h1uwt1 && t2w1r5 < t2h1dwt1
     && t2w1r5 < t2w1r2 && t2w1r5 < t2w1l2 && t2w1r5 < t2h1u2 && t2w1r5 < t2h1d2 && t2w1r5 < t2w1rwt2 && t2w1r5 < t2w1lwt2 && t2w1r5 < t2h1uwt2 && t2w1r5 < t2h1dwt2 
     && t2w1r5 < t2w1r3 && t2w1r5 < t2w1l3 && t2w1r5 < t2h1u3 && t2w1r5 < t2h1d3 && t2w1r5 < t2w1rwt3 && t2w1r5 < t2w1lwt3 && t2w1r5 < t2h1uwt3 && t2w1r5 < t2h1dwt3
     && t2w1r5 < t2w1r4 && t2w1r5 < t2w1l4 && t2w1r5 < t2h1u4 && t2w1r5 < t2h1d4 && t2w1r5 < t2w1rwt4 && t2w1r5 < t2w1lwt4 && t2w1r5 < t2h1uwt4 && t2w1r5 < t2h1dwt4
     && t2w1r5 < t2w1l5 && t2w1r5 < t2h1u5 && t2w1r5 < t2h1d5 && t2w1r5 < t2w1rwt5 && t2w1r5 < t2w1lwt5 && t2w1r5 < t2h1uwt5 && t2w1r5 < t2h1dwt5
     && t2w1r5 < t2w1r6 && t2w1r5 < t2w1l6 && t2w1r5 < t2h1u6 && t2w1r5 < t2h1d6 && t2w1r5 < t2w1rwt6 && t2w1r5 < t2w1lwt6 && t2w1r5 < t2h1uwt6 && t2w1r5 < t2h1dwt6
     && t2w1r5 < t2w1r7 && t2w1r5 < t2w1l7 && t2w1r5 < t2h1u7 && t2w1r5 < t2h1d7 && t2w1r5 < t2w1rwt7 && t2w1r5 < t2w1lwt7 && t2w1r5 < t2h1uwt7 && t2w1r5 < t2h1dwt7
     && t2w1r5 < t2w1r8 && t2w1r5 < t2w1l8 && t2w1r5 < t2h1u8 && t2w1r5 < t2h1d8 && t2w1r5 < t2w1rwt8 && t2w1r5 < t2w1lwt8 && t2w1r5 < t2h1uwt8 && t2w1r5 < t2h1dwt8
     && t2w1r5 < t2w1r9 && t2w1r5 < t2w1l9 && t2w1r5 < t2h1u9 && t2w1r5 < t2h1d9 && t2w1r5 < t2w1rwt9 && t2w1r5 < t2w1lwt9 && t2w1r5 < t2h1uwt9 && t2w1r5 < t2h1dwt9
     && t2w1r5 < t2w1r10 && t2w1r5 < t2w1l10 && t2w1r5 < t2h1u10 && t2w1r5 < t2h1d10 && t2w1r5 < t2w1rwt10 && t2w1r5 < t2w1lwt10 && t2w1r5 < t2h1uwt10 && t2w1r5 < t2h1dwt10
     && (loutwr5==0 && linwr5==0)){
  i=214;
  }

  if (mxl5==-1 && t2w1l5 > 0 && t2w1l5 < t1 
      && t2w1l5 < t2w1r && t2w1l5 < t2w1l && t2w1l5 < t2h1u && t2w1l5 < t2h1d && t2w1l5 < t2w1rwt && t2w1l5 < t2w1lwt && t2w1l5 < t2h1uwt && t2w1l5 < t2h1dwt
      && t2w1l5 < t2w1r1 && t2w1l5 < t2w1l1 && t2w1l5 < t2h1u1 && t2w1l5 < t2h1d1 && t2w1l5 < t2w1rwt1 && t2w1l5 < t2w1lwt1 && t2w1l5 < t2h1uwt1 && t2w1l5 < t2h1dwt1
      && t2w1l5 < t2w1r2 && t2w1l5 < t2w1l2 && t2w1l5 < t2h1u2 && t2w1l5 < t2h1d2 && t2w1l5 < t2w1rwt2 && t2w1l5 < t2w1lwt2 && t2w1l5 < t2h1uwt2 && t2w1l5 < t2h1dwt2
      && t2w1l5 < t2w1r3 && t2w1l5 < t2w1l3 && t2w1l5 < t2h1u3 && t2w1l5 < t2h1d3 && t2w1l5 < t2w1rwt3 && t2w1l5 < t2w1lwt3 && t2w1l5 < t2h1uwt3 && t2w1l5 < t2h1dwt3
      && t2w1l5 < t2w1r4 && t2w1l5 < t2w1l4 && t2w1l5 < t2h1u4 && t2w1l5 < t2h1d4 && t2w1l5 < t2w1rwt4 && t2w1l5 < t2w1lwt4 && t2w1l5 < t2h1uwt4 && t2w1l5 < t2h1dwt4
      && t2w1l5 < t2w1r5 && t2w1l5 < t2h1u5 && t2w1l5 < t2h1d5 && t2w1l5 < t2w1rwt5 && t2w1l5 < t2w1lwt5 && t2w1l5 < t2h1uwt5 && t2w1l5 < t2h1dwt5
      && t2w1l5 < t2w1r6 && t2w1l5 < t2w1l6 && t2w1l5 < t2h1u6 && t2w1l5 < t2h1d6 && t2w1l5 < t2w1rwt6 && t2w1l5 < t2w1lwt6 && t2w1l5 < t2h1uwt6 && t2w1l5 < t2h1dwt6
      && t2w1l5 < t2w1r7 && t2w1l5 < t2w1l7 && t2w1l5 < t2h1u7 && t2w1l5 < t2h1d7 && t2w1l5 < t2w1rwt7 && t2w1l5 < t2w1lwt7 && t2w1l5 < t2h1uwt7 && t2w1l5 < t2h1dwt7
      && t2w1l5 < t2w1r8 && t2w1l5 < t2w1l8 && t2w1l5 < t2h1u8 && t2w1l5 < t2h1d8 && t2w1l5 < t2w1rwt8 && t2w1l5 < t2w1lwt8 && t2w1l5 < t2h1uwt8 && t2w1l5 < t2h1dwt8
      && t2w1l5 < t2w1r9 && t2w1l5 < t2w1l9 && t2w1l5 < t2h1u9 && t2w1l5 < t2h1d9 && t2w1l5 < t2w1rwt9 && t2w1l5 < t2w1lwt9 && t2w1l5 < t2h1uwt9 && t2w1l5 < t2h1dwt9
      && t2w1l5 < t2w1r10 && t2w1l5 < t2w1l10 && t2w1l5 < t2h1u10 && t2w1l5 < t2h1d10 && t2w1l5 < t2w1rwt10 && t2w1l5 < t2w1lwt10 && t2w1l5 < t2h1uwt10 && t2w1l5 < t2h1dwt10
      && ((linwl5!=0) && (loutwl5!=0) )){
  i=215;
  }

  if (mxl5==-1 && t2w1l5 > 0 && t2w1l5 < t1 
      && t2w1l5 < t2w1r && t2w1l5 < t2w1l && t2w1l5 < t2h1u && t2w1l5 < t2h1d && t2w1l5 < t2w1rwt && t2w1l5 < t2w1lwt && t2w1l5 < t2h1uwt && t2w1l5 < t2h1dwt
      && t2w1l5 < t2w1r1 && t2w1l5 < t2w1l1 && t2w1l5 < t2h1u1 && t2w1l5 < t2h1d1 && t2w1l5 < t2w1rwt1 && t2w1l5 < t2w1lwt1 && t2w1l5 < t2h1uwt1 && t2w1l5 < t2h1dwt1
      && t2w1l5 < t2w1r2 && t2w1l5 < t2w1l2 && t2w1l5 < t2h1u2 && t2w1l5 < t2h1d2 && t2w1l5 < t2w1rwt2 && t2w1l5 < t2w1lwt2 && t2w1l5 < t2h1uwt2 && t2w1l5 < t2h1dwt2
      && t2w1l5 < t2w1r3 && t2w1l5 < t2w1l3 && t2w1l5 < t2h1u3 && t2w1l5 < t2h1d3 && t2w1l5 < t2w1rwt3 && t2w1l5 < t2w1lwt3 && t2w1l5 < t2h1uwt3 && t2w1l5 < t2h1dwt3
      && t2w1l5 < t2w1r4 && t2w1l5 < t2w1l4 && t2w1l5 < t2h1u4 && t2w1l5 < t2h1d4 && t2w1l5 < t2w1rwt4 && t2w1l5 < t2w1lwt4 && t2w1l5 < t2h1uwt4 && t2w1l5 < t2h1dwt4
      && t2w1l5 < t2w1r5 && t2w1l5 < t2h1u5 && t2w1l5 < t2h1d5 && t2w1l5 < t2w1rwt5 && t2w1l5 < t2w1lwt5 && t2w1l5 < t2h1uwt5 && t2w1l5 < t2h1dwt5
      && t2w1l5 < t2w1r6 && t2w1l5 < t2w1l6 && t2w1l5 < t2h1u6 && t2w1l5 < t2h1d6 && t2w1l5 < t2w1rwt6 && t2w1l5 < t2w1lwt6 && t2w1l5 < t2h1uwt6 && t2w1l5 < t2h1dwt6
      && t2w1l5 < t2w1r7 && t2w1l5 < t2w1l7 && t2w1l5 < t2h1u7 && t2w1l5 < t2h1d7 && t2w1l5 < t2w1rwt7 && t2w1l5 < t2w1lwt7 && t2w1l5 < t2h1uwt7 && t2w1l5 < t2h1dwt7
      && t2w1l5 < t2w1r8 && t2w1l5 < t2w1l8 && t2w1l5 < t2h1u8 && t2w1l5 < t2h1d8 && t2w1l5 < t2w1rwt8 && t2w1l5 < t2w1lwt8 && t2w1l5 < t2h1uwt8 && t2w1l5 < t2h1dwt8
      && t2w1l5 < t2w1r9 && t2w1l5 < t2w1l9 && t2w1l5 < t2h1u9 && t2w1l5 < t2h1d9 && t2w1l5 < t2w1rwt9 && t2w1l5 < t2w1lwt9 && t2w1l5 < t2h1uwt9 && t2w1l5 < t2h1dwt9
      && t2w1l5 < t2w1r10 && t2w1l5 < t2w1l10 && t2w1l5 < t2h1u10 && t2w1l5 < t2h1d10 && t2w1l5 < t2w1rwt10 && t2w1l5 < t2w1lwt10 && t2w1l5 < t2h1uwt10 && t2w1l5 < t2h1dwt10
      &&  ((loutwl5!=0 && linwl5==0) || (loutwl5==0 && linwl5!=0))){
  i=215;
  }

  if (mxl5==-1 && t2w1l5 > 0 && t2w1l5 < t1 
      && t2w1l5 < t2w1r && t2w1l5 < t2w1l && t2w1l5 < t2h1u && t2w1l5 < t2h1d && t2w1l5 < t2w1rwt && t2w1l5 < t2w1lwt && t2w1l5 < t2h1uwt && t2w1l5 < t2h1dwt
      && t2w1l5 < t2w1r1 && t2w1l5 < t2w1l1 && t2w1l5 < t2h1u1 && t2w1l5 < t2h1d1 && t2w1l5 < t2w1rwt1 && t2w1l5 < t2w1lwt1 && t2w1l5 < t2h1uwt1 && t2w1l5 < t2h1dwt1
      && t2w1l5 < t2w1r2 && t2w1l5 < t2w1l2 && t2w1l5 < t2h1u2 && t2w1l5 < t2h1d2 && t2w1l5 < t2w1rwt2 && t2w1l5 < t2w1lwt2 && t2w1l5 < t2h1uwt2 && t2w1l5 < t2h1dwt2
      && t2w1l5 < t2w1r3 && t2w1l5 < t2w1l3 && t2w1l5 < t2h1u3 && t2w1l5 < t2h1d3 && t2w1l5 < t2w1rwt3 && t2w1l5 < t2w1lwt3 && t2w1l5 < t2h1uwt3 && t2w1l5 < t2h1dwt3
      && t2w1l5 < t2w1r4 && t2w1l5 < t2w1l4 && t2w1l5 < t2h1u4 && t2w1l5 < t2h1d4 && t2w1l5 < t2w1rwt4 && t2w1l5 < t2w1lwt4 && t2w1l5 < t2h1uwt4 && t2w1l5 < t2h1dwt4
      && t2w1l5 < t2w1r5 && t2w1l5 < t2h1u5 && t2w1l5 < t2h1d5 && t2w1l5 < t2w1rwt5 && t2w1l5 < t2w1lwt5 && t2w1l5 < t2h1uwt5 && t2w1l5 < t2h1dwt5
      && t2w1l5 < t2w1r6 && t2w1l5 < t2w1l6 && t2w1l5 < t2h1u6 && t2w1l5 < t2h1d6 && t2w1l5 < t2w1rwt6 && t2w1l5 < t2w1lwt6 && t2w1l5 < t2h1uwt6 && t2w1l5 < t2h1dwt6
      && t2w1l5 < t2w1r7 && t2w1l5 < t2w1l7 && t2w1l5 < t2h1u7 && t2w1l5 < t2h1d7 && t2w1l5 < t2w1rwt7 && t2w1l5 < t2w1lwt7 && t2w1l5 < t2h1uwt7 && t2w1l5 < t2h1dwt7
      && t2w1l5 < t2w1r8 && t2w1l5 < t2w1l8 && t2w1l5 < t2h1u8 && t2w1l5 < t2h1d8 && t2w1l5 < t2w1rwt8 && t2w1l5 < t2w1lwt8 && t2w1l5 < t2h1uwt8 && t2w1l5 < t2h1dwt8
      && t2w1l5 < t2w1r9 && t2w1l5 < t2w1l9 && t2w1l5 < t2h1u9 && t2w1l5 < t2h1d9 && t2w1l5 < t2w1rwt9 && t2w1l5 < t2w1lwt9 && t2w1l5 < t2h1uwt9 && t2w1l5 < t2h1dwt9
      && t2w1l5 < t2w1r10 && t2w1l5 < t2w1l10 && t2w1l5 < t2h1u10 && t2w1l5 < t2h1d10 && t2w1l5 < t2w1rwt10 && t2w1l5 < t2w1lwt10 && t2w1l5 < t2h1uwt10 && t2w1l5 < t2h1dwt10
      && (loutwl5==0 && linwl5==0)){
  i=215;
  }

  if (myu5==-1 && t2h1u5 > 0 && t2h1u5 < t1 
  && t2h1u5 < t2w1r && t2h1u5 < t2w1l && t2h1u5 < t2h1u && t2h1u5 < t2h1d && t2h1u5 < t2w1rwt && t2h1u5 < t2w1lwt && t2h1u5 < t2h1uwt && t2h1u5 < t2h1dwt
  && t2h1u5 < t2w1r1 && t2h1u5 < t2w1l1 && t2h1u5 < t2h1u1 && t2h1u5 < t2h1d1 && t2h1u5 < t2w1rwt1 && t2h1u5 < t2w1lwt1 && t2h1u5 < t2h1uwt1 && t2h1u5 < t2h1dwt1
  && t2h1u5 < t2w1r2 && t2h1u5 < t2w1l2 && t2h1u5 < t2h1u2 && t2h1u5 < t2h1d2 && t2h1u5 < t2w1rwt2 && t2h1u5 < t2w1lwt2 && t2h1u5 < t2h1uwt2 && t2h1u5 < t2h1dwt2
  && t2h1u5 < t2w1r3 && t2h1u5 < t2w1l3 && t2h1u5 < t2h1u3 && t2h1u5 < t2h1d3 && t2h1u5 < t2w1rwt3 && t2h1u5 < t2w1lwt3 && t2h1u5 < t2h1uwt3 && t2h1u5 < t2h1dwt3
  && t2h1u5 < t2w1r4 && t2h1u5 < t2w1l4 && t2h1u5 < t2h1u4 && t2h1u5 < t2h1d4 && t2h1u5 < t2w1rwt4 && t2h1u5 < t2w1lwt4 && t2h1u5 < t2h1uwt4 && t2h1u5 < t2h1dwt4
  && t2h1u5 < t2w1r5 && t2h1u5 < t2w1l5 && t2h1u5 < t2h1d5 && t2h1u5 < t2w1rwt5 && t2h1u5 < t2w1lwt5 && t2h1u5 < t2h1uwt5 && t2h1u5 < t2h1dwt5
  && t2h1u5 < t2w1r6 && t2h1u5 < t2w1l6 && t2h1u5 < t2h1u6 && t2h1u5 < t2h1d6 && t2h1u5 < t2w1rwt6 && t2h1u5 < t2w1lwt6 && t2h1u5 < t2h1uwt6 && t2h1u5 < t2h1dwt6
  && t2h1u5 < t2w1r7 && t2h1u5 < t2w1l7 && t2h1u5 < t2h1u7 && t2h1u5 < t2h1d7 && t2h1u5 < t2w1rwt7 && t2h1u5 < t2w1lwt7 && t2h1u5 < t2h1uwt7 && t2h1u5 < t2h1dwt7
  && t2h1u5 < t2w1r8 && t2h1u5 < t2w1l8 && t2h1u5 < t2h1u8 && t2h1u5 < t2h1d8 && t2h1u5 < t2w1rwt8 && t2h1u5 < t2w1lwt8 && t2h1u5 < t2h1uwt8 && t2h1u5 < t2h1dwt8
  && t2h1u5 < t2w1r9 && t2h1u5 < t2w1l9 && t2h1u5 < t2h1u9 && t2h1u5 < t2h1d9 && t2h1u5 < t2w1rwt9 && t2h1u5 < t2w1lwt9 && t2h1u5 < t2h1uwt9 && t2h1u5 < t2h1dwt9
  && t2h1u5 < t2w1r10 && t2h1u5 < t2w1l10 && t2h1u5 < t2h1u10 && t2h1u5 < t2h1d10 && t2h1u5 < t2w1rwt10 && t2h1u5 < t2w1lwt10 && t2h1u5 < t2h1uwt10 && t2h1u5 < t2h1dwt10
  && (louthu5 !=0 && linhu5!=0)){
  i=216;
  }

  if (myu5==-1 && t2h1u5 > 0 && t2h1u5 < t1 
  && t2h1u5 < t2w1r && t2h1u5 < t2w1l && t2h1u5 < t2h1u && t2h1u5 < t2h1d && t2h1u5 < t2w1rwt && t2h1u5 < t2w1lwt && t2h1u5 < t2h1uwt && t2h1u5 < t2h1dwt
  && t2h1u5 < t2w1r1 && t2h1u5 < t2w1l1 && t2h1u5 < t2h1u1 && t2h1u5 < t2h1d1 && t2h1u5 < t2w1rwt1 && t2h1u5 < t2w1lwt1 && t2h1u5 < t2h1uwt1 && t2h1u5 < t2h1dwt1
  && t2h1u5 < t2w1r2 && t2h1u5 < t2w1l2 && t2h1u5 < t2h1u2 && t2h1u5 < t2h1d2 && t2h1u5 < t2w1rwt2 && t2h1u5 < t2w1lwt2 && t2h1u5 < t2h1uwt2 && t2h1u5 < t2h1dwt2
  && t2h1u5 < t2w1r3 && t2h1u5 < t2w1l3 && t2h1u5 < t2h1u3 && t2h1u5 < t2h1d3 && t2h1u5 < t2w1rwt3 && t2h1u5 < t2w1lwt3 && t2h1u5 < t2h1uwt3 && t2h1u5 < t2h1dwt3
  && t2h1u5 < t2w1r4 && t2h1u5 < t2w1l4 && t2h1u5 < t2h1u4 && t2h1u5 < t2h1d4 && t2h1u5 < t2w1rwt4 && t2h1u5 < t2w1lwt4 && t2h1u5 < t2h1uwt4 && t2h1u5 < t2h1dwt4
  && t2h1u5 < t2w1r5 && t2h1u5 < t2w1l5 && t2h1u5 < t2h1d5 && t2h1u5 < t2w1rwt5 && t2h1u5 < t2w1lwt5 && t2h1u5 < t2h1uwt5 && t2h1u5 < t2h1dwt5
  && t2h1u5 < t2w1r6 && t2h1u5 < t2w1l6 && t2h1u5 < t2h1u6 && t2h1u5 < t2h1d6 && t2h1u5 < t2w1rwt6 && t2h1u5 < t2w1lwt6 && t2h1u5 < t2h1uwt6 && t2h1u5 < t2h1dwt6
  && t2h1u5 < t2w1r7 && t2h1u5 < t2w1l7 && t2h1u5 < t2h1u7 && t2h1u5 < t2h1d7 && t2h1u5 < t2w1rwt7 && t2h1u5 < t2w1lwt7 && t2h1u5 < t2h1uwt7 && t2h1u5 < t2h1dwt7
  && t2h1u5 < t2w1r8 && t2h1u5 < t2w1l8 && t2h1u5 < t2h1u8 && t2h1u5 < t2h1d8 && t2h1u5 < t2w1rwt8 && t2h1u5 < t2w1lwt8 && t2h1u5 < t2h1uwt8 && t2h1u5 < t2h1dwt8
  && t2h1u5 < t2w1r9 && t2h1u5 < t2w1l9 && t2h1u5 < t2h1u9 && t2h1u5 < t2h1d9 && t2h1u5 < t2w1rwt9 && t2h1u5 < t2w1lwt9 && t2h1u5 < t2h1uwt9 && t2h1u5 < t2h1dwt9
  && t2h1u5 < t2w1r10 && t2h1u5 < t2w1l10 && t2h1u5 < t2h1u10 && t2h1u5 < t2h1d10 && t2h1u5 < t2w1rwt10 && t2h1u5 < t2w1lwt10 && t2h1u5 < t2h1uwt10 && t2h1u5 < t2h1dwt10
  && ((louthu5!=0 && linhu5==0) || (louthu5==0 && linhu5!=0))){
  i=216;
  }

  if (myu5==-1 && t2h1u5 > 0 && t2h1u5 < t1 
  && t2h1u5 < t2w1r && t2h1u5 < t2w1l && t2h1u5 < t2h1u && t2h1u5 < t2h1d && t2h1u5 < t2w1rwt && t2h1u5 < t2w1lwt && t2h1u5 < t2h1uwt && t2h1u5 < t2h1dwt
  && t2h1u5 < t2w1r1 && t2h1u5 < t2w1l1 && t2h1u5 < t2h1u1 && t2h1u5 < t2h1d1 && t2h1u5 < t2w1rwt1 && t2h1u5 < t2w1lwt1 && t2h1u5 < t2h1uwt1 && t2h1u5 < t2h1dwt1
  && t2h1u5 < t2w1r2 && t2h1u5 < t2w1l2 && t2h1u5 < t2h1u2 && t2h1u5 < t2h1d2 && t2h1u5 < t2w1rwt2 && t2h1u5 < t2w1lwt2 && t2h1u5 < t2h1uwt2 && t2h1u5 < t2h1dwt2
  && t2h1u5 < t2w1r3 && t2h1u5 < t2w1l3 && t2h1u5 < t2h1u3 && t2h1u5 < t2h1d3 && t2h1u5 < t2w1rwt3 && t2h1u5 < t2w1lwt3 && t2h1u5 < t2h1uwt3 && t2h1u5 < t2h1dwt3
  && t2h1u5 < t2w1r4 && t2h1u5 < t2w1l4 && t2h1u5 < t2h1u4 && t2h1u5 < t2h1d4 && t2h1u5 < t2w1rwt4 && t2h1u5 < t2w1lwt4 && t2h1u5 < t2h1uwt4 && t2h1u5 < t2h1dwt4
  && t2h1u5 < t2w1r5 && t2h1u5 < t2w1l5 && t2h1u5 < t2h1d5 && t2h1u5 < t2w1rwt5 && t2h1u5 < t2w1lwt5 && t2h1u5 < t2h1uwt5 && t2h1u5 < t2h1dwt5
  && t2h1u5 < t2w1r6 && t2h1u5 < t2w1l6 && t2h1u5 < t2h1u6 && t2h1u5 < t2h1d6 && t2h1u5 < t2w1rwt6 && t2h1u5 < t2w1lwt6 && t2h1u5 < t2h1uwt6 && t2h1u5 < t2h1dwt6
  && t2h1u5 < t2w1r7 && t2h1u5 < t2w1l7 && t2h1u5 < t2h1u7 && t2h1u5 < t2h1d7 && t2h1u5 < t2w1rwt7 && t2h1u5 < t2w1lwt7 && t2h1u5 < t2h1uwt7 && t2h1u5 < t2h1dwt7
  && t2h1u5 < t2w1r8 && t2h1u5 < t2w1l8 && t2h1u5 < t2h1u8 && t2h1u5 < t2h1d8 && t2h1u5 < t2w1rwt8 && t2h1u5 < t2w1lwt8 && t2h1u5 < t2h1uwt8 && t2h1u5 < t2h1dwt8
  && t2h1u5 < t2w1r9 && t2h1u5 < t2w1l9 && t2h1u5 < t2h1u9 && t2h1u5 < t2h1d9 && t2h1u5 < t2w1rwt9 && t2h1u5 < t2w1lwt9 && t2h1u5 < t2h1uwt9 && t2h1u5 < t2h1dwt9
  && t2h1u5 < t2w1r10 && t2h1u5 < t2w1l10 && t2h1u5 < t2h1u10 && t2h1u5 < t2h1d10 && t2h1u5 < t2w1rwt10 && t2h1u5 < t2w1lwt10 && t2h1u5 < t2h1uwt10 && t2h1u5 < t2h1dwt10
  && (louthu5 == 0 && linhu5 == 0)){
  i=216;
  }

  if (myd5==-1 && t2h1d5 > 0 && t2h1d5 < t1 
  && t2h1d5 < t2w1r && t2h1d5 < t2w1l && t2h1d5 < t2h1u && t2h1d5 < t2h1d && t2h1d5 < t2w1rwt && t2h1d5 < t2w1lwt && t2h1d5 < t2h1uwt && t2h1d5 < t2h1dwt
  && t2h1d5 < t2w1r1 && t2h1d5 < t2w1l1 && t2h1d5 < t2h1u1 && t2h1d5 < t2h1d1 && t2h1d5 < t2w1rwt1 && t2h1d5 < t2w1lwt1 && t2h1d5 < t2h1uwt1 && t2h1d5 < t2h1dwt1
  && t2h1d5 < t2w1r2 && t2h1d5 < t2w1l2 && t2h1d5 < t2h1u2 && t2h1d5 < t2h1d2 && t2h1d5 < t2w1rwt2 && t2h1d5 < t2w1lwt2 && t2h1d5 < t2h1uwt2 && t2h1d5 < t2h1dwt2
  && t2h1d5 < t2w1r3 && t2h1d5 < t2w1l3 && t2h1d5 < t2h1u3 && t2h1d5 < t2h1d3 && t2h1d5 < t2w1rwt3 && t2h1d5 < t2w1lwt3 && t2h1d5 < t2h1uwt3 && t2h1d5 < t2h1dwt3
  && t2h1d5 < t2w1r4 && t2h1d5 < t2w1l4 && t2h1d5 < t2h1u4 && t2h1d5 < t2h1d4 && t2h1d5 < t2w1rwt4 && t2h1d5 < t2w1lwt4 && t2h1d5 < t2h1uwt4 && t2h1d5 < t2h1dwt4
  && t2h1d5 < t2w1r5 && t2h1d5 < t2w1l5 && t2h1d5 < t2h1u5 && t2h1d5 < t2w1rwt5 && t2h1d5 < t2w1lwt5 && t2h1d5 < t2h1uwt5 && t2h1d5 < t2h1dwt5
  && t2h1d5 < t2w1r6 && t2h1d5 < t2w1l6 && t2h1d5 < t2h1u6 && t2h1d5 < t2h1d6 && t2h1d5 < t2w1rwt6 && t2h1d5 < t2w1lwt6 && t2h1d5 < t2h1uwt6 && t2h1d5 < t2h1dwt6
  && t2h1d5 < t2w1r7 && t2h1d5 < t2w1l7 && t2h1d5 < t2h1u7 && t2h1d5 < t2h1d7 && t2h1d5 < t2w1rwt7 && t2h1d5 < t2w1lwt7 && t2h1d5 < t2h1uwt7 && t2h1d5 < t2h1dwt7
  && t2h1d5 < t2w1r8 && t2h1d5 < t2w1l8 && t2h1d5 < t2h1u8 && t2h1d5 < t2h1d8 && t2h1d5 < t2w1rwt8 && t2h1d5 < t2w1lwt8 && t2h1d5 < t2h1uwt8 && t2h1d5 < t2h1dwt8
  && t2h1d5 < t2w1r9 && t2h1d5 < t2w1l9 && t2h1d5 < t2h1u9 && t2h1d5 < t2h1d9 && t2h1d5 < t2w1rwt9 && t2h1d5 < t2w1lwt9 && t2h1d5 < t2h1uwt9 && t2h1d5 < t2h1dwt9
  && t2h1d5 < t2w1r10 && t2h1d5 < t2w1l10 && t2h1d5 < t2h1u10 && t2h1d5 < t2h1d10 && t2h1d5 < t2w1rwt10 && t2h1d5 < t2w1lwt10 && t2h1d5 < t2h1uwt10 && t2h1d5 < t2h1dwt10
  && (louthd5 !=0 && linhd5!=0)){
  i=217;
  }

  if (myd5==-1 && t2h1d5 > 0 && t2h1d5 < t1 
  && t2h1d5 < t2w1r && t2h1d5 < t2w1l && t2h1d5 < t2h1u && t2h1d5 < t2h1d && t2h1d5 < t2w1rwt && t2h1d5 < t2w1lwt && t2h1d5 < t2h1uwt && t2h1d5 < t2h1dwt
  && t2h1d5 < t2w1r1 && t2h1d5 < t2w1l1 && t2h1d5 < t2h1u1 && t2h1d5 < t2h1d1 && t2h1d5 < t2w1rwt1 && t2h1d5 < t2w1lwt1 && t2h1d5 < t2h1uwt1 && t2h1d5 < t2h1dwt1
  && t2h1d5 < t2w1r2 && t2h1d5 < t2w1l2 && t2h1d5 < t2h1u2 && t2h1d5 < t2h1d2 && t2h1d5 < t2w1rwt2 && t2h1d5 < t2w1lwt2 && t2h1d5 < t2h1uwt2 && t2h1d5 < t2h1dwt2
  && t2h1d5 < t2w1r3 && t2h1d5 < t2w1l3 && t2h1d5 < t2h1u3 && t2h1d5 < t2h1d3 && t2h1d5 < t2w1rwt3 && t2h1d5 < t2w1lwt3 && t2h1d5 < t2h1uwt3 && t2h1d5 < t2h1dwt3
  && t2h1d5 < t2w1r4 && t2h1d5 < t2w1l4 && t2h1d5 < t2h1u4 && t2h1d5 < t2h1d4 && t2h1d5 < t2w1rwt4 && t2h1d5 < t2w1lwt4 && t2h1d5 < t2h1uwt4 && t2h1d5 < t2h1dwt4
  && t2h1d5 < t2w1r5 && t2h1d5 < t2w1l5 && t2h1d5 < t2h1u5 && t2h1d5 < t2w1rwt5 && t2h1d5 < t2w1lwt5 && t2h1d5 < t2h1uwt5 && t2h1d5 < t2h1dwt5
  && t2h1d5 < t2w1r6 && t2h1d5 < t2w1l6 && t2h1d5 < t2h1u6 && t2h1d5 < t2h1d6 && t2h1d5 < t2w1rwt6 && t2h1d5 < t2w1lwt6 && t2h1d5 < t2h1uwt6 && t2h1d5 < t2h1dwt6
  && t2h1d5 < t2w1r7 && t2h1d5 < t2w1l7 && t2h1d5 < t2h1u7 && t2h1d5 < t2h1d7 && t2h1d5 < t2w1rwt7 && t2h1d5 < t2w1lwt7 && t2h1d5 < t2h1uwt7 && t2h1d5 < t2h1dwt7
  && t2h1d5 < t2w1r8 && t2h1d5 < t2w1l8 && t2h1d5 < t2h1u8 && t2h1d5 < t2h1d8 && t2h1d5 < t2w1rwt8 && t2h1d5 < t2w1lwt8 && t2h1d5 < t2h1uwt8 && t2h1d5 < t2h1dwt8
  && t2h1d5 < t2w1r9 && t2h1d5 < t2w1l9 && t2h1d5 < t2h1u9 && t2h1d5 < t2h1d9 && t2h1d5 < t2w1rwt9 && t2h1d5 < t2w1lwt9 && t2h1d5 < t2h1uwt9 && t2h1d5 < t2h1dwt9
  && t2h1d5 < t2w1r10 && t2h1d5 < t2w1l10 && t2h1d5 < t2h1u10 && t2h1d5 < t2h1d10 && t2h1d5 < t2w1rwt10 && t2h1d5 < t2w1lwt10 && t2h1d5 < t2h1uwt10 && t2h1d5 < t2h1dwt10
  && ((louthd5 !=0 && linhd5==0) || (louthd5 ==0 && linhd5!=0))){
  i=217;
  }

  if (myd5==-1 && t2h1d5 > 0 && t2h1d5 < t1 
  && t2h1d5 < t2w1r && t2h1d5 < t2w1l && t2h1d5 < t2h1u && t2h1d5 < t2h1d && t2h1d5 < t2w1rwt && t2h1d5 < t2w1lwt && t2h1d5 < t2h1uwt && t2h1d5 < t2h1dwt
  && t2h1d5 < t2w1r1 && t2h1d5 < t2w1l1 && t2h1d5 < t2h1u1 && t2h1d5 < t2h1d1 && t2h1d5 < t2w1rwt1 && t2h1d5 < t2w1lwt1 && t2h1d5 < t2h1uwt1 && t2h1d5 < t2h1dwt1
  && t2h1d5 < t2w1r2 && t2h1d5 < t2w1l2 && t2h1d5 < t2h1u2 && t2h1d5 < t2h1d2 && t2h1d5 < t2w1rwt2 && t2h1d5 < t2w1lwt2 && t2h1d5 < t2h1uwt2 && t2h1d5 < t2h1dwt2
  && t2h1d5 < t2w1r3 && t2h1d5 < t2w1l3 && t2h1d5 < t2h1u3 && t2h1d5 < t2h1d3 && t2h1d5 < t2w1rwt3 && t2h1d5 < t2w1lwt3 && t2h1d5 < t2h1uwt3 && t2h1d5 < t2h1dwt3
  && t2h1d5 < t2w1r4 && t2h1d5 < t2w1l4 && t2h1d5 < t2h1u4 && t2h1d5 < t2h1d4 && t2h1d5 < t2w1rwt4 && t2h1d5 < t2w1lwt4 && t2h1d5 < t2h1uwt4 && t2h1d5 < t2h1dwt4
  && t2h1d5 < t2w1r5 && t2h1d5 < t2w1l5 && t2h1d5 < t2h1u5 && t2h1d5 < t2w1rwt5 && t2h1d5 < t2w1lwt5 && t2h1d5 < t2h1uwt5 && t2h1d5 < t2h1dwt5
  && t2h1d5 < t2w1r6 && t2h1d5 < t2w1l6 && t2h1d5 < t2h1u6 && t2h1d5 < t2h1d6 && t2h1d5 < t2w1rwt6 && t2h1d5 < t2w1lwt6 && t2h1d5 < t2h1uwt6 && t2h1d5 < t2h1dwt6
  && t2h1d5 < t2w1r7 && t2h1d5 < t2w1l7 && t2h1d5 < t2h1u7 && t2h1d5 < t2h1d7 && t2h1d5 < t2w1rwt7 && t2h1d5 < t2w1lwt7 && t2h1d5 < t2h1uwt7 && t2h1d5 < t2h1dwt7
  && t2h1d5 < t2w1r8 && t2h1d5 < t2w1l8 && t2h1d5 < t2h1u8 && t2h1d5 < t2h1d8 && t2h1d5 < t2w1rwt8 && t2h1d5 < t2w1lwt8 && t2h1d5 < t2h1uwt8 && t2h1d5 < t2h1dwt8
  && t2h1d5 < t2w1r9 && t2h1d5 < t2w1l9 && t2h1d5 < t2h1u9 && t2h1d5 < t2h1d9 && t2h1d5 < t2w1rwt9 && t2h1d5 < t2w1lwt9 && t2h1d5 < t2h1uwt9 && t2h1d5 < t2h1dwt9
  && t2h1d5 < t2w1r10 && t2h1d5 < t2w1l10 && t2h1d5 < t2h1u10 && t2h1d5 < t2h1d10 && t2h1d5 < t2w1rwt10 && t2h1d5 < t2w1lwt10 && t2h1d5 < t2h1uwt10 && t2h1d5 < t2h1dwt10
  && (louthd5 == 0 && linhd5 == 0)){
  i=217;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW5!=-1 && t2w1rwt5 > 0 && t2w1rwt5 < t1 
  && t2w1rwt5 < t2w1r && t2w1rwt5 < t2w1l && t2w1rwt5 < t2h1u && t2w1rwt5 < t2h1d && t2w1rwt5 <t2w1rwt && t2w1rwt5 <t2w1lwt && t2w1rwt5 < t2h1uwt && t2w1rwt5 < t2h1dwt
  && t2w1rwt5 < t2w1r1 && t2w1rwt5 < t2w1l1 && t2w1rwt5 < t2h1u1 && t2w1rwt5 < t2h1d1 && t2w1rwt5 <t2w1rwt1 && t2w1rwt5 <t2w1lwt1 && t2w1rwt5 < t2h1uwt1 && t2w1rwt5 < t2h1dwt1
  && t2w1rwt5 < t2w1r2 && t2w1rwt5 < t2w1l2 && t2w1rwt5 < t2h1u2 && t2w1rwt5 < t2h1d2 && t2w1rwt5 <t2w1rwt2 && t2w1rwt5 <t2w1lwt2 && t2w1rwt5 < t2h1uwt2 && t2w1rwt5 < t2h1dwt2
  && t2w1rwt5 < t2w1r3 && t2w1rwt5 < t2w1l3 && t2w1rwt5 < t2h1u3 && t2w1rwt5 < t2h1d3 && t2w1rwt5 <t2w1rwt3 && t2w1rwt5 <t2w1lwt3 && t2w1rwt5 < t2h1uwt3 && t2w1rwt5 < t2h1dwt3
  && t2w1rwt5 < t2w1r4 && t2w1rwt5 < t2w1l4 && t2w1rwt5 < t2h1u4 && t2w1rwt5 < t2h1d4 && t2w1rwt5 <t2w1rwt4 && t2w1rwt5 <t2w1lwt4 && t2w1rwt5 < t2h1uwt4 && t2w1rwt5 < t2h1dwt4
  && t2w1rwt5 < t2w1r5 && t2w1rwt5 < t2w1l5 && t2w1rwt5 < t2h1u5 && t2w1rwt5 < t2h1d5 && t2w1rwt5 <t2w1lwt5 && t2w1rwt5 < t2h1uwt5 && t2w1rwt5 < t2h1dwt5
  && t2w1rwt5 < t2w1r6 && t2w1rwt5 < t2w1l6 && t2w1rwt5 < t2h1u6 && t2w1rwt5 < t2h1d6 && t2w1rwt5 <t2w1rwt6 && t2w1rwt5 <t2w1lwt6 && t2w1rwt5 < t2h1uwt6 && t2w1rwt5 < t2h1dwt6
  && t2w1rwt5 < t2w1r7 && t2w1rwt5 < t2w1l7 && t2w1rwt5 < t2h1u7 && t2w1rwt5 < t2h1d7 && t2w1rwt5 <t2w1rwt7 && t2w1rwt5 <t2w1lwt7 && t2w1rwt5 < t2h1uwt7 && t2w1rwt5 < t2h1dwt7
  && t2w1rwt5 < t2w1r8 && t2w1rwt5 < t2w1l8 && t2w1rwt5 < t2h1u8 && t2w1rwt5 < t2h1d8 && t2w1rwt5 <t2w1rwt8 && t2w1rwt5 <t2w1lwt8 && t2w1rwt5 < t2h1uwt8 && t2w1rwt5 < t2h1dwt8
  && t2w1rwt5 < t2w1r9 && t2w1rwt5 < t2w1l9 && t2w1rwt5 < t2h1u9 && t2w1rwt5 < t2h1d9 && t2w1rwt5 <t2w1rwt9 && t2w1rwt5 <t2w1lwt9 && t2w1rwt5 < t2h1uwt9 && t2w1rwt5 < t2h1dwt9
  && t2w1rwt5 < t2w1r10 && t2w1rwt5 < t2w1l10 && t2w1rwt5 < t2h1u10 && t2w1rwt5 < t2h1d10 && t2w1rwt5 <t2w1rwt10 && t2w1rwt5 <t2w1lwt10 && t2w1rwt5 < t2h1uwt10 && t2w1rwt5 < t2h1dwt10
  && ((linwr5!=0) && (loutwr5!=0) )){	
   if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1rwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1rwt5+z))*(z0hd5+(vz*t2w1rwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1rwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1rwt5+z))*(z0hu5+(vz*t2w1rwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1rwt5+y;
  xtest=vx*t2w1rwt5+x;
  xlimitrwt=-bwrwt5*sqrt(1-((vz*t2w1rwt5+z)+z0wr5)*((vz*t2w1rwt5+z)+z0wr5)/a2wrwt5);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW5 > 0){
  i=222;
  }
  else{
  i=234;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW5!=-1 && t2w1rwt5 > 0 && t2w1rwt5 < t1 
  && t2w1rwt5 < t2w1r && t2w1rwt5 < t2w1l && t2w1rwt5 < t2h1u && t2w1rwt5 < t2h1d && t2w1rwt5 <t2w1rwt && t2w1rwt5 <t2w1lwt && t2w1rwt5 < t2h1uwt && t2w1rwt5 < t2h1dwt
  && t2w1rwt5 < t2w1r1 && t2w1rwt5 < t2w1l1 && t2w1rwt5 < t2h1u1 && t2w1rwt5 < t2h1d1 && t2w1rwt5 <t2w1rwt1 && t2w1rwt5 <t2w1lwt1 && t2w1rwt5 < t2h1uwt1 && t2w1rwt5 < t2h1dwt1
  && t2w1rwt5 < t2w1r2 && t2w1rwt5 < t2w1l2 && t2w1rwt5 < t2h1u2 && t2w1rwt5 < t2h1d2 && t2w1rwt5 <t2w1rwt2 && t2w1rwt5 <t2w1lwt2 && t2w1rwt5 < t2h1uwt2 && t2w1rwt5 < t2h1dwt2
  && t2w1rwt5 < t2w1r3 && t2w1rwt5 < t2w1l3 && t2w1rwt5 < t2h1u3 && t2w1rwt5 < t2h1d3 && t2w1rwt5 <t2w1rwt3 && t2w1rwt5 <t2w1lwt3 && t2w1rwt5 < t2h1uwt3 && t2w1rwt5 < t2h1dwt3
  && t2w1rwt5 < t2w1r4 && t2w1rwt5 < t2w1l4 && t2w1rwt5 < t2h1u4 && t2w1rwt5 < t2h1d4 && t2w1rwt5 <t2w1rwt4 && t2w1rwt5 <t2w1lwt4 && t2w1rwt5 < t2h1uwt4 && t2w1rwt5 < t2h1dwt4
  && t2w1rwt5 < t2w1r5 && t2w1rwt5 < t2w1l5 && t2w1rwt5 < t2h1u5 && t2w1rwt5 < t2h1d5 && t2w1rwt5 <t2w1lwt5 && t2w1rwt5 < t2h1uwt5 && t2w1rwt5 < t2h1dwt5
  && t2w1rwt5 < t2w1r6 && t2w1rwt5 < t2w1l6 && t2w1rwt5 < t2h1u6 && t2w1rwt5 < t2h1d6 && t2w1rwt5 <t2w1rwt6 && t2w1rwt5 <t2w1lwt6 && t2w1rwt5 < t2h1uwt6 && t2w1rwt5 < t2h1dwt6
  && t2w1rwt5 < t2w1r7 && t2w1rwt5 < t2w1l7 && t2w1rwt5 < t2h1u7 && t2w1rwt5 < t2h1d7 && t2w1rwt5 <t2w1rwt7 && t2w1rwt5 <t2w1lwt7 && t2w1rwt5 < t2h1uwt7 && t2w1rwt5 < t2h1dwt7
  && t2w1rwt5 < t2w1r8 && t2w1rwt5 < t2w1l8 && t2w1rwt5 < t2h1u8 && t2w1rwt5 < t2h1d8 && t2w1rwt5 <t2w1rwt8 && t2w1rwt5 <t2w1lwt8 && t2w1rwt5 < t2h1uwt8 && t2w1rwt5 < t2h1dwt8
  && t2w1rwt5 < t2w1r9 && t2w1rwt5 < t2w1l9 && t2w1rwt5 < t2h1u9 && t2w1rwt5 < t2h1d9 && t2w1rwt5 <t2w1rwt9 && t2w1rwt5 <t2w1lwt9 && t2w1rwt5 < t2h1uwt9 && t2w1rwt5 < t2h1dwt9
  && t2w1rwt5 < t2w1r10 && t2w1rwt5 < t2w1l10 && t2w1rwt5 < t2h1u10 && t2w1rwt5 < t2h1d10 && t2w1rwt5 <t2w1rwt10 && t2w1rwt5 <t2w1lwt10 && t2w1rwt5 < t2h1uwt10 && t2w1rwt5 < t2h1dwt10
  && ((loutwr5!=0 && linwr5==0) || (loutwr5==0 && linwr5!=0))){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1rwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1rwt5+z))*(z0hd5+(vz*t2w1rwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1rwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1rwt5+z))*(z0hu5+(vz*t2w1rwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1rwt5+y;
  xtest=vx*t2w1rwt5+x;
  xlimitr=-sqrt((pbwrwt5-(vz*t2w1rwt5+z))/pawrwt5);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW5 > 0){
  i=223; 
  }else{
  i=234;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW5!=-1 && t2w1rwt5 > 0 && t2w1rwt5 < t1 
  && t2w1rwt5 < t2w1r && t2w1rwt5 < t2w1l && t2w1rwt5 < t2h1u && t2w1rwt5 < t2h1d && t2w1rwt5 <t2w1rwt && t2w1rwt5 <t2w1lwt && t2w1rwt5 < t2h1uwt && t2w1rwt5 < t2h1dwt
  && t2w1rwt5 < t2w1r1 && t2w1rwt5 < t2w1l1 && t2w1rwt5 < t2h1u1 && t2w1rwt5 < t2h1d1 && t2w1rwt5 <t2w1rwt1 && t2w1rwt5 <t2w1lwt1 && t2w1rwt5 < t2h1uwt1 && t2w1rwt5 < t2h1dwt1
  && t2w1rwt5 < t2w1r2 && t2w1rwt5 < t2w1l2 && t2w1rwt5 < t2h1u2 && t2w1rwt5 < t2h1d2 && t2w1rwt5 <t2w1rwt2 && t2w1rwt5 <t2w1lwt2 && t2w1rwt5 < t2h1uwt2 && t2w1rwt5 < t2h1dwt2
  && t2w1rwt5 < t2w1r3 && t2w1rwt5 < t2w1l3 && t2w1rwt5 < t2h1u3 && t2w1rwt5 < t2h1d3 && t2w1rwt5 <t2w1rwt3 && t2w1rwt5 <t2w1lwt3 && t2w1rwt5 < t2h1uwt3 && t2w1rwt5 < t2h1dwt3
  && t2w1rwt5 < t2w1r4 && t2w1rwt5 < t2w1l4 && t2w1rwt5 < t2h1u4 && t2w1rwt5 < t2h1d4 && t2w1rwt5 <t2w1rwt4 && t2w1rwt5 <t2w1lwt4 && t2w1rwt5 < t2h1uwt4 && t2w1rwt5 < t2h1dwt4
  && t2w1rwt5 < t2w1r5 && t2w1rwt5 < t2w1l5 && t2w1rwt5 < t2h1u5 && t2w1rwt5 < t2h1d5 && t2w1rwt5 <t2w1lwt5 && t2w1rwt5 < t2h1uwt5 && t2w1rwt5 < t2h1dwt5
  && t2w1rwt5 < t2w1r6 && t2w1rwt5 < t2w1l6 && t2w1rwt5 < t2h1u6 && t2w1rwt5 < t2h1d6 && t2w1rwt5 <t2w1rwt6 && t2w1rwt5 <t2w1lwt6 && t2w1rwt5 < t2h1uwt6 && t2w1rwt5 < t2h1dwt6
  && t2w1rwt5 < t2w1r7 && t2w1rwt5 < t2w1l7 && t2w1rwt5 < t2h1u7 && t2w1rwt5 < t2h1d7 && t2w1rwt5 <t2w1rwt7 && t2w1rwt5 <t2w1lwt7 && t2w1rwt5 < t2h1uwt7 && t2w1rwt5 < t2h1dwt7
  && t2w1rwt5 < t2w1r8 && t2w1rwt5 < t2w1l8 && t2w1rwt5 < t2h1u8 && t2w1rwt5 < t2h1d8 && t2w1rwt5 <t2w1rwt8 && t2w1rwt5 <t2w1lwt8 && t2w1rwt5 < t2h1uwt8 && t2w1rwt5 < t2h1dwt8
  && t2w1rwt5 < t2w1r9 && t2w1rwt5 < t2w1l9 && t2w1rwt5 < t2h1u9 && t2w1rwt5 < t2h1d9 && t2w1rwt5 <t2w1rwt9 && t2w1rwt5 <t2w1lwt9 && t2w1rwt5 < t2h1uwt9 && t2w1rwt5 < t2h1dwt9
  && t2w1rwt5 < t2w1r10 && t2w1rwt5 < t2w1l10 && t2w1rwt5 < t2h1u10 && t2w1rwt5 < t2h1d10 && t2w1rwt5 <t2w1rwt10 && t2w1rwt5 <t2w1lwt10 && t2w1rwt5 < t2h1uwt10 && t2w1rwt5 < t2h1dwt10
  && (loutwr5==0 && linwr5==0)){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1rwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1rwt5+z))*(z0hd5+(vz*t2w1rwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1rwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1rwt5+z))*(z0hu5+(vz*t2w1rwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1rwt5+y; 
  xtest=vx*t2w1rwt5+x;
  xlimitr=-(-w2r5+w1r5)*(vz*t2w1rwt5+z)/l-w1rwt5;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW5>0){
  i=224;
  }else{
  i=234;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW5!=-1 && t2w1lwt5 > 0 && t2w1lwt5 < t1 
  && t2w1lwt5 < t2w1r && t2w1lwt5 < t2w1l && t2w1lwt5 < t2h1u && t2w1lwt5 < t2h1d && t2w1lwt5 <t2w1rwt && t2w1lwt5 <t2w1lwt && t2w1lwt5 < t2h1uwt && t2w1lwt5 < t2h1dwt
  && t2w1lwt5 < t2w1r1 && t2w1lwt5 < t2w1l1 && t2w1lwt5 < t2h1u1 && t2w1lwt5 < t2h1d1 && t2w1lwt5 <t2w1rwt1 && t2w1lwt5 <t2w1lwt1 && t2w1lwt5 < t2h1uwt1 && t2w1lwt5 < t2h1dwt1
  && t2w1lwt5 < t2w1r2 && t2w1lwt5 < t2w1l2 && t2w1lwt5 < t2h1u2 && t2w1lwt5 < t2h1d2 && t2w1lwt5 <t2w1rwt2 && t2w1lwt5 <t2w1lwt2 && t2w1lwt5 < t2h1uwt2 && t2w1lwt5 < t2h1dwt2
  && t2w1lwt5 < t2w1r3 && t2w1lwt5 < t2w1l3 && t2w1lwt5 < t2h1u3 && t2w1lwt5 < t2h1d3 && t2w1lwt5 <t2w1rwt3 && t2w1lwt5 <t2w1lwt3 && t2w1lwt5 < t2h1uwt3 && t2w1lwt5 < t2h1dwt3
  && t2w1lwt5 < t2w1r4 && t2w1lwt5 < t2w1l4 && t2w1lwt5 < t2h1u4 && t2w1lwt5 < t2h1d4 && t2w1lwt5 <t2w1rwt4 && t2w1lwt5 <t2w1lwt4 && t2w1lwt5 < t2h1uwt4 && t2w1lwt5 < t2h1dwt4
  && t2w1lwt5 < t2w1r5 && t2w1lwt5 < t2w1l5 && t2w1lwt5 < t2h1u5 && t2w1lwt5 < t2h1d5 && t2w1lwt5 <t2w1rwt5 && t2w1lwt5 < t2h1uwt5 && t2w1lwt5 < t2h1dwt5
  && t2w1lwt5 < t2w1r6 && t2w1lwt5 < t2w1l6 && t2w1lwt5 < t2h1u6 && t2w1lwt5 < t2h1d6 && t2w1lwt5 <t2w1rwt6 && t2w1lwt5 <t2w1lwt6 && t2w1lwt5 < t2h1uwt6 && t2w1lwt5 < t2h1dwt6
  && t2w1lwt5 < t2w1r7 && t2w1lwt5 < t2w1l7 && t2w1lwt5 < t2h1u7 && t2w1lwt5 < t2h1d7 && t2w1lwt5 <t2w1rwt7 && t2w1lwt5 <t2w1lwt7 && t2w1lwt5 < t2h1uwt7 && t2w1lwt5 < t2h1dwt7
  && t2w1lwt5 < t2w1r8 && t2w1lwt5 < t2w1l8 && t2w1lwt5 < t2h1u8 && t2w1lwt5 < t2h1d8 && t2w1lwt5 <t2w1rwt8 && t2w1lwt5 <t2w1lwt8 && t2w1lwt5 < t2h1uwt8 && t2w1lwt5 < t2h1dwt8
  && t2w1lwt5 < t2w1r9 && t2w1lwt5 < t2w1l9 && t2w1lwt5 < t2h1u9 && t2w1lwt5 < t2h1d9 && t2w1lwt5 <t2w1rwt9 && t2w1lwt5 <t2w1lwt9 && t2w1lwt5 < t2h1uwt9 && t2w1lwt5 < t2h1dwt9
  && t2w1lwt5 < t2w1r10 && t2w1lwt5 < t2w1l10 && t2w1lwt5 < t2h1u10 && t2w1lwt5 < t2h1d10 && t2w1lwt5 <t2w1rwt10 && t2w1lwt5 <t2w1lwt10 && t2w1lwt5 < t2h1uwt10 && t2w1lwt5 < t2h1dwt10
  && ((linwl5!=0) && (loutwl5!=0) )){
  if(linhd5==0 && louthd5==0)
   if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1lwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1lwt5+z))*(z0hd5+(vz*t2w1lwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1lwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1lwt5+z))*(z0hu5+(vz*t2w1lwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1lwt5+y;
  xtest=vx*t2w1lwt5+x;
  xlimitlwt=-bwlwt5*sqrt(1-((vz*t2w1lwt5+z)+z0wl5)*((vz*t2w1lwt5+z)+z0wl5)/a2wlwt5);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW5>0){
  i=225;
  }else{
  i=235;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW5!=-1 && t2w1lwt5 > 0 && t2w1lwt5 < t1 
  && t2w1lwt5 < t2w1r && t2w1lwt5 < t2w1l && t2w1lwt5 < t2h1u && t2w1lwt5 < t2h1d && t2w1lwt5 <t2w1rwt && t2w1lwt5 <t2w1lwt && t2w1lwt5 < t2h1uwt && t2w1lwt5 < t2h1dwt
  && t2w1lwt5 < t2w1r1 && t2w1lwt5 < t2w1l1 && t2w1lwt5 < t2h1u1 && t2w1lwt5 < t2h1d1 && t2w1lwt5 <t2w1rwt1 && t2w1lwt5 <t2w1lwt1 && t2w1lwt5 < t2h1uwt1 && t2w1lwt5 < t2h1dwt1
  && t2w1lwt5 < t2w1r2 && t2w1lwt5 < t2w1l2 && t2w1lwt5 < t2h1u2 && t2w1lwt5 < t2h1d2 && t2w1lwt5 <t2w1rwt2 && t2w1lwt5 <t2w1lwt2 && t2w1lwt5 < t2h1uwt2 && t2w1lwt5 < t2h1dwt2
  && t2w1lwt5 < t2w1r3 && t2w1lwt5 < t2w1l3 && t2w1lwt5 < t2h1u3 && t2w1lwt5 < t2h1d3 && t2w1lwt5 <t2w1rwt3 && t2w1lwt5 <t2w1lwt3 && t2w1lwt5 < t2h1uwt3 && t2w1lwt5 < t2h1dwt3
  && t2w1lwt5 < t2w1r4 && t2w1lwt5 < t2w1l4 && t2w1lwt5 < t2h1u4 && t2w1lwt5 < t2h1d4 && t2w1lwt5 <t2w1rwt4 && t2w1lwt5 <t2w1lwt4 && t2w1lwt5 < t2h1uwt4 && t2w1lwt5 < t2h1dwt4
  && t2w1lwt5 < t2w1r5 && t2w1lwt5 < t2w1l5 && t2w1lwt5 < t2h1u5 && t2w1lwt5 < t2h1d5 && t2w1lwt5 <t2w1rwt5 && t2w1lwt5 < t2h1uwt5 && t2w1lwt5 < t2h1dwt5
  && t2w1lwt5 < t2w1r6 && t2w1lwt5 < t2w1l6 && t2w1lwt5 < t2h1u6 && t2w1lwt5 < t2h1d6 && t2w1lwt5 <t2w1rwt6 && t2w1lwt5 <t2w1lwt6 && t2w1lwt5 < t2h1uwt6 && t2w1lwt5 < t2h1dwt6
  && t2w1lwt5 < t2w1r7 && t2w1lwt5 < t2w1l7 && t2w1lwt5 < t2h1u7 && t2w1lwt5 < t2h1d7 && t2w1lwt5 <t2w1rwt7 && t2w1lwt5 <t2w1lwt7 && t2w1lwt5 < t2h1uwt7 && t2w1lwt5 < t2h1dwt7
  && t2w1lwt5 < t2w1r8 && t2w1lwt5 < t2w1l8 && t2w1lwt5 < t2h1u8 && t2w1lwt5 < t2h1d8 && t2w1lwt5 <t2w1rwt8 && t2w1lwt5 <t2w1lwt8 && t2w1lwt5 < t2h1uwt8 && t2w1lwt5 < t2h1dwt8
  && t2w1lwt5 < t2w1r9 && t2w1lwt5 < t2w1l9 && t2w1lwt5 < t2h1u9 && t2w1lwt5 < t2h1d9 && t2w1lwt5 <t2w1rwt9 && t2w1lwt5 <t2w1lwt9 && t2w1lwt5 < t2h1uwt9 && t2w1lwt5 < t2h1dwt9
  && t2w1lwt5 < t2w1r10 && t2w1lwt5 < t2w1l10 && t2w1lwt5 < t2h1u10 && t2w1lwt5 < t2h1d10 && t2w1lwt5 <t2w1rwt10 && t2w1lwt5 <t2w1lwt10 && t2w1lwt5 < t2h1uwt10 && t2w1lwt5 < t2h1dwt10
  && ((loutwl5!=0 && linwl5==0) || (loutwl5==0 && linwl5!=0))){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1lwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1lwt5+z))*(z0hd5+(vz*t2w1lwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1lwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1lwt5+z))*(z0hu5+(vz*t2w1lwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1lwt5+y;
  xtest=vx*t2w1lwt5+x;
  xlimitl=-sqrt((pbwlwt5-(vz*t2w1lwt5+z))/pawlwt5);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW5>0){
  i=226;
  }else{
  i=235;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW5!=-1 && t2w1lwt5 > 0 && t2w1lwt5 < t1 
  && t2w1lwt5 < t2w1r && t2w1lwt5 < t2w1l && t2w1lwt5 < t2h1u && t2w1lwt5 < t2h1d && t2w1lwt5 <t2w1rwt && t2w1lwt5 <t2w1lwt && t2w1lwt5 < t2h1uwt && t2w1lwt5 < t2h1dwt
  && t2w1lwt5 < t2w1r1 && t2w1lwt5 < t2w1l1 && t2w1lwt5 < t2h1u1 && t2w1lwt5 < t2h1d1 && t2w1lwt5 <t2w1rwt1 && t2w1lwt5 <t2w1lwt1 && t2w1lwt5 < t2h1uwt1 && t2w1lwt5 < t2h1dwt1
  && t2w1lwt5 < t2w1r2 && t2w1lwt5 < t2w1l2 && t2w1lwt5 < t2h1u2 && t2w1lwt5 < t2h1d2 && t2w1lwt5 <t2w1rwt2 && t2w1lwt5 <t2w1lwt2 && t2w1lwt5 < t2h1uwt2 && t2w1lwt5 < t2h1dwt2
  && t2w1lwt5 < t2w1r3 && t2w1lwt5 < t2w1l3 && t2w1lwt5 < t2h1u3 && t2w1lwt5 < t2h1d3 && t2w1lwt5 <t2w1rwt3 && t2w1lwt5 <t2w1lwt3 && t2w1lwt5 < t2h1uwt3 && t2w1lwt5 < t2h1dwt3
  && t2w1lwt5 < t2w1r4 && t2w1lwt5 < t2w1l4 && t2w1lwt5 < t2h1u4 && t2w1lwt5 < t2h1d4 && t2w1lwt5 <t2w1rwt4 && t2w1lwt5 <t2w1lwt4 && t2w1lwt5 < t2h1uwt4 && t2w1lwt5 < t2h1dwt4
  && t2w1lwt5 < t2w1r5 && t2w1lwt5 < t2w1l5 && t2w1lwt5 < t2h1u5 && t2w1lwt5 < t2h1d5 && t2w1lwt5 <t2w1rwt5 && t2w1lwt5 < t2h1uwt5 && t2w1lwt5 < t2h1dwt5
  && t2w1lwt5 < t2w1r6 && t2w1lwt5 < t2w1l6 && t2w1lwt5 < t2h1u6 && t2w1lwt5 < t2h1d6 && t2w1lwt5 <t2w1rwt6 && t2w1lwt5 <t2w1lwt6 && t2w1lwt5 < t2h1uwt6 && t2w1lwt5 < t2h1dwt6
  && t2w1lwt5 < t2w1r7 && t2w1lwt5 < t2w1l7 && t2w1lwt5 < t2h1u7 && t2w1lwt5 < t2h1d7 && t2w1lwt5 <t2w1rwt7 && t2w1lwt5 <t2w1lwt7 && t2w1lwt5 < t2h1uwt7 && t2w1lwt5 < t2h1dwt7
  && t2w1lwt5 < t2w1r8 && t2w1lwt5 < t2w1l8 && t2w1lwt5 < t2h1u8 && t2w1lwt5 < t2h1d8 && t2w1lwt5 <t2w1rwt8 && t2w1lwt5 <t2w1lwt8 && t2w1lwt5 < t2h1uwt8 && t2w1lwt5 < t2h1dwt8
  && t2w1lwt5 < t2w1r9 && t2w1lwt5 < t2w1l9 && t2w1lwt5 < t2h1u9 && t2w1lwt5 < t2h1d9 && t2w1lwt5 <t2w1rwt9 && t2w1lwt5 <t2w1lwt9 && t2w1lwt5 < t2h1uwt9 && t2w1lwt5 < t2h1dwt9
  && t2w1lwt5 < t2w1r10 && t2w1lwt5 < t2w1l10 && t2w1lwt5 < t2h1u10 && t2w1lwt5 < t2h1d10 && t2w1lwt5 <t2w1rwt10 && t2w1lwt5 <t2w1lwt10 && t2w1lwt5 < t2h1uwt10 && t2w1lwt5 < t2h1dwt10
  && (loutwl5==0 && linwl5==0)){
  if(linhd5==0 && louthd5==0)
   {
      ylimitd=(-h2d5+h1d5)/l*(vz*t2w1lwt5+z)-h1dwt5;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ylimitd=-bhdwt5*sqrt(1-((z0hd5+(vz*t2w1lwt5+z))*(z0hd5+(vz*t2w1lwt5+z)))/a2hdwt5);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt5+z)-pbhdwt5)/-pahdwt5);
      }
   }
   if(linhu5==0 && louthu5==0)
    {
     ylimitu=(h2u5-h1u5)/l*(vz*t2w1lwt5+z)+h1uwt5;
    }else{
     if(linhu5!=0 && louthu5!=0)
     {
     ylimitu=bhuwt5*sqrt(1-((z0hu5+(vz*t2w1lwt5+z))*(z0hu5+(vz*t2w1lwt5+z)))/a2huwt5);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt5+z)-pbhuwt5)/-pahuwt5);
    }
    }
  ytest=vy*t2w1lwt5+y; 
  xtest=vx*t2w1lwt5+x;
  xlimitl=(w2l5-w1l5)*(vz*t2w1lwt5+z)/l+w1lwt5;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW5>0){
  i=227;
  }else{
  i=235;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW5!=-1 && t2h1uwt5 > 0 && t2h1uwt5 < t1 
  && t2h1uwt5 < t2w1r && t2h1uwt5 < t2w1l && t2h1uwt5 < t2h1u && t2h1uwt5 < t2h1d && t2h1uwt5 < t2w1rwt && t2h1uwt5 < t2w1lwt && t2h1uwt5 < t2h1uwt && t2h1uwt5 < t2h1dwt 
  && t2h1uwt5 < t2w1r1 && t2h1uwt5 < t2w1l1 && t2h1uwt5 < t2h1u1 && t2h1uwt5 < t2h1d1 && t2h1uwt5 < t2w1rwt1 && t2h1uwt5 < t2w1lwt1 && t2h1uwt5 < t2h1uwt1 && t2h1uwt5 < t2h1dwt1
  && t2h1uwt5 < t2w1r2 && t2h1uwt5 < t2w1l2 && t2h1uwt5 < t2h1u2 && t2h1uwt5 < t2h1d2 && t2h1uwt5 < t2w1rwt2 && t2h1uwt5 < t2w1lwt2 && t2h1uwt5 < t2h1uwt2 && t2h1uwt5 < t2h1dwt2
  && t2h1uwt5 < t2w1r3 && t2h1uwt5 < t2w1l3 && t2h1uwt5 < t2h1u3 && t2h1uwt5 < t2h1d3 && t2h1uwt5 < t2w1rwt3 && t2h1uwt5 < t2w1lwt3 && t2h1uwt5 < t2h1uwt3 && t2h1uwt5 < t2h1dwt3
  && t2h1uwt5 < t2w1r4 && t2h1uwt5 < t2w1l4 && t2h1uwt5 < t2h1u4 && t2h1uwt5 < t2h1d4 && t2h1uwt5 < t2w1rwt4 && t2h1uwt5 < t2w1lwt4 && t2h1uwt5 < t2h1uwt4 && t2h1uwt5 < t2h1dwt4
  && t2h1uwt5 < t2w1r5 && t2h1uwt5 < t2w1l5 && t2h1uwt5 < t2h1u5 && t2h1uwt5 < t2h1d5 && t2h1uwt5 < t2w1rwt5 && t2h1uwt5 < t2w1lwt5 && t2h1uwt5 < t2h1dwt5
  && t2h1uwt5 < t2w1r6 && t2h1uwt5 < t2w1l6 && t2h1uwt5 < t2h1u6 && t2h1uwt5 < t2h1d6 && t2h1uwt5 < t2w1rwt6 && t2h1uwt5 < t2w1lwt6 && t2h1uwt5 < t2h1uwt6 && t2h1uwt5 < t2h1dwt6
  && t2h1uwt5 < t2w1r7 && t2h1uwt5 < t2w1l7 && t2h1uwt5 < t2h1u7 && t2h1uwt5 < t2h1d7 && t2h1uwt5 < t2w1rwt7 && t2h1uwt5 < t2w1lwt7 && t2h1uwt5 < t2h1uwt7 && t2h1uwt5 < t2h1dwt7
  && t2h1uwt5 < t2w1r8 && t2h1uwt5 < t2w1l8 && t2h1uwt5 < t2h1u8 && t2h1uwt5 < t2h1d8 && t2h1uwt5 < t2w1rwt8 && t2h1uwt5 < t2w1lwt8 && t2h1uwt5 < t2h1uwt8 && t2h1uwt5 < t2h1dwt8
  && t2h1uwt5 < t2w1r9 && t2h1uwt5 < t2w1l9 && t2h1uwt5 < t2h1u9 && t2h1uwt5 < t2h1d9 && t2h1uwt5 < t2w1rwt9 && t2h1uwt5 < t2w1lwt9 && t2h1uwt5 < t2h1uwt9 && t2h1uwt5 < t2h1dwt9
  && t2h1uwt5 < t2w1r10 && t2h1uwt5 < t2w1l10 && t2h1uwt5 < t2h1u10 && t2h1uwt5 < t2h1d10 && t2h1uwt5 < t2w1rwt10 && t2h1uwt5 < t2w1lwt10 && t2h1uwt5 < t2h1uwt10 && t2h1uwt5 < t2h1dwt10
  && (louthu5 !=0 && linhu5!=0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1uwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1uwt5+z))*(z0wr5+(vz*t2h1uwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1uwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1uwt5+z))*(z0wl5+(vz*t2h1uwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1uwt5+x;
  ytest=vy*t2w1lwt5+y;
  ylimitu=bhuwt5*sqrt(1-((vz*t2h1uwt5+z)+z0hu5)*((vz*t2h1uwt5+z)+z0hu5)/a2huwt5);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW5>0 ){
  i=228;
  }else{
  i=236;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW5!=-1 && t2h1uwt5 > 0 && t2h1uwt5 < t1 
  && t2h1uwt5 < t2w1r && t2h1uwt5 < t2w1l && t2h1uwt5 < t2h1u && t2h1uwt5 < t2h1d && t2h1uwt5 < t2w1rwt && t2h1uwt5 < t2w1lwt && t2h1uwt5 < t2h1uwt && t2h1uwt5 < t2h1dwt 
  && t2h1uwt5 < t2w1r1 && t2h1uwt5 < t2w1l1 && t2h1uwt5 < t2h1u1 && t2h1uwt5 < t2h1d1 && t2h1uwt5 < t2w1rwt1 && t2h1uwt5 < t2w1lwt1 && t2h1uwt5 < t2h1uwt1 && t2h1uwt5 < t2h1dwt1
  && t2h1uwt5 < t2w1r2 && t2h1uwt5 < t2w1l2 && t2h1uwt5 < t2h1u2 && t2h1uwt5 < t2h1d2 && t2h1uwt5 < t2w1rwt2 && t2h1uwt5 < t2w1lwt2 && t2h1uwt5 < t2h1uwt2 && t2h1uwt5 < t2h1dwt2
  && t2h1uwt5 < t2w1r3 && t2h1uwt5 < t2w1l3 && t2h1uwt5 < t2h1u3 && t2h1uwt5 < t2h1d3 && t2h1uwt5 < t2w1rwt3 && t2h1uwt5 < t2w1lwt3 && t2h1uwt5 < t2h1uwt3 && t2h1uwt5 < t2h1dwt3
  && t2h1uwt5 < t2w1r4 && t2h1uwt5 < t2w1l4 && t2h1uwt5 < t2h1u4 && t2h1uwt5 < t2h1d4 && t2h1uwt5 < t2w1rwt4 && t2h1uwt5 < t2w1lwt4 && t2h1uwt5 < t2h1uwt4 && t2h1uwt5 < t2h1dwt4
  && t2h1uwt5 < t2w1r5 && t2h1uwt5 < t2w1l5 && t2h1uwt5 < t2h1u5 && t2h1uwt5 < t2h1d5 && t2h1uwt5 < t2w1rwt5 && t2h1uwt5 < t2w1lwt5 && t2h1uwt5 < t2h1dwt5
  && t2h1uwt5 < t2w1r6 && t2h1uwt5 < t2w1l6 && t2h1uwt5 < t2h1u6 && t2h1uwt5 < t2h1d6 && t2h1uwt5 < t2w1rwt6 && t2h1uwt5 < t2w1lwt6 && t2h1uwt5 < t2h1uwt6 && t2h1uwt5 < t2h1dwt6
  && t2h1uwt5 < t2w1r7 && t2h1uwt5 < t2w1l7 && t2h1uwt5 < t2h1u7 && t2h1uwt5 < t2h1d7 && t2h1uwt5 < t2w1rwt7 && t2h1uwt5 < t2w1lwt7 && t2h1uwt5 < t2h1uwt7 && t2h1uwt5 < t2h1dwt7
  && t2h1uwt5 < t2w1r8 && t2h1uwt5 < t2w1l8 && t2h1uwt5 < t2h1u8 && t2h1uwt5 < t2h1d8 && t2h1uwt5 < t2w1rwt8 && t2h1uwt5 < t2w1lwt8 && t2h1uwt5 < t2h1uwt8 && t2h1uwt5 < t2h1dwt8
  && t2h1uwt5 < t2w1r9 && t2h1uwt5 < t2w1l9 && t2h1uwt5 < t2h1u9 && t2h1uwt5 < t2h1d9 && t2h1uwt5 < t2w1rwt9 && t2h1uwt5 < t2w1lwt9 && t2h1uwt5 < t2h1uwt9 && t2h1uwt5 < t2h1dwt9
  && t2h1uwt5 < t2w1r10 && t2h1uwt5 < t2w1l10 && t2h1uwt5 < t2h1u10 && t2h1uwt5 < t2h1d10 && t2h1uwt5 < t2w1rwt10 && t2h1uwt5 < t2w1lwt10 && t2h1uwt5 < t2h1uwt10 && t2h1uwt5 < t2h1dwt10
  && ((louthu5!=0 && linhu5==0) || (louthu5==0 && linhu5!=0))){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1uwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1uwt5+z))*(z0wr5+(vz*t2h1uwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1uwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1uwt5+z))*(z0wl5+(vz*t2h1uwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1uwt5+x;
  ytest=vy*t2w1lwt5+y;
  ylimitu=sqrt((pbhuwt5-(vz*t2h1uwt5+z))/pahuwt5);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW5>0){
  i=229;
  }else{
  i=236;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW5!=-1 && t2h1uwt5 > 0 && t2h1uwt5 < t1 
  && t2h1uwt5 < t2w1r && t2h1uwt5 < t2w1l && t2h1uwt5 < t2h1u && t2h1uwt5 < t2h1d && t2h1uwt5 < t2w1rwt && t2h1uwt5 < t2w1lwt && t2h1uwt5 < t2h1uwt && t2h1uwt5 < t2h1dwt 
  && t2h1uwt5 < t2w1r1 && t2h1uwt5 < t2w1l1 && t2h1uwt5 < t2h1u1 && t2h1uwt5 < t2h1d1 && t2h1uwt5 < t2w1rwt1 && t2h1uwt5 < t2w1lwt1 && t2h1uwt5 < t2h1uwt1 && t2h1uwt5 < t2h1dwt1
  && t2h1uwt5 < t2w1r2 && t2h1uwt5 < t2w1l2 && t2h1uwt5 < t2h1u2 && t2h1uwt5 < t2h1d2 && t2h1uwt5 < t2w1rwt2 && t2h1uwt5 < t2w1lwt2 && t2h1uwt5 < t2h1uwt2 && t2h1uwt5 < t2h1dwt2
  && t2h1uwt5 < t2w1r3 && t2h1uwt5 < t2w1l3 && t2h1uwt5 < t2h1u3 && t2h1uwt5 < t2h1d3 && t2h1uwt5 < t2w1rwt3 && t2h1uwt5 < t2w1lwt3 && t2h1uwt5 < t2h1uwt3 && t2h1uwt5 < t2h1dwt3
  && t2h1uwt5 < t2w1r4 && t2h1uwt5 < t2w1l4 && t2h1uwt5 < t2h1u4 && t2h1uwt5 < t2h1d4 && t2h1uwt5 < t2w1rwt4 && t2h1uwt5 < t2w1lwt4 && t2h1uwt5 < t2h1uwt4 && t2h1uwt5 < t2h1dwt4
  && t2h1uwt5 < t2w1r5 && t2h1uwt5 < t2w1l5 && t2h1uwt5 < t2h1u5 && t2h1uwt5 < t2h1d5 && t2h1uwt5 < t2w1rwt5 && t2h1uwt5 < t2w1lwt5 && t2h1uwt5 < t2h1dwt5
  && t2h1uwt5 < t2w1r6 && t2h1uwt5 < t2w1l6 && t2h1uwt5 < t2h1u6 && t2h1uwt5 < t2h1d6 && t2h1uwt5 < t2w1rwt6 && t2h1uwt5 < t2w1lwt6 && t2h1uwt5 < t2h1uwt6 && t2h1uwt5 < t2h1dwt6
  && t2h1uwt5 < t2w1r7 && t2h1uwt5 < t2w1l7 && t2h1uwt5 < t2h1u7 && t2h1uwt5 < t2h1d7 && t2h1uwt5 < t2w1rwt7 && t2h1uwt5 < t2w1lwt7 && t2h1uwt5 < t2h1uwt7 && t2h1uwt5 < t2h1dwt7
  && t2h1uwt5 < t2w1r8 && t2h1uwt5 < t2w1l8 && t2h1uwt5 < t2h1u8 && t2h1uwt5 < t2h1d8 && t2h1uwt5 < t2w1rwt8 && t2h1uwt5 < t2w1lwt8 && t2h1uwt5 < t2h1uwt8 && t2h1uwt5 < t2h1dwt8
  && t2h1uwt5 < t2w1r9 && t2h1uwt5 < t2w1l9 && t2h1uwt5 < t2h1u9 && t2h1uwt5 < t2h1d9 && t2h1uwt5 < t2w1rwt9 && t2h1uwt5 < t2w1lwt9 && t2h1uwt5 < t2h1uwt9 && t2h1uwt5 < t2h1dwt9
  && t2h1uwt5 < t2w1r10 && t2h1uwt5 < t2w1l10 && t2h1uwt5 < t2h1u10 && t2h1uwt5 < t2h1d10 && t2h1uwt5 < t2w1rwt10 && t2h1uwt5 < t2w1lwt10 && t2h1uwt5 < t2h1uwt10 && t2h1uwt5 < t2h1dwt10
  && (louthu5 == 0 && linhu5 == 0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1uwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1uwt5+z))*(z0wr5+(vz*t2h1uwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1uwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1uwt5+z))*(z0wl5+(vz*t2h1uwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1uwt5+x;
  ytest=vy*t2w1lwt5+y;
  ylimitu=(h2u5-h1u5)*(vz*t2h1uwt5+z)/l+h1uwt5;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW5>0 ){
  i=230;
  }else{
  i=236;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW5!=-1 && t2h1dwt5 > 0 && t2h1dwt5 < t1 
  && t2h1dwt5 < t2w1r && t2h1dwt5 < t2w1l && t2h1dwt5 < t2h1u && t2h1dwt5 < t2h1d && t2h1dwt5 < t2w1rwt && t2h1dwt5 < t2w1lwt && t2h1dwt5 < t2h1uwt && t2h1dwt5 < t2h1dwt 
  && t2h1dwt5 < t2w1r1 && t2h1dwt5 < t2w1l1 && t2h1dwt5 < t2h1u1 && t2h1dwt5 < t2h1d1 && t2h1dwt5 < t2w1rwt1 && t2h1dwt5 < t2w1lwt1 && t2h1dwt5 < t2h1uwt1 && t2h1dwt5 < t2h1dwt1
  && t2h1dwt5 < t2w1r2 && t2h1dwt5 < t2w1l2 && t2h1dwt5 < t2h1u2 && t2h1dwt5 < t2h1d2 && t2h1dwt5 < t2w1rwt2 && t2h1dwt5 < t2w1lwt2 && t2h1dwt5 < t2h1uwt2 && t2h1dwt5 < t2h1dwt2 
  && t2h1dwt5 < t2w1r3 && t2h1dwt5 < t2w1l3 && t2h1dwt5 < t2h1u3 && t2h1dwt5 < t2h1d3 && t2h1dwt5 < t2w1rwt3 && t2h1dwt5 < t2w1lwt3 && t2h1dwt5 < t2h1uwt3 && t2h1dwt5 < t2h1dwt3
  && t2h1dwt5 < t2w1r4 && t2h1dwt5 < t2w1l4 && t2h1dwt5 < t2h1u4 && t2h1dwt5 < t2h1d4 && t2h1dwt5 < t2w1rwt4 && t2h1dwt5 < t2w1lwt4 && t2h1dwt5 < t2h1uwt4 && t2h1dwt5 < t2h1dwt4
  && t2h1dwt5 < t2w1r5 && t2h1dwt5 < t2w1l5 && t2h1dwt5 < t2h1u5 && t2h1dwt5 < t2h1d5 && t2h1dwt5 < t2w1rwt5 && t2h1dwt5 < t2w1lwt5 && t2h1dwt5 < t2h1uwt5 
  && t2h1dwt5 < t2w1r6 && t2h1dwt5 < t2w1l6 && t2h1dwt5 < t2h1u6 && t2h1dwt5 < t2h1d6 && t2h1dwt5 < t2w1rwt6 && t2h1dwt5 < t2w1lwt6 && t2h1dwt5 < t2h1uwt6 && t2h1dwt5 < t2h1dwt6
  && t2h1dwt5 < t2w1r7 && t2h1dwt5 < t2w1l7 && t2h1dwt5 < t2h1u7 && t2h1dwt5 < t2h1d7 && t2h1dwt5 < t2w1rwt7 && t2h1dwt5 < t2w1lwt7 && t2h1dwt5 < t2h1uwt7 && t2h1dwt5 < t2h1dwt7 
  && t2h1dwt5 < t2w1r8 && t2h1dwt5 < t2w1l8 && t2h1dwt5 < t2h1u8 && t2h1dwt5 < t2h1d8 && t2h1dwt5 < t2w1rwt8 && t2h1dwt5 < t2w1lwt8 && t2h1dwt5 < t2h1uwt8 && t2h1dwt5 < t2h1dwt8
  && t2h1dwt5 < t2w1r9 && t2h1dwt5 < t2w1l9 && t2h1dwt5 < t2h1u9 && t2h1dwt5 < t2h1d9 && t2h1dwt5 < t2w1rwt9 && t2h1dwt5 < t2w1lwt9 && t2h1dwt5 < t2h1uwt9 && t2h1dwt5 < t2h1dwt9 
  && t2h1dwt5 < t2w1r10 && t2h1dwt5 < t2w1l10 && t2h1dwt5 < t2h1u10 && t2h1dwt5 < t2h1d10 && t2h1dwt5 < t2w1rwt10 && t2h1dwt5 < t2w1lwt10 && t2h1dwt5 < t2h1uwt10 && t2h1dwt5 < t2h1dwt10  
  && (louthd5 !=0 && linhd5!=0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1dwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1dwt5+z))*(z0wr5+(vz*t2h1dwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1dwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1dwt5+z))*(z0wl5+(vz*t2h1dwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1dwt5+x;
  ytest=vy*t2w1lwt5+y;
  ylimitd=-bhdwt5*sqrt(1-((vz*t2h1dwt5+z)+z0hd5)*((vz*t2h1dwt5+z)+z0hd5)/a2hdwt5);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW5>0){
  i=231;
  }else{
  i=237;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW5!=-1 && t2h1dwt5 > 0 && t2h1dwt5 < t1 
  && t2h1dwt5 < t2w1r && t2h1dwt5 < t2w1l && t2h1dwt5 < t2h1u && t2h1dwt5 < t2h1d && t2h1dwt5 < t2w1rwt && t2h1dwt5 < t2w1lwt && t2h1dwt5 < t2h1uwt && t2h1dwt5 < t2h1dwt 
  && t2h1dwt5 < t2w1r1 && t2h1dwt5 < t2w1l1 && t2h1dwt5 < t2h1u1 && t2h1dwt5 < t2h1d1 && t2h1dwt5 < t2w1rwt1 && t2h1dwt5 < t2w1lwt1 && t2h1dwt5 < t2h1uwt1 && t2h1dwt5 < t2h1dwt1
  && t2h1dwt5 < t2w1r2 && t2h1dwt5 < t2w1l2 && t2h1dwt5 < t2h1u2 && t2h1dwt5 < t2h1d2 && t2h1dwt5 < t2w1rwt2 && t2h1dwt5 < t2w1lwt2 && t2h1dwt5 < t2h1uwt2 && t2h1dwt5 < t2h1dwt2 
  && t2h1dwt5 < t2w1r3 && t2h1dwt5 < t2w1l3 && t2h1dwt5 < t2h1u3 && t2h1dwt5 < t2h1d3 && t2h1dwt5 < t2w1rwt3 && t2h1dwt5 < t2w1lwt3 && t2h1dwt5 < t2h1uwt3 && t2h1dwt5 < t2h1dwt3
  && t2h1dwt5 < t2w1r4 && t2h1dwt5 < t2w1l4 && t2h1dwt5 < t2h1u4 && t2h1dwt5 < t2h1d4 && t2h1dwt5 < t2w1rwt4 && t2h1dwt5 < t2w1lwt4 && t2h1dwt5 < t2h1uwt4 && t2h1dwt5 < t2h1dwt4
  && t2h1dwt5 < t2w1r5 && t2h1dwt5 < t2w1l5 && t2h1dwt5 < t2h1u5 && t2h1dwt5 < t2h1d5 && t2h1dwt5 < t2w1rwt5 && t2h1dwt5 < t2w1lwt5 && t2h1dwt5 < t2h1uwt5 
  && t2h1dwt5 < t2w1r6 && t2h1dwt5 < t2w1l6 && t2h1dwt5 < t2h1u6 && t2h1dwt5 < t2h1d6 && t2h1dwt5 < t2w1rwt6 && t2h1dwt5 < t2w1lwt6 && t2h1dwt5 < t2h1uwt6 && t2h1dwt5 < t2h1dwt6
  && t2h1dwt5 < t2w1r7 && t2h1dwt5 < t2w1l7 && t2h1dwt5 < t2h1u7 && t2h1dwt5 < t2h1d7 && t2h1dwt5 < t2w1rwt7 && t2h1dwt5 < t2w1lwt7 && t2h1dwt5 < t2h1uwt7 && t2h1dwt5 < t2h1dwt7 
  && t2h1dwt5 < t2w1r8 && t2h1dwt5 < t2w1l8 && t2h1dwt5 < t2h1u8 && t2h1dwt5 < t2h1d8 && t2h1dwt5 < t2w1rwt8 && t2h1dwt5 < t2w1lwt8 && t2h1dwt5 < t2h1uwt8 && t2h1dwt5 < t2h1dwt8
  && t2h1dwt5 < t2w1r9 && t2h1dwt5 < t2w1l9 && t2h1dwt5 < t2h1u9 && t2h1dwt5 < t2h1d9 && t2h1dwt5 < t2w1rwt9 && t2h1dwt5 < t2w1lwt9 && t2h1dwt5 < t2h1uwt9 && t2h1dwt5 < t2h1dwt9 
  && t2h1dwt5 < t2w1r10 && t2h1dwt5 < t2w1l10 && t2h1dwt5 < t2h1u10 && t2h1dwt5 < t2h1d10 && t2h1dwt5 < t2w1rwt10 && t2h1dwt5 < t2w1lwt10 && t2h1dwt5 < t2h1uwt10 && t2h1dwt5 < t2h1dwt10
  && ((louthd5 !=0 && linhd5==0) || (louthd5 ==0 && linhd5!=0))){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1dwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1dwt5+z))*(z0wr5+(vz*t2h1dwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
     xlimitl=(w2l5-w1l5)/l*(vz*t2h1dwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1dwt5+z))*(z0wl5+(vz*t2h1dwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1dwt5+x;
  ytest=vy*t2w1lwt5+y;
  ylimitd=-sqrt((pbhdwt5-(vz*t2h1dwt5+z))/pahdwt5);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW5>0 ){
  i=232;
  }else{
  i=237;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW5!=-1 && t2h1dwt5 > 0 && t2h1dwt5 < t1 
  && t2h1dwt5 < t2w1r && t2h1dwt5 < t2w1l && t2h1dwt5 < t2h1u && t2h1dwt5 < t2h1d && t2h1dwt5 < t2w1rwt && t2h1dwt5 < t2w1lwt && t2h1dwt5 < t2h1uwt && t2h1dwt5 < t2h1dwt 
  && t2h1dwt5 < t2w1r1 && t2h1dwt5 < t2w1l1 && t2h1dwt5 < t2h1u1 && t2h1dwt5 < t2h1d1 && t2h1dwt5 < t2w1rwt1 && t2h1dwt5 < t2w1lwt1 && t2h1dwt5 < t2h1uwt1 && t2h1dwt5 < t2h1dwt1
  && t2h1dwt5 < t2w1r2 && t2h1dwt5 < t2w1l2 && t2h1dwt5 < t2h1u2 && t2h1dwt5 < t2h1d2 && t2h1dwt5 < t2w1rwt2 && t2h1dwt5 < t2w1lwt2 && t2h1dwt5 < t2h1uwt2 && t2h1dwt5 < t2h1dwt2 
  && t2h1dwt5 < t2w1r3 && t2h1dwt5 < t2w1l3 && t2h1dwt5 < t2h1u3 && t2h1dwt5 < t2h1d3 && t2h1dwt5 < t2w1rwt3 && t2h1dwt5 < t2w1lwt3 && t2h1dwt5 < t2h1uwt3 && t2h1dwt5 < t2h1dwt3
  && t2h1dwt5 < t2w1r4 && t2h1dwt5 < t2w1l4 && t2h1dwt5 < t2h1u4 && t2h1dwt5 < t2h1d4 && t2h1dwt5 < t2w1rwt4 && t2h1dwt5 < t2w1lwt4 && t2h1dwt5 < t2h1uwt4 && t2h1dwt5 < t2h1dwt4
  && t2h1dwt5 < t2w1r5 && t2h1dwt5 < t2w1l5 && t2h1dwt5 < t2h1u5 && t2h1dwt5 < t2h1d5 && t2h1dwt5 < t2w1rwt5 && t2h1dwt5 < t2w1lwt5 && t2h1dwt5 < t2h1uwt5 
  && t2h1dwt5 < t2w1r6 && t2h1dwt5 < t2w1l6 && t2h1dwt5 < t2h1u6 && t2h1dwt5 < t2h1d6 && t2h1dwt5 < t2w1rwt6 && t2h1dwt5 < t2w1lwt6 && t2h1dwt5 < t2h1uwt6 && t2h1dwt5 < t2h1dwt6
  && t2h1dwt5 < t2w1r7 && t2h1dwt5 < t2w1l7 && t2h1dwt5 < t2h1u7 && t2h1dwt5 < t2h1d7 && t2h1dwt5 < t2w1rwt7 && t2h1dwt5 < t2w1lwt7 && t2h1dwt5 < t2h1uwt7 && t2h1dwt5 < t2h1dwt7 
  && t2h1dwt5 < t2w1r8 && t2h1dwt5 < t2w1l8 && t2h1dwt5 < t2h1u8 && t2h1dwt5 < t2h1d8 && t2h1dwt5 < t2w1rwt8 && t2h1dwt5 < t2w1lwt8 && t2h1dwt5 < t2h1uwt8 && t2h1dwt5 < t2h1dwt8
  && t2h1dwt5 < t2w1r9 && t2h1dwt5 < t2w1l9 && t2h1dwt5 < t2h1u9 && t2h1dwt5 < t2h1d9 && t2h1dwt5 < t2w1rwt9 && t2h1dwt5 < t2w1lwt9 && t2h1dwt5 < t2h1uwt9 && t2h1dwt5 < t2h1dwt9 
  && t2h1dwt5 < t2w1r10 && t2h1dwt5 < t2w1l10 && t2h1dwt5 < t2h1u10 && t2h1dwt5 < t2h1d10 && t2h1dwt5 < t2w1rwt10 && t2h1dwt5 < t2w1lwt10 && t2h1dwt5 < t2h1uwt10 && t2h1dwt5 < t2h1dwt10
  && (louthd5 == 0 && linhd5 == 0)){
  if(linwr5==0 && loutwr5==0)
  {
    xlimitr=(-w2r5+w1r5)/l*(vz*t2h1dwt5+z)-w1rwt5;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xlimitr=-bwrwt5*sqrt(1-((z0wr5+(vz*t2h1dwt5+z))*(z0wr5+(vz*t2h1dwt5+z)))/a2wrwt5);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt5+z)-pbwrwt5)/-pawrwt5);
    }
  }
  if(linwl5==0 && loutwl5 == 0)
   {
      xlimitl=(w2l5-w1l5)/l*(vz*t2h1dwt5+z)+w1lwt5;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xlimitl=bwlwt5*sqrt(1-((z0wl5+(vz*t2h1dwt5+z))*(z0wl5+(vz*t2h1dwt5+z)))/a2wlwt5);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt5+z)-pbwlwt5)/-pawlwt5);
      }
   }
  xtest=vx*t2h1dwt5+x;
  ytest=vy*t2w1lwt5+y;
  ylimitd=(-h2d5+h1d5)*(vz*t2h1dwt5+z)/l-h1dwt5;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW5>0 ){
  i=233;
  }else{
  i=237;
  }
  }


  if (mxrOW5==-1 && t2w1rwt5 > 0 && t2w1rwt5 < t1 
  && t2w1rwt5 < t2w1r && t2w1rwt5 < t2w1l && t2w1rwt5 < t2h1u && t2w1rwt5 < t2h1d && t2w1rwt5 <t2w1rwt && t2w1rwt5 <t2w1lwt && t2w1rwt5 < t2h1uwt && t2w1rwt5 < t2h1dwt
  && t2w1rwt5 < t2w1r1 && t2w1rwt5 < t2w1l1 && t2w1rwt5 < t2h1u1 && t2w1rwt5 < t2h1d1 && t2w1rwt5 <t2w1rwt1 && t2w1rwt5 <t2w1lwt1 && t2w1rwt5 < t2h1uwt1 && t2w1rwt5 < t2h1dwt1
  && t2w1rwt5 < t2w1r2 && t2w1rwt5 < t2w1l2 && t2w1rwt5 < t2h1u2 && t2w1rwt5 < t2h1d2 && t2w1rwt5 <t2w1rwt2 && t2w1rwt5 <t2w1lwt2 && t2w1rwt5 < t2h1uwt2 && t2w1rwt5 < t2h1dwt2
  && t2w1rwt5 < t2w1r3 && t2w1rwt5 < t2w1l3 && t2w1rwt5 < t2h1u3 && t2w1rwt5 < t2h1d3 && t2w1rwt5 <t2w1rwt3 && t2w1rwt5 <t2w1lwt3 && t2w1rwt5 < t2h1uwt3 && t2w1rwt5 < t2h1dwt3
  && t2w1rwt5 < t2w1r4 && t2w1rwt5 < t2w1l4 && t2w1rwt5 < t2h1u4 && t2w1rwt5 < t2h1d4 && t2w1rwt5 <t2w1rwt4 && t2w1rwt5 <t2w1lwt4 && t2w1rwt5 < t2h1uwt4 && t2w1rwt5 < t2h1dwt4
  && t2w1rwt5 < t2w1r5 && t2w1rwt5 < t2w1l5 && t2w1rwt5 < t2h1u5 && t2w1rwt5 < t2h1d5 && t2w1rwt5 <t2w1lwt5 && t2w1rwt5 < t2h1uwt5 && t2w1rwt5 < t2h1dwt5
  && t2w1rwt5 < t2w1r6 && t2w1rwt5 < t2w1l6 && t2w1rwt5 < t2h1u6 && t2w1rwt5 < t2h1d6 && t2w1rwt5 <t2w1rwt6 && t2w1rwt5 <t2w1lwt6 && t2w1rwt5 < t2h1uwt6 && t2w1rwt5 < t2h1dwt6
  && t2w1rwt5 < t2w1r7 && t2w1rwt5 < t2w1l7 && t2w1rwt5 < t2h1u7 && t2w1rwt5 < t2h1d7 && t2w1rwt5 <t2w1rwt7 && t2w1rwt5 <t2w1lwt7 && t2w1rwt5 < t2h1uwt7 && t2w1rwt5 < t2h1dwt7
  && t2w1rwt5 < t2w1r8 && t2w1rwt5 < t2w1l8 && t2w1rwt5 < t2h1u8 && t2w1rwt5 < t2h1d8 && t2w1rwt5 <t2w1rwt8 && t2w1rwt5 <t2w1lwt8 && t2w1rwt5 < t2h1uwt8 && t2w1rwt5 < t2h1dwt8
  && t2w1rwt5 < t2w1r9 && t2w1rwt5 < t2w1l9 && t2w1rwt5 < t2h1u9 && t2w1rwt5 < t2h1d9 && t2w1rwt5 <t2w1rwt9 && t2w1rwt5 <t2w1lwt9 && t2w1rwt5 < t2h1uwt9 && t2w1rwt5 < t2h1dwt9
  && t2w1rwt5 < t2w1r10 && t2w1rwt5 < t2w1l10 && t2w1rwt5 < t2h1u10 && t2w1rwt5 < t2h1d10 && t2w1rwt5 <t2w1rwt10 && t2w1rwt5 <t2w1lwt10 && t2w1rwt5 < t2h1uwt10 && t2w1rwt5 < t2h1dwt10
  && ((linwr5!=0) && (loutwr5!=0) )){
  i=238;
  }

  if (mxrOW5==-1 && t2w1rwt5 > 0 && t2w1rwt5 < t1 
  && t2w1rwt5 < t2w1r && t2w1rwt5 < t2w1l && t2w1rwt5 < t2h1u && t2w1rwt5 < t2h1d && t2w1rwt5 <t2w1rwt && t2w1rwt5 <t2w1lwt && t2w1rwt5 < t2h1uwt && t2w1rwt5 < t2h1dwt
  && t2w1rwt5 < t2w1r1 && t2w1rwt5 < t2w1l1 && t2w1rwt5 < t2h1u1 && t2w1rwt5 < t2h1d1 && t2w1rwt5 <t2w1rwt1 && t2w1rwt5 <t2w1lwt1 && t2w1rwt5 < t2h1uwt1 && t2w1rwt5 < t2h1dwt1
  && t2w1rwt5 < t2w1r2 && t2w1rwt5 < t2w1l2 && t2w1rwt5 < t2h1u2 && t2w1rwt5 < t2h1d2 && t2w1rwt5 <t2w1rwt2 && t2w1rwt5 <t2w1lwt2 && t2w1rwt5 < t2h1uwt2 && t2w1rwt5 < t2h1dwt2
  && t2w1rwt5 < t2w1r3 && t2w1rwt5 < t2w1l3 && t2w1rwt5 < t2h1u3 && t2w1rwt5 < t2h1d3 && t2w1rwt5 <t2w1rwt3 && t2w1rwt5 <t2w1lwt3 && t2w1rwt5 < t2h1uwt3 && t2w1rwt5 < t2h1dwt3
  && t2w1rwt5 < t2w1r4 && t2w1rwt5 < t2w1l4 && t2w1rwt5 < t2h1u4 && t2w1rwt5 < t2h1d4 && t2w1rwt5 <t2w1rwt4 && t2w1rwt5 <t2w1lwt4 && t2w1rwt5 < t2h1uwt4 && t2w1rwt5 < t2h1dwt4
  && t2w1rwt5 < t2w1r5 && t2w1rwt5 < t2w1l5 && t2w1rwt5 < t2h1u5 && t2w1rwt5 < t2h1d5 && t2w1rwt5 <t2w1lwt5 && t2w1rwt5 < t2h1uwt5 && t2w1rwt5 < t2h1dwt5
  && t2w1rwt5 < t2w1r6 && t2w1rwt5 < t2w1l6 && t2w1rwt5 < t2h1u6 && t2w1rwt5 < t2h1d6 && t2w1rwt5 <t2w1rwt6 && t2w1rwt5 <t2w1lwt6 && t2w1rwt5 < t2h1uwt6 && t2w1rwt5 < t2h1dwt6
  && t2w1rwt5 < t2w1r7 && t2w1rwt5 < t2w1l7 && t2w1rwt5 < t2h1u7 && t2w1rwt5 < t2h1d7 && t2w1rwt5 <t2w1rwt7 && t2w1rwt5 <t2w1lwt7 && t2w1rwt5 < t2h1uwt7 && t2w1rwt5 < t2h1dwt7
  && t2w1rwt5 < t2w1r8 && t2w1rwt5 < t2w1l8 && t2w1rwt5 < t2h1u8 && t2w1rwt5 < t2h1d8 && t2w1rwt5 <t2w1rwt8 && t2w1rwt5 <t2w1lwt8 && t2w1rwt5 < t2h1uwt8 && t2w1rwt5 < t2h1dwt8
  && t2w1rwt5 < t2w1r9 && t2w1rwt5 < t2w1l9 && t2w1rwt5 < t2h1u9 && t2w1rwt5 < t2h1d9 && t2w1rwt5 <t2w1rwt9 && t2w1rwt5 <t2w1lwt9 && t2w1rwt5 < t2h1uwt9 && t2w1rwt5 < t2h1dwt9
  && t2w1rwt5 < t2w1r10 && t2w1rwt5 < t2w1l10 && t2w1rwt5 < t2h1u10 && t2w1rwt5 < t2h1d10 && t2w1rwt5 <t2w1rwt10 && t2w1rwt5 <t2w1lwt10 && t2w1rwt5 < t2h1uwt10 && t2w1rwt5 < t2h1dwt10
  && ((loutwr5!=0 && linwr5==0) || (loutwr5==0 && linwr5!=0))){
  i=238;
  }

  if (mxrOW5==-1 && t2w1rwt5 > 0 && t2w1rwt5 < t1 
  && t2w1rwt5 < t2w1r && t2w1rwt5 < t2w1l && t2w1rwt5 < t2h1u && t2w1rwt5 < t2h1d && t2w1rwt5 <t2w1rwt && t2w1rwt5 <t2w1lwt && t2w1rwt5 < t2h1uwt && t2w1rwt5 < t2h1dwt
  && t2w1rwt5 < t2w1r1 && t2w1rwt5 < t2w1l1 && t2w1rwt5 < t2h1u1 && t2w1rwt5 < t2h1d1 && t2w1rwt5 <t2w1rwt1 && t2w1rwt5 <t2w1lwt1 && t2w1rwt5 < t2h1uwt1 && t2w1rwt5 < t2h1dwt1
  && t2w1rwt5 < t2w1r2 && t2w1rwt5 < t2w1l2 && t2w1rwt5 < t2h1u2 && t2w1rwt5 < t2h1d2 && t2w1rwt5 <t2w1rwt2 && t2w1rwt5 <t2w1lwt2 && t2w1rwt5 < t2h1uwt2 && t2w1rwt5 < t2h1dwt2
  && t2w1rwt5 < t2w1r3 && t2w1rwt5 < t2w1l3 && t2w1rwt5 < t2h1u3 && t2w1rwt5 < t2h1d3 && t2w1rwt5 <t2w1rwt3 && t2w1rwt5 <t2w1lwt3 && t2w1rwt5 < t2h1uwt3 && t2w1rwt5 < t2h1dwt3
  && t2w1rwt5 < t2w1r4 && t2w1rwt5 < t2w1l4 && t2w1rwt5 < t2h1u4 && t2w1rwt5 < t2h1d4 && t2w1rwt5 <t2w1rwt4 && t2w1rwt5 <t2w1lwt4 && t2w1rwt5 < t2h1uwt4 && t2w1rwt5 < t2h1dwt4
  && t2w1rwt5 < t2w1r5 && t2w1rwt5 < t2w1l5 && t2w1rwt5 < t2h1u5 && t2w1rwt5 < t2h1d5 && t2w1rwt5 <t2w1lwt5 && t2w1rwt5 < t2h1uwt5 && t2w1rwt5 < t2h1dwt5
  && t2w1rwt5 < t2w1r6 && t2w1rwt5 < t2w1l6 && t2w1rwt5 < t2h1u6 && t2w1rwt5 < t2h1d6 && t2w1rwt5 <t2w1rwt6 && t2w1rwt5 <t2w1lwt6 && t2w1rwt5 < t2h1uwt6 && t2w1rwt5 < t2h1dwt6
  && t2w1rwt5 < t2w1r7 && t2w1rwt5 < t2w1l7 && t2w1rwt5 < t2h1u7 && t2w1rwt5 < t2h1d7 && t2w1rwt5 <t2w1rwt7 && t2w1rwt5 <t2w1lwt7 && t2w1rwt5 < t2h1uwt7 && t2w1rwt5 < t2h1dwt7
  && t2w1rwt5 < t2w1r8 && t2w1rwt5 < t2w1l8 && t2w1rwt5 < t2h1u8 && t2w1rwt5 < t2h1d8 && t2w1rwt5 <t2w1rwt8 && t2w1rwt5 <t2w1lwt8 && t2w1rwt5 < t2h1uwt8 && t2w1rwt5 < t2h1dwt8
  && t2w1rwt5 < t2w1r9 && t2w1rwt5 < t2w1l9 && t2w1rwt5 < t2h1u9 && t2w1rwt5 < t2h1d9 && t2w1rwt5 <t2w1rwt9 && t2w1rwt5 <t2w1lwt9 && t2w1rwt5 < t2h1uwt9 && t2w1rwt5 < t2h1dwt9
  && t2w1rwt5 < t2w1r10 && t2w1rwt5 < t2w1l10 && t2w1rwt5 < t2h1u10 && t2w1rwt5 < t2h1d10 && t2w1rwt5 <t2w1rwt10 && t2w1rwt5 <t2w1lwt10 && t2w1rwt5 < t2h1uwt10 && t2w1rwt5 < t2h1dwt10
  && (loutwr5==0 && linwr5==0)){
  i=238;
  }

  if (mxlOW5==-1 && t2w1lwt5 > 0 && t2w1lwt5 < t1 
  && t2w1lwt5 < t2w1r && t2w1lwt5 < t2w1l && t2w1lwt5 < t2h1u && t2w1lwt5 < t2h1d && t2w1lwt5 <t2w1rwt && t2w1lwt5 <t2w1lwt && t2w1lwt5 < t2h1uwt && t2w1lwt5 < t2h1dwt
  && t2w1lwt5 < t2w1r1 && t2w1lwt5 < t2w1l1 && t2w1lwt5 < t2h1u1 && t2w1lwt5 < t2h1d1 && t2w1lwt5 <t2w1rwt1 && t2w1lwt5 <t2w1lwt1 && t2w1lwt5 < t2h1uwt1 && t2w1lwt5 < t2h1dwt1
  && t2w1lwt5 < t2w1r2 && t2w1lwt5 < t2w1l2 && t2w1lwt5 < t2h1u2 && t2w1lwt5 < t2h1d2 && t2w1lwt5 <t2w1rwt2 && t2w1lwt5 <t2w1lwt2 && t2w1lwt5 < t2h1uwt2 && t2w1lwt5 < t2h1dwt2
  && t2w1lwt5 < t2w1r3 && t2w1lwt5 < t2w1l3 && t2w1lwt5 < t2h1u3 && t2w1lwt5 < t2h1d3 && t2w1lwt5 <t2w1rwt3 && t2w1lwt5 <t2w1lwt3 && t2w1lwt5 < t2h1uwt3 && t2w1lwt5 < t2h1dwt3
  && t2w1lwt5 < t2w1r4 && t2w1lwt5 < t2w1l4 && t2w1lwt5 < t2h1u4 && t2w1lwt5 < t2h1d4 && t2w1lwt5 <t2w1rwt4 && t2w1lwt5 <t2w1lwt4 && t2w1lwt5 < t2h1uwt4 && t2w1lwt5 < t2h1dwt4
  && t2w1lwt5 < t2w1r5 && t2w1lwt5 < t2w1l5 && t2w1lwt5 < t2h1u5 && t2w1lwt5 < t2h1d5 && t2w1lwt5 <t2w1rwt5 && t2w1lwt5 < t2h1uwt5 && t2w1lwt5 < t2h1dwt5
  && t2w1lwt5 < t2w1r6 && t2w1lwt5 < t2w1l6 && t2w1lwt5 < t2h1u6 && t2w1lwt5 < t2h1d6 && t2w1lwt5 <t2w1rwt6 && t2w1lwt5 <t2w1lwt6 && t2w1lwt5 < t2h1uwt6 && t2w1lwt5 < t2h1dwt6
  && t2w1lwt5 < t2w1r7 && t2w1lwt5 < t2w1l7 && t2w1lwt5 < t2h1u7 && t2w1lwt5 < t2h1d7 && t2w1lwt5 <t2w1rwt7 && t2w1lwt5 <t2w1lwt7 && t2w1lwt5 < t2h1uwt7 && t2w1lwt5 < t2h1dwt7
  && t2w1lwt5 < t2w1r8 && t2w1lwt5 < t2w1l8 && t2w1lwt5 < t2h1u8 && t2w1lwt5 < t2h1d8 && t2w1lwt5 <t2w1rwt8 && t2w1lwt5 <t2w1lwt8 && t2w1lwt5 < t2h1uwt8 && t2w1lwt5 < t2h1dwt8
  && t2w1lwt5 < t2w1r9 && t2w1lwt5 < t2w1l9 && t2w1lwt5 < t2h1u9 && t2w1lwt5 < t2h1d9 && t2w1lwt5 <t2w1rwt9 && t2w1lwt5 <t2w1lwt9 && t2w1lwt5 < t2h1uwt9 && t2w1lwt5 < t2h1dwt9
  && t2w1lwt5 < t2w1r10 && t2w1lwt5 < t2w1l10 && t2w1lwt5 < t2h1u10 && t2w1lwt5 < t2h1d10 && t2w1lwt5 <t2w1rwt10 && t2w1lwt5 <t2w1lwt10 && t2w1lwt5 < t2h1uwt10 && t2w1lwt5 < t2h1dwt10
  && ((linwl5!=0) && (loutwl5!=0) )){
  i=239;
  }

  if (mxlOW5==-1 && t2w1lwt5 > 0 && t2w1lwt5 < t1 
  && t2w1lwt5 < t2w1r && t2w1lwt5 < t2w1l && t2w1lwt5 < t2h1u && t2w1lwt5 < t2h1d && t2w1lwt5 <t2w1rwt && t2w1lwt5 <t2w1lwt && t2w1lwt5 < t2h1uwt && t2w1lwt5 < t2h1dwt
  && t2w1lwt5 < t2w1r1 && t2w1lwt5 < t2w1l1 && t2w1lwt5 < t2h1u1 && t2w1lwt5 < t2h1d1 && t2w1lwt5 <t2w1rwt1 && t2w1lwt5 <t2w1lwt1 && t2w1lwt5 < t2h1uwt1 && t2w1lwt5 < t2h1dwt1
  && t2w1lwt5 < t2w1r2 && t2w1lwt5 < t2w1l2 && t2w1lwt5 < t2h1u2 && t2w1lwt5 < t2h1d2 && t2w1lwt5 <t2w1rwt2 && t2w1lwt5 <t2w1lwt2 && t2w1lwt5 < t2h1uwt2 && t2w1lwt5 < t2h1dwt2
  && t2w1lwt5 < t2w1r3 && t2w1lwt5 < t2w1l3 && t2w1lwt5 < t2h1u3 && t2w1lwt5 < t2h1d3 && t2w1lwt5 <t2w1rwt3 && t2w1lwt5 <t2w1lwt3 && t2w1lwt5 < t2h1uwt3 && t2w1lwt5 < t2h1dwt3
  && t2w1lwt5 < t2w1r4 && t2w1lwt5 < t2w1l4 && t2w1lwt5 < t2h1u4 && t2w1lwt5 < t2h1d4 && t2w1lwt5 <t2w1rwt4 && t2w1lwt5 <t2w1lwt4 && t2w1lwt5 < t2h1uwt4 && t2w1lwt5 < t2h1dwt4
  && t2w1lwt5 < t2w1r5 && t2w1lwt5 < t2w1l5 && t2w1lwt5 < t2h1u5 && t2w1lwt5 < t2h1d5 && t2w1lwt5 <t2w1rwt5 && t2w1lwt5 < t2h1uwt5 && t2w1lwt5 < t2h1dwt5
  && t2w1lwt5 < t2w1r6 && t2w1lwt5 < t2w1l6 && t2w1lwt5 < t2h1u6 && t2w1lwt5 < t2h1d6 && t2w1lwt5 <t2w1rwt6 && t2w1lwt5 <t2w1lwt6 && t2w1lwt5 < t2h1uwt6 && t2w1lwt5 < t2h1dwt6
  && t2w1lwt5 < t2w1r7 && t2w1lwt5 < t2w1l7 && t2w1lwt5 < t2h1u7 && t2w1lwt5 < t2h1d7 && t2w1lwt5 <t2w1rwt7 && t2w1lwt5 <t2w1lwt7 && t2w1lwt5 < t2h1uwt7 && t2w1lwt5 < t2h1dwt7
  && t2w1lwt5 < t2w1r8 && t2w1lwt5 < t2w1l8 && t2w1lwt5 < t2h1u8 && t2w1lwt5 < t2h1d8 && t2w1lwt5 <t2w1rwt8 && t2w1lwt5 <t2w1lwt8 && t2w1lwt5 < t2h1uwt8 && t2w1lwt5 < t2h1dwt8
  && t2w1lwt5 < t2w1r9 && t2w1lwt5 < t2w1l9 && t2w1lwt5 < t2h1u9 && t2w1lwt5 < t2h1d9 && t2w1lwt5 <t2w1rwt9 && t2w1lwt5 <t2w1lwt9 && t2w1lwt5 < t2h1uwt9 && t2w1lwt5 < t2h1dwt9
  && t2w1lwt5 < t2w1r10 && t2w1lwt5 < t2w1l10 && t2w1lwt5 < t2h1u10 && t2w1lwt5 < t2h1d10 && t2w1lwt5 <t2w1rwt10 && t2w1lwt5 <t2w1lwt10 && t2w1lwt5 < t2h1uwt10 && t2w1lwt5 < t2h1dwt10
  && ((loutwl5!=0 && linwl5==0) || (loutwl5==0 && linwl5!=0))){
  i=239;
  }

  if (mxlOW5==-1 && t2w1lwt5 > 0 && t2w1lwt5 < t1 
  && t2w1lwt5 < t2w1r && t2w1lwt5 < t2w1l && t2w1lwt5 < t2h1u && t2w1lwt5 < t2h1d && t2w1lwt5 <t2w1rwt && t2w1lwt5 <t2w1lwt && t2w1lwt5 < t2h1uwt && t2w1lwt5 < t2h1dwt
  && t2w1lwt5 < t2w1r1 && t2w1lwt5 < t2w1l1 && t2w1lwt5 < t2h1u1 && t2w1lwt5 < t2h1d1 && t2w1lwt5 <t2w1rwt1 && t2w1lwt5 <t2w1lwt1 && t2w1lwt5 < t2h1uwt1 && t2w1lwt5 < t2h1dwt1
  && t2w1lwt5 < t2w1r2 && t2w1lwt5 < t2w1l2 && t2w1lwt5 < t2h1u2 && t2w1lwt5 < t2h1d2 && t2w1lwt5 <t2w1rwt2 && t2w1lwt5 <t2w1lwt2 && t2w1lwt5 < t2h1uwt2 && t2w1lwt5 < t2h1dwt2
  && t2w1lwt5 < t2w1r3 && t2w1lwt5 < t2w1l3 && t2w1lwt5 < t2h1u3 && t2w1lwt5 < t2h1d3 && t2w1lwt5 <t2w1rwt3 && t2w1lwt5 <t2w1lwt3 && t2w1lwt5 < t2h1uwt3 && t2w1lwt5 < t2h1dwt3
  && t2w1lwt5 < t2w1r4 && t2w1lwt5 < t2w1l4 && t2w1lwt5 < t2h1u4 && t2w1lwt5 < t2h1d4 && t2w1lwt5 <t2w1rwt4 && t2w1lwt5 <t2w1lwt4 && t2w1lwt5 < t2h1uwt4 && t2w1lwt5 < t2h1dwt4
  && t2w1lwt5 < t2w1r5 && t2w1lwt5 < t2w1l5 && t2w1lwt5 < t2h1u5 && t2w1lwt5 < t2h1d5 && t2w1lwt5 <t2w1rwt5 && t2w1lwt5 < t2h1uwt5 && t2w1lwt5 < t2h1dwt5
  && t2w1lwt5 < t2w1r6 && t2w1lwt5 < t2w1l6 && t2w1lwt5 < t2h1u6 && t2w1lwt5 < t2h1d6 && t2w1lwt5 <t2w1rwt6 && t2w1lwt5 <t2w1lwt6 && t2w1lwt5 < t2h1uwt6 && t2w1lwt5 < t2h1dwt6
  && t2w1lwt5 < t2w1r7 && t2w1lwt5 < t2w1l7 && t2w1lwt5 < t2h1u7 && t2w1lwt5 < t2h1d7 && t2w1lwt5 <t2w1rwt7 && t2w1lwt5 <t2w1lwt7 && t2w1lwt5 < t2h1uwt7 && t2w1lwt5 < t2h1dwt7
  && t2w1lwt5 < t2w1r8 && t2w1lwt5 < t2w1l8 && t2w1lwt5 < t2h1u8 && t2w1lwt5 < t2h1d8 && t2w1lwt5 <t2w1rwt8 && t2w1lwt5 <t2w1lwt8 && t2w1lwt5 < t2h1uwt8 && t2w1lwt5 < t2h1dwt8
  && t2w1lwt5 < t2w1r9 && t2w1lwt5 < t2w1l9 && t2w1lwt5 < t2h1u9 && t2w1lwt5 < t2h1d9 && t2w1lwt5 <t2w1rwt9 && t2w1lwt5 <t2w1lwt9 && t2w1lwt5 < t2h1uwt9 && t2w1lwt5 < t2h1dwt9
  && t2w1lwt5 < t2w1r10 && t2w1lwt5 < t2w1l10 && t2w1lwt5 < t2h1u10 && t2w1lwt5 < t2h1d10 && t2w1lwt5 <t2w1rwt10 && t2w1lwt5 <t2w1lwt10 && t2w1lwt5 < t2h1uwt10 && t2w1lwt5 < t2h1dwt10
  && (loutwl5==0 && linwl5==0)){
  i=239;}

  if (myuOW5==-1 && t2h1uwt5 > 0 && t2h1uwt5 < t1 
  && t2h1uwt5 < t2w1r && t2h1uwt5 < t2w1l && t2h1uwt5 < t2h1u && t2h1uwt5 < t2h1d && t2h1uwt5 < t2w1rwt && t2h1uwt5 < t2w1lwt && t2h1uwt5 < t2h1uwt && t2h1uwt5 < t2h1dwt 
  && t2h1uwt5 < t2w1r1 && t2h1uwt5 < t2w1l1 && t2h1uwt5 < t2h1u1 && t2h1uwt5 < t2h1d1 && t2h1uwt5 < t2w1rwt1 && t2h1uwt5 < t2w1lwt1 && t2h1uwt5 < t2h1uwt1 && t2h1uwt5 < t2h1dwt1
  && t2h1uwt5 < t2w1r2 && t2h1uwt5 < t2w1l2 && t2h1uwt5 < t2h1u2 && t2h1uwt5 < t2h1d2 && t2h1uwt5 < t2w1rwt2 && t2h1uwt5 < t2w1lwt2 && t2h1uwt5 < t2h1uwt2 && t2h1uwt5 < t2h1dwt2
  && t2h1uwt5 < t2w1r3 && t2h1uwt5 < t2w1l3 && t2h1uwt5 < t2h1u3 && t2h1uwt5 < t2h1d3 && t2h1uwt5 < t2w1rwt3 && t2h1uwt5 < t2w1lwt3 && t2h1uwt5 < t2h1uwt3 && t2h1uwt5 < t2h1dwt3
  && t2h1uwt5 < t2w1r4 && t2h1uwt5 < t2w1l4 && t2h1uwt5 < t2h1u4 && t2h1uwt5 < t2h1d4 && t2h1uwt5 < t2w1rwt4 && t2h1uwt5 < t2w1lwt4 && t2h1uwt5 < t2h1uwt4 && t2h1uwt5 < t2h1dwt4
  && t2h1uwt5 < t2w1r5 && t2h1uwt5 < t2w1l5 && t2h1uwt5 < t2h1u5 && t2h1uwt5 < t2h1d5 && t2h1uwt5 < t2w1rwt5 && t2h1uwt5 < t2w1lwt5 && t2h1uwt5 < t2h1dwt5
  && t2h1uwt5 < t2w1r6 && t2h1uwt5 < t2w1l6 && t2h1uwt5 < t2h1u6 && t2h1uwt5 < t2h1d6 && t2h1uwt5 < t2w1rwt6 && t2h1uwt5 < t2w1lwt6 && t2h1uwt5 < t2h1uwt6 && t2h1uwt5 < t2h1dwt6
  && t2h1uwt5 < t2w1r7 && t2h1uwt5 < t2w1l7 && t2h1uwt5 < t2h1u7 && t2h1uwt5 < t2h1d7 && t2h1uwt5 < t2w1rwt7 && t2h1uwt5 < t2w1lwt7 && t2h1uwt5 < t2h1uwt7 && t2h1uwt5 < t2h1dwt7
  && t2h1uwt5 < t2w1r8 && t2h1uwt5 < t2w1l8 && t2h1uwt5 < t2h1u8 && t2h1uwt5 < t2h1d8 && t2h1uwt5 < t2w1rwt8 && t2h1uwt5 < t2w1lwt8 && t2h1uwt5 < t2h1uwt8 && t2h1uwt5 < t2h1dwt8
  && t2h1uwt5 < t2w1r9 && t2h1uwt5 < t2w1l9 && t2h1uwt5 < t2h1u9 && t2h1uwt5 < t2h1d9 && t2h1uwt5 < t2w1rwt9 && t2h1uwt5 < t2w1lwt9 && t2h1uwt5 < t2h1uwt9 && t2h1uwt5 < t2h1dwt9
  && t2h1uwt5 < t2w1r10 && t2h1uwt5 < t2w1l10 && t2h1uwt5 < t2h1u10 && t2h1uwt5 < t2h1d10 && t2h1uwt5 < t2w1rwt10 && t2h1uwt5 < t2w1lwt10 && t2h1uwt5 < t2h1uwt10 && t2h1uwt5 < t2h1dwt10
  && (louthu5 !=0 && linhu5!=0)){
  i=240;
  }

  if (myuOW5==-1 && t2h1uwt5 > 0 && t2h1uwt5 < t1 
  && t2h1uwt5 < t2w1r && t2h1uwt5 < t2w1l && t2h1uwt5 < t2h1u && t2h1uwt5 < t2h1d && t2h1uwt5 < t2w1rwt && t2h1uwt5 < t2w1lwt && t2h1uwt5 < t2h1uwt && t2h1uwt5 < t2h1dwt 
  && t2h1uwt5 < t2w1r1 && t2h1uwt5 < t2w1l1 && t2h1uwt5 < t2h1u1 && t2h1uwt5 < t2h1d1 && t2h1uwt5 < t2w1rwt1 && t2h1uwt5 < t2w1lwt1 && t2h1uwt5 < t2h1uwt1 && t2h1uwt5 < t2h1dwt1
  && t2h1uwt5 < t2w1r2 && t2h1uwt5 < t2w1l2 && t2h1uwt5 < t2h1u2 && t2h1uwt5 < t2h1d2 && t2h1uwt5 < t2w1rwt2 && t2h1uwt5 < t2w1lwt2 && t2h1uwt5 < t2h1uwt2 && t2h1uwt5 < t2h1dwt2
  && t2h1uwt5 < t2w1r3 && t2h1uwt5 < t2w1l3 && t2h1uwt5 < t2h1u3 && t2h1uwt5 < t2h1d3 && t2h1uwt5 < t2w1rwt3 && t2h1uwt5 < t2w1lwt3 && t2h1uwt5 < t2h1uwt3 && t2h1uwt5 < t2h1dwt3
  && t2h1uwt5 < t2w1r4 && t2h1uwt5 < t2w1l4 && t2h1uwt5 < t2h1u4 && t2h1uwt5 < t2h1d4 && t2h1uwt5 < t2w1rwt4 && t2h1uwt5 < t2w1lwt4 && t2h1uwt5 < t2h1uwt4 && t2h1uwt5 < t2h1dwt4
  && t2h1uwt5 < t2w1r5 && t2h1uwt5 < t2w1l5 && t2h1uwt5 < t2h1u5 && t2h1uwt5 < t2h1d5 && t2h1uwt5 < t2w1rwt5 && t2h1uwt5 < t2w1lwt5 && t2h1uwt5 < t2h1dwt5
  && t2h1uwt5 < t2w1r6 && t2h1uwt5 < t2w1l6 && t2h1uwt5 < t2h1u6 && t2h1uwt5 < t2h1d6 && t2h1uwt5 < t2w1rwt6 && t2h1uwt5 < t2w1lwt6 && t2h1uwt5 < t2h1uwt6 && t2h1uwt5 < t2h1dwt6
  && t2h1uwt5 < t2w1r7 && t2h1uwt5 < t2w1l7 && t2h1uwt5 < t2h1u7 && t2h1uwt5 < t2h1d7 && t2h1uwt5 < t2w1rwt7 && t2h1uwt5 < t2w1lwt7 && t2h1uwt5 < t2h1uwt7 && t2h1uwt5 < t2h1dwt7
  && t2h1uwt5 < t2w1r8 && t2h1uwt5 < t2w1l8 && t2h1uwt5 < t2h1u8 && t2h1uwt5 < t2h1d8 && t2h1uwt5 < t2w1rwt8 && t2h1uwt5 < t2w1lwt8 && t2h1uwt5 < t2h1uwt8 && t2h1uwt5 < t2h1dwt8
  && t2h1uwt5 < t2w1r9 && t2h1uwt5 < t2w1l9 && t2h1uwt5 < t2h1u9 && t2h1uwt5 < t2h1d9 && t2h1uwt5 < t2w1rwt9 && t2h1uwt5 < t2w1lwt9 && t2h1uwt5 < t2h1uwt9 && t2h1uwt5 < t2h1dwt9
  && t2h1uwt5 < t2w1r10 && t2h1uwt5 < t2w1l10 && t2h1uwt5 < t2h1u10 && t2h1uwt5 < t2h1d10 && t2h1uwt5 < t2w1rwt10 && t2h1uwt5 < t2w1lwt10 && t2h1uwt5 < t2h1uwt10 && t2h1uwt5 < t2h1dwt10
  && ((louthu5!=0 && linhu5==0) || (louthu5==0 && linhu5!=0))){
  i=240;
  }

  if (myuOW5==-1 && t2h1uwt5 > 0 && t2h1uwt5 < t1 
  && t2h1uwt5 < t2w1r && t2h1uwt5 < t2w1l && t2h1uwt5 < t2h1u && t2h1uwt5 < t2h1d && t2h1uwt5 < t2w1rwt && t2h1uwt5 < t2w1lwt && t2h1uwt5 < t2h1uwt && t2h1uwt5 < t2h1dwt 
  && t2h1uwt5 < t2w1r1 && t2h1uwt5 < t2w1l1 && t2h1uwt5 < t2h1u1 && t2h1uwt5 < t2h1d1 && t2h1uwt5 < t2w1rwt1 && t2h1uwt5 < t2w1lwt1 && t2h1uwt5 < t2h1uwt1 && t2h1uwt5 < t2h1dwt1
  && t2h1uwt5 < t2w1r2 && t2h1uwt5 < t2w1l2 && t2h1uwt5 < t2h1u2 && t2h1uwt5 < t2h1d2 && t2h1uwt5 < t2w1rwt2 && t2h1uwt5 < t2w1lwt2 && t2h1uwt5 < t2h1uwt2 && t2h1uwt5 < t2h1dwt2
  && t2h1uwt5 < t2w1r3 && t2h1uwt5 < t2w1l3 && t2h1uwt5 < t2h1u3 && t2h1uwt5 < t2h1d3 && t2h1uwt5 < t2w1rwt3 && t2h1uwt5 < t2w1lwt3 && t2h1uwt5 < t2h1uwt3 && t2h1uwt5 < t2h1dwt3
  && t2h1uwt5 < t2w1r4 && t2h1uwt5 < t2w1l4 && t2h1uwt5 < t2h1u4 && t2h1uwt5 < t2h1d4 && t2h1uwt5 < t2w1rwt4 && t2h1uwt5 < t2w1lwt4 && t2h1uwt5 < t2h1uwt4 && t2h1uwt5 < t2h1dwt4
  && t2h1uwt5 < t2w1r5 && t2h1uwt5 < t2w1l5 && t2h1uwt5 < t2h1u5 && t2h1uwt5 < t2h1d5 && t2h1uwt5 < t2w1rwt5 && t2h1uwt5 < t2w1lwt5 && t2h1uwt5 < t2h1dwt5
  && t2h1uwt5 < t2w1r6 && t2h1uwt5 < t2w1l6 && t2h1uwt5 < t2h1u6 && t2h1uwt5 < t2h1d6 && t2h1uwt5 < t2w1rwt6 && t2h1uwt5 < t2w1lwt6 && t2h1uwt5 < t2h1uwt6 && t2h1uwt5 < t2h1dwt6
  && t2h1uwt5 < t2w1r7 && t2h1uwt5 < t2w1l7 && t2h1uwt5 < t2h1u7 && t2h1uwt5 < t2h1d7 && t2h1uwt5 < t2w1rwt7 && t2h1uwt5 < t2w1lwt7 && t2h1uwt5 < t2h1uwt7 && t2h1uwt5 < t2h1dwt7
  && t2h1uwt5 < t2w1r8 && t2h1uwt5 < t2w1l8 && t2h1uwt5 < t2h1u8 && t2h1uwt5 < t2h1d8 && t2h1uwt5 < t2w1rwt8 && t2h1uwt5 < t2w1lwt8 && t2h1uwt5 < t2h1uwt8 && t2h1uwt5 < t2h1dwt8
  && t2h1uwt5 < t2w1r9 && t2h1uwt5 < t2w1l9 && t2h1uwt5 < t2h1u9 && t2h1uwt5 < t2h1d9 && t2h1uwt5 < t2w1rwt9 && t2h1uwt5 < t2w1lwt9 && t2h1uwt5 < t2h1uwt9 && t2h1uwt5 < t2h1dwt9
  && t2h1uwt5 < t2w1r10 && t2h1uwt5 < t2w1l10 && t2h1uwt5 < t2h1u10 && t2h1uwt5 < t2h1d10 && t2h1uwt5 < t2w1rwt10 && t2h1uwt5 < t2w1lwt10 && t2h1uwt5 < t2h1uwt10 && t2h1uwt5 < t2h1dwt10
  && (louthu5 == 0 && linhu5 == 0)){
  i=240;
  }

  if (mydOW5==-1 && t2h1dwt5 > 0 && t2h1dwt5 < t1 
  && t2h1dwt5 < t2w1r && t2h1dwt5 < t2w1l && t2h1dwt5 < t2h1u && t2h1dwt5 < t2h1d && t2h1dwt5 < t2w1rwt && t2h1dwt5 < t2w1lwt && t2h1dwt5 < t2h1uwt && t2h1dwt5 < t2h1dwt 
  && t2h1dwt5 < t2w1r1 && t2h1dwt5 < t2w1l1 && t2h1dwt5 < t2h1u1 && t2h1dwt5 < t2h1d1 && t2h1dwt5 < t2w1rwt1 && t2h1dwt5 < t2w1lwt1 && t2h1dwt5 < t2h1uwt1 && t2h1dwt5 < t2h1dwt1
  && t2h1dwt5 < t2w1r2 && t2h1dwt5 < t2w1l2 && t2h1dwt5 < t2h1u2 && t2h1dwt5 < t2h1d2 && t2h1dwt5 < t2w1rwt2 && t2h1dwt5 < t2w1lwt2 && t2h1dwt5 < t2h1uwt2 && t2h1dwt5 < t2h1dwt2 
  && t2h1dwt5 < t2w1r3 && t2h1dwt5 < t2w1l3 && t2h1dwt5 < t2h1u3 && t2h1dwt5 < t2h1d3 && t2h1dwt5 < t2w1rwt3 && t2h1dwt5 < t2w1lwt3 && t2h1dwt5 < t2h1uwt3 && t2h1dwt5 < t2h1dwt3
  && t2h1dwt5 < t2w1r4 && t2h1dwt5 < t2w1l4 && t2h1dwt5 < t2h1u4 && t2h1dwt5 < t2h1d4 && t2h1dwt5 < t2w1rwt4 && t2h1dwt5 < t2w1lwt4 && t2h1dwt5 < t2h1uwt4 && t2h1dwt5 < t2h1dwt4
  && t2h1dwt5 < t2w1r5 && t2h1dwt5 < t2w1l5 && t2h1dwt5 < t2h1u5 && t2h1dwt5 < t2h1d5 && t2h1dwt5 < t2w1rwt5 && t2h1dwt5 < t2w1lwt5 && t2h1dwt5 < t2h1uwt5 
  && t2h1dwt5 < t2w1r6 && t2h1dwt5 < t2w1l6 && t2h1dwt5 < t2h1u6 && t2h1dwt5 < t2h1d6 && t2h1dwt5 < t2w1rwt6 && t2h1dwt5 < t2w1lwt6 && t2h1dwt5 < t2h1uwt6 && t2h1dwt5 < t2h1dwt6
  && t2h1dwt5 < t2w1r7 && t2h1dwt5 < t2w1l7 && t2h1dwt5 < t2h1u7 && t2h1dwt5 < t2h1d7 && t2h1dwt5 < t2w1rwt7 && t2h1dwt5 < t2w1lwt7 && t2h1dwt5 < t2h1uwt7 && t2h1dwt5 < t2h1dwt7 
  && t2h1dwt5 < t2w1r8 && t2h1dwt5 < t2w1l8 && t2h1dwt5 < t2h1u8 && t2h1dwt5 < t2h1d8 && t2h1dwt5 < t2w1rwt8 && t2h1dwt5 < t2w1lwt8 && t2h1dwt5 < t2h1uwt8 && t2h1dwt5 < t2h1dwt8
  && t2h1dwt5 < t2w1r9 && t2h1dwt5 < t2w1l9 && t2h1dwt5 < t2h1u9 && t2h1dwt5 < t2h1d9 && t2h1dwt5 < t2w1rwt9 && t2h1dwt5 < t2w1lwt9 && t2h1dwt5 < t2h1uwt9 && t2h1dwt5 < t2h1dwt9 
  && t2h1dwt5 < t2w1r10 && t2h1dwt5 < t2w1l10 && t2h1dwt5 < t2h1u10 && t2h1dwt5 < t2h1d10 && t2h1dwt5 < t2w1rwt10 && t2h1dwt5 < t2w1lwt10 && t2h1dwt5 < t2h1uwt10 && t2h1dwt5 < t2h1dwt10  
  && (louthd5 !=0 && linhd5!=0)){
  i=241;
  }

  if (mydOW5==-1 && t2h1dwt5 > 0 && t2h1dwt5 < t1 
  && t2h1dwt5 < t2w1r && t2h1dwt5 < t2w1l && t2h1dwt5 < t2h1u && t2h1dwt5 < t2h1d && t2h1dwt5 < t2w1rwt && t2h1dwt5 < t2w1lwt && t2h1dwt5 < t2h1uwt && t2h1dwt5 < t2h1dwt 
  && t2h1dwt5 < t2w1r1 && t2h1dwt5 < t2w1l1 && t2h1dwt5 < t2h1u1 && t2h1dwt5 < t2h1d1 && t2h1dwt5 < t2w1rwt1 && t2h1dwt5 < t2w1lwt1 && t2h1dwt5 < t2h1uwt1 && t2h1dwt5 < t2h1dwt1
  && t2h1dwt5 < t2w1r2 && t2h1dwt5 < t2w1l2 && t2h1dwt5 < t2h1u2 && t2h1dwt5 < t2h1d2 && t2h1dwt5 < t2w1rwt2 && t2h1dwt5 < t2w1lwt2 && t2h1dwt5 < t2h1uwt2 && t2h1dwt5 < t2h1dwt2 
  && t2h1dwt5 < t2w1r3 && t2h1dwt5 < t2w1l3 && t2h1dwt5 < t2h1u3 && t2h1dwt5 < t2h1d3 && t2h1dwt5 < t2w1rwt3 && t2h1dwt5 < t2w1lwt3 && t2h1dwt5 < t2h1uwt3 && t2h1dwt5 < t2h1dwt3
  && t2h1dwt5 < t2w1r4 && t2h1dwt5 < t2w1l4 && t2h1dwt5 < t2h1u4 && t2h1dwt5 < t2h1d4 && t2h1dwt5 < t2w1rwt4 && t2h1dwt5 < t2w1lwt4 && t2h1dwt5 < t2h1uwt4 && t2h1dwt5 < t2h1dwt4
  && t2h1dwt5 < t2w1r5 && t2h1dwt5 < t2w1l5 && t2h1dwt5 < t2h1u5 && t2h1dwt5 < t2h1d5 && t2h1dwt5 < t2w1rwt5 && t2h1dwt5 < t2w1lwt5 && t2h1dwt5 < t2h1uwt5 
  && t2h1dwt5 < t2w1r6 && t2h1dwt5 < t2w1l6 && t2h1dwt5 < t2h1u6 && t2h1dwt5 < t2h1d6 && t2h1dwt5 < t2w1rwt6 && t2h1dwt5 < t2w1lwt6 && t2h1dwt5 < t2h1uwt6 && t2h1dwt5 < t2h1dwt6
  && t2h1dwt5 < t2w1r7 && t2h1dwt5 < t2w1l7 && t2h1dwt5 < t2h1u7 && t2h1dwt5 < t2h1d7 && t2h1dwt5 < t2w1rwt7 && t2h1dwt5 < t2w1lwt7 && t2h1dwt5 < t2h1uwt7 && t2h1dwt5 < t2h1dwt7 
  && t2h1dwt5 < t2w1r8 && t2h1dwt5 < t2w1l8 && t2h1dwt5 < t2h1u8 && t2h1dwt5 < t2h1d8 && t2h1dwt5 < t2w1rwt8 && t2h1dwt5 < t2w1lwt8 && t2h1dwt5 < t2h1uwt8 && t2h1dwt5 < t2h1dwt8
  && t2h1dwt5 < t2w1r9 && t2h1dwt5 < t2w1l9 && t2h1dwt5 < t2h1u9 && t2h1dwt5 < t2h1d9 && t2h1dwt5 < t2w1rwt9 && t2h1dwt5 < t2w1lwt9 && t2h1dwt5 < t2h1uwt9 && t2h1dwt5 < t2h1dwt9 
  && t2h1dwt5 < t2w1r10 && t2h1dwt5 < t2w1l10 && t2h1dwt5 < t2h1u10 && t2h1dwt5 < t2h1d10 && t2h1dwt5 < t2w1rwt10 && t2h1dwt5 < t2w1lwt10 && t2h1dwt5 < t2h1uwt10 && t2h1dwt5 < t2h1dwt10
  && ((louthd5 !=0 && linhd5==0) || (louthd5 ==0 && linhd5!=0))){
  i=241;
  }

  if (mydOW5==-1 && t2h1dwt5 > 0 && t2h1dwt5 < t1 
  && t2h1dwt5 < t2w1r && t2h1dwt5 < t2w1l && t2h1dwt5 < t2h1u && t2h1dwt5 < t2h1d && t2h1dwt5 < t2w1rwt && t2h1dwt5 < t2w1lwt && t2h1dwt5 < t2h1uwt && t2h1dwt5 < t2h1dwt 
  && t2h1dwt5 < t2w1r1 && t2h1dwt5 < t2w1l1 && t2h1dwt5 < t2h1u1 && t2h1dwt5 < t2h1d1 && t2h1dwt5 < t2w1rwt1 && t2h1dwt5 < t2w1lwt1 && t2h1dwt5 < t2h1uwt1 && t2h1dwt5 < t2h1dwt1
  && t2h1dwt5 < t2w1r2 && t2h1dwt5 < t2w1l2 && t2h1dwt5 < t2h1u2 && t2h1dwt5 < t2h1d2 && t2h1dwt5 < t2w1rwt2 && t2h1dwt5 < t2w1lwt2 && t2h1dwt5 < t2h1uwt2 && t2h1dwt5 < t2h1dwt2 
  && t2h1dwt5 < t2w1r3 && t2h1dwt5 < t2w1l3 && t2h1dwt5 < t2h1u3 && t2h1dwt5 < t2h1d3 && t2h1dwt5 < t2w1rwt3 && t2h1dwt5 < t2w1lwt3 && t2h1dwt5 < t2h1uwt3 && t2h1dwt5 < t2h1dwt3
  && t2h1dwt5 < t2w1r4 && t2h1dwt5 < t2w1l4 && t2h1dwt5 < t2h1u4 && t2h1dwt5 < t2h1d4 && t2h1dwt5 < t2w1rwt4 && t2h1dwt5 < t2w1lwt4 && t2h1dwt5 < t2h1uwt4 && t2h1dwt5 < t2h1dwt4
  && t2h1dwt5 < t2w1r5 && t2h1dwt5 < t2w1l5 && t2h1dwt5 < t2h1u5 && t2h1dwt5 < t2h1d5 && t2h1dwt5 < t2w1rwt5 && t2h1dwt5 < t2w1lwt5 && t2h1dwt5 < t2h1uwt5 
  && t2h1dwt5 < t2w1r6 && t2h1dwt5 < t2w1l6 && t2h1dwt5 < t2h1u6 && t2h1dwt5 < t2h1d6 && t2h1dwt5 < t2w1rwt6 && t2h1dwt5 < t2w1lwt6 && t2h1dwt5 < t2h1uwt6 && t2h1dwt5 < t2h1dwt6
  && t2h1dwt5 < t2w1r7 && t2h1dwt5 < t2w1l7 && t2h1dwt5 < t2h1u7 && t2h1dwt5 < t2h1d7 && t2h1dwt5 < t2w1rwt7 && t2h1dwt5 < t2w1lwt7 && t2h1dwt5 < t2h1uwt7 && t2h1dwt5 < t2h1dwt7 
  && t2h1dwt5 < t2w1r8 && t2h1dwt5 < t2w1l8 && t2h1dwt5 < t2h1u8 && t2h1dwt5 < t2h1d8 && t2h1dwt5 < t2w1rwt8 && t2h1dwt5 < t2w1lwt8 && t2h1dwt5 < t2h1uwt8 && t2h1dwt5 < t2h1dwt8
  && t2h1dwt5 < t2w1r9 && t2h1dwt5 < t2w1l9 && t2h1dwt5 < t2h1u9 && t2h1dwt5 < t2h1d9 && t2h1dwt5 < t2w1rwt9 && t2h1dwt5 < t2w1lwt9 && t2h1dwt5 < t2h1uwt9 && t2h1dwt5 < t2h1dwt9 
  && t2h1dwt5 < t2w1r10 && t2h1dwt5 < t2w1l10 && t2h1dwt5 < t2h1u10 && t2h1dwt5 < t2h1d10 && t2h1dwt5 < t2w1rwt10 && t2h1dwt5 < t2w1lwt10 && t2h1dwt5 < t2h1uwt10 && t2h1dwt5 < t2h1dwt10
  && (louthd5 == 0 && linhd5 == 0)){ 
  i=241;
  }


  if (mxr6!=-1 && t2w1r6 > 0 && t2w1r6 < t1 
     && t2w1r6 < t2w1r && t2w1r6 < t2w1l && t2w1r6 < t2h1u && t2w1r6 < t2h1d && t2w1r6 < t2w1rwt && t2w1r6 < t2w1lwt && t2w1r6 < t2h1uwt && t2w1r6 < t2h1dwt
     && t2w1r6 < t2w1r1 && t2w1r6 < t2w1l1 && t2w1r6 < t2h1u1 && t2w1r6 < t2h1d1 && t2w1r6 < t2w1rwt1 && t2w1r6 < t2w1lwt1 && t2w1r6 < t2h1uwt1 && t2w1r6 < t2h1dwt1
     && t2w1r6 < t2w1r2 && t2w1r6 < t2w1l2 && t2w1r6 < t2h1u2 && t2w1r6 < t2h1d2 && t2w1r6 < t2w1rwt2 && t2w1r6 < t2w1lwt2 && t2w1r6 < t2h1uwt2 && t2w1r6 < t2h1dwt2 
     && t2w1r6 < t2w1r3 && t2w1r6 < t2w1l3 && t2w1r6 < t2h1u3 && t2w1r6 < t2h1d3 && t2w1r6 < t2w1rwt3 && t2w1r6 < t2w1lwt3 && t2w1r6 < t2h1uwt3 && t2w1r6 < t2h1dwt3
     && t2w1r6 < t2w1r4 && t2w1r6 < t2w1l4 && t2w1r6 < t2h1u4 && t2w1r6 < t2h1d4 && t2w1r6 < t2w1rwt4 && t2w1r6 < t2w1lwt4 && t2w1r6 < t2h1uwt4 && t2w1r6 < t2h1dwt4
     && t2w1r6 < t2w1r5 && t2w1r6 < t2w1l5 && t2w1r6 < t2h1u5 && t2w1r6 < t2h1d5 && t2w1r6 < t2w1rwt5 && t2w1r6 < t2w1lwt5 && t2w1r6 < t2h1uwt5 && t2w1r6 < t2h1dwt5
     && t2w1r6 < t2w1l6 && t2w1r6 < t2h1u6 && t2w1r6 < t2h1d6 && t2w1r6 < t2w1rwt6 && t2w1r6 < t2w1lwt6 && t2w1r6 < t2h1uwt6 && t2w1r6 < t2h1dwt6
     && t2w1r6 < t2w1r7 && t2w1r6 < t2w1l7 && t2w1r6 < t2h1u7 && t2w1r6 < t2h1d7 && t2w1r6 < t2w1rwt7 && t2w1r6 < t2w1lwt7 && t2w1r6 < t2h1uwt7 && t2w1r6 < t2h1dwt7
     && t2w1r6 < t2w1r8 && t2w1r6 < t2w1l8 && t2w1r6 < t2h1u8 && t2w1r6 < t2h1d8 && t2w1r6 < t2w1rwt8 && t2w1r6 < t2w1lwt8 && t2w1r6 < t2h1uwt8 && t2w1r6 < t2h1dwt8
     && t2w1r6 < t2w1r9 && t2w1r6 < t2w1l9 && t2w1r6 < t2h1u9 && t2w1r6 < t2h1d9 && t2w1r6 < t2w1rwt9 && t2w1r6 < t2w1lwt9 && t2w1r6 < t2h1uwt9 && t2w1r6 < t2h1dwt9
     && t2w1r6 < t2w1r10 && t2w1r6 < t2w1l10 && t2w1r6 < t2h1u10 && t2w1r6 < t2h1d10 && t2w1r6 < t2w1rwt10 && t2w1r6 < t2w1lwt10 && t2w1r6 < t2h1uwt10 && t2w1r6 < t2h1dwt10
     && ((linwr6!=0) && (loutwr6!=0) )) {	
    if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1r6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1r6+z))*(z0hd6+(vz*t2w1r6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1r6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1r6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1r6+z))*(z0hu6+(vz*t2w1r6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1r6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1r6+y;
  xlimitr=bwr6*sqrt(1-((vz*t2w1r6+z)+z0wr6)*((vz*t2w1r6+z)+z0wr6)/a2wr6);
  xtest=vx*t2w1r6+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr6 > 0){
  i=242;
  }else{
  i=258;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr6!=-1 && t2w1r6 > 0 && t2w1r6 < t1 
     && t2w1r6 < t2w1r && t2w1r6 < t2w1l && t2w1r6 < t2h1u && t2w1r6 < t2h1d && t2w1r6 < t2w1rwt && t2w1r6 < t2w1lwt && t2w1r6 < t2h1uwt && t2w1r6 < t2h1dwt
     && t2w1r6 < t2w1r1 && t2w1r6 < t2w1l1 && t2w1r6 < t2h1u1 && t2w1r6 < t2h1d1 && t2w1r6 < t2w1rwt1 && t2w1r6 < t2w1lwt1 && t2w1r6 < t2h1uwt1 && t2w1r6 < t2h1dwt1
     && t2w1r6 < t2w1r2 && t2w1r6 < t2w1l2 && t2w1r6 < t2h1u2 && t2w1r6 < t2h1d2 && t2w1r6 < t2w1rwt2 && t2w1r6 < t2w1lwt2 && t2w1r6 < t2h1uwt2 && t2w1r6 < t2h1dwt2 
     && t2w1r6 < t2w1r3 && t2w1r6 < t2w1l3 && t2w1r6 < t2h1u3 && t2w1r6 < t2h1d3 && t2w1r6 < t2w1rwt3 && t2w1r6 < t2w1lwt3 && t2w1r6 < t2h1uwt3 && t2w1r6 < t2h1dwt3
     && t2w1r6 < t2w1r4 && t2w1r6 < t2w1l4 && t2w1r6 < t2h1u4 && t2w1r6 < t2h1d4 && t2w1r6 < t2w1rwt4 && t2w1r6 < t2w1lwt4 && t2w1r6 < t2h1uwt4 && t2w1r6 < t2h1dwt4
     && t2w1r6 < t2w1r5 && t2w1r6 < t2w1l5 && t2w1r6 < t2h1u5 && t2w1r6 < t2h1d5 && t2w1r6 < t2w1rwt5 && t2w1r6 < t2w1lwt5 && t2w1r6 < t2h1uwt5 && t2w1r6 < t2h1dwt5
     && t2w1r6 < t2w1l6 && t2w1r6 < t2h1u6 && t2w1r6 < t2h1d6 && t2w1r6 < t2w1rwt6 && t2w1r6 < t2w1lwt6 && t2w1r6 < t2h1uwt6 && t2w1r6 < t2h1dwt6
     && t2w1r6 < t2w1r7 && t2w1r6 < t2w1l7 && t2w1r6 < t2h1u7 && t2w1r6 < t2h1d7 && t2w1r6 < t2w1rwt7 && t2w1r6 < t2w1lwt7 && t2w1r6 < t2h1uwt7 && t2w1r6 < t2h1dwt7
     && t2w1r6 < t2w1r8 && t2w1r6 < t2w1l8 && t2w1r6 < t2h1u8 && t2w1r6 < t2h1d8 && t2w1r6 < t2w1rwt8 && t2w1r6 < t2w1lwt8 && t2w1r6 < t2h1uwt8 && t2w1r6 < t2h1dwt8
     && t2w1r6 < t2w1r9 && t2w1r6 < t2w1l9 && t2w1r6 < t2h1u9 && t2w1r6 < t2h1d9 && t2w1r6 < t2w1rwt9 && t2w1r6 < t2w1lwt9 && t2w1r6 < t2h1uwt9 && t2w1r6 < t2h1dwt9
     && t2w1r6 < t2w1r10 && t2w1r6 < t2w1l10 && t2w1r6 < t2h1u10 && t2w1r6 < t2h1d10 && t2w1r6 < t2w1rwt10 && t2w1r6 < t2w1lwt10 && t2w1r6 < t2h1uwt10 && t2w1r6 < t2h1dwt10
     && ((loutwr6!=0 && linwr6==0) || (loutwr6==0 && linwr6!=0))){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1r6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1r6+z))*(z0hd6+(vz*t2w1r6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1r6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1r6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1r6+z))*(z0hu6+(vz*t2w1r6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1r6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1r6+y;
  xtest=vx*t2w1r6+x;
  xlimitr=-sqrt(pbwr6-(vz*t2w1r6+z)/pawr6);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr6 > 0){
  i=243;
  }else{
  i=258;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr6!=-1 && t2w1r6 > 0 && t2w1r6 < t1 
     && t2w1r6 < t2w1r && t2w1r6 < t2w1l && t2w1r6 < t2h1u && t2w1r6 < t2h1d && t2w1r6 < t2w1rwt && t2w1r6 < t2w1lwt && t2w1r6 < t2h1uwt && t2w1r6 < t2h1dwt
     && t2w1r6 < t2w1r1 && t2w1r6 < t2w1l1 && t2w1r6 < t2h1u1 && t2w1r6 < t2h1d1 && t2w1r6 < t2w1rwt1 && t2w1r6 < t2w1lwt1 && t2w1r6 < t2h1uwt1 && t2w1r6 < t2h1dwt1
     && t2w1r6 < t2w1r2 && t2w1r6 < t2w1l2 && t2w1r6 < t2h1u2 && t2w1r6 < t2h1d2 && t2w1r6 < t2w1rwt2 && t2w1r6 < t2w1lwt2 && t2w1r6 < t2h1uwt2 && t2w1r6 < t2h1dwt2 
     && t2w1r6 < t2w1r3 && t2w1r6 < t2w1l3 && t2w1r6 < t2h1u3 && t2w1r6 < t2h1d3 && t2w1r6 < t2w1rwt3 && t2w1r6 < t2w1lwt3 && t2w1r6 < t2h1uwt3 && t2w1r6 < t2h1dwt3
     && t2w1r6 < t2w1r4 && t2w1r6 < t2w1l4 && t2w1r6 < t2h1u4 && t2w1r6 < t2h1d4 && t2w1r6 < t2w1rwt4 && t2w1r6 < t2w1lwt4 && t2w1r6 < t2h1uwt4 && t2w1r6 < t2h1dwt4
     && t2w1r6 < t2w1r5 && t2w1r6 < t2w1l5 && t2w1r6 < t2h1u5 && t2w1r6 < t2h1d5 && t2w1r6 < t2w1rwt5 && t2w1r6 < t2w1lwt5 && t2w1r6 < t2h1uwt5 && t2w1r6 < t2h1dwt5
     && t2w1r6 < t2w1l6 && t2w1r6 < t2h1u6 && t2w1r6 < t2h1d6 && t2w1r6 < t2w1rwt6 && t2w1r6 < t2w1lwt6 && t2w1r6 < t2h1uwt6 && t2w1r6 < t2h1dwt6
     && t2w1r6 < t2w1r7 && t2w1r6 < t2w1l7 && t2w1r6 < t2h1u7 && t2w1r6 < t2h1d7 && t2w1r6 < t2w1rwt7 && t2w1r6 < t2w1lwt7 && t2w1r6 < t2h1uwt7 && t2w1r6 < t2h1dwt7
     && t2w1r6 < t2w1r8 && t2w1r6 < t2w1l8 && t2w1r6 < t2h1u8 && t2w1r6 < t2h1d8 && t2w1r6 < t2w1rwt8 && t2w1r6 < t2w1lwt8 && t2w1r6 < t2h1uwt8 && t2w1r6 < t2h1dwt8
     && t2w1r6 < t2w1r9 && t2w1r6 < t2w1l9 && t2w1r6 < t2h1u9 && t2w1r6 < t2h1d9 && t2w1r6 < t2w1rwt9 && t2w1r6 < t2w1lwt9 && t2w1r6 < t2h1uwt9 && t2w1r6 < t2h1dwt9
     && t2w1r6 < t2w1r10 && t2w1r6 < t2w1l10 && t2w1r6 < t2h1u10 && t2w1r6 < t2h1d10 && t2w1r6 < t2w1rwt10 && t2w1r6 < t2w1lwt10 && t2w1r6 < t2h1uwt10 && t2w1r6 < t2h1dwt10
     && (loutwr6==0 && linwr6==0)){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1r6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1r6+z))*(z0hd6+(vz*t2w1r6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1r6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1r6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1r6+z))*(z0hu6+(vz*t2w1r6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1r6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1r6+y;
  xtest=vx*t2w1r6+x;
  xlimitr=-(w2r6+w1r6)*(vz*t2w1r6+z)/l-w1r6;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr6>0){
  i=244;
  }else{
  i=258;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl6!=-1 && t2w1l6 > 0 && t2w1l6 < t1 
      && t2w1l6 < t2w1r && t2w1l6 < t2w1l && t2w1l6 < t2h1u && t2w1l6 < t2h1d && t2w1l6 < t2w1rwt && t2w1l6 < t2w1lwt && t2w1l6 < t2h1uwt && t2w1l6 < t2h1dwt
      && t2w1l6 < t2w1r1 && t2w1l6 < t2w1l1 && t2w1l6 < t2h1u1 && t2w1l6 < t2h1d1 && t2w1l6 < t2w1rwt1 && t2w1l6 < t2w1lwt1 && t2w1l6 < t2h1uwt1 && t2w1l6 < t2h1dwt1
      && t2w1l6 < t2w1r2 && t2w1l6 < t2w1l2 && t2w1l6 < t2h1u2 && t2w1l6 < t2h1d2 && t2w1l6 < t2w1rwt2 && t2w1l6 < t2w1lwt2 && t2w1l6 < t2h1uwt2 && t2w1l6 < t2h1dwt2
      && t2w1l6 < t2w1r3 && t2w1l6 < t2w1l3 && t2w1l6 < t2h1u3 && t2w1l6 < t2h1d3 && t2w1l6 < t2w1rwt3 && t2w1l6 < t2w1lwt3 && t2w1l6 < t2h1uwt3 && t2w1l6 < t2h1dwt3
      && t2w1l6 < t2w1r4 && t2w1l6 < t2w1l4 && t2w1l6 < t2h1u4 && t2w1l6 < t2h1d4 && t2w1l6 < t2w1rwt4 && t2w1l6 < t2w1lwt4 && t2w1l6 < t2h1uwt4 && t2w1l6 < t2h1dwt4
      && t2w1l6 < t2w1r5 && t2w1l6 < t2w1l5 && t2w1l6 < t2h1u5 && t2w1l6 < t2h1d5 && t2w1l6 < t2w1rwt5 && t2w1l6 < t2w1lwt5 && t2w1l6 < t2h1uwt5 && t2w1l6 < t2h1dwt5
      && t2w1l6 < t2w1r6 && t2w1l6 < t2h1u6 && t2w1l6 < t2h1d6 && t2w1l6 < t2w1rwt6 && t2w1l6 < t2w1lwt6 && t2w1l6 < t2h1uwt6 && t2w1l6 < t2h1dwt6
      && t2w1l6 < t2w1r7 && t2w1l6 < t2w1l7 && t2w1l6 < t2h1u7 && t2w1l6 < t2h1d7 && t2w1l6 < t2w1rwt7 && t2w1l6 < t2w1lwt7 && t2w1l6 < t2h1uwt7 && t2w1l6 < t2h1dwt7
      && t2w1l6 < t2w1r8 && t2w1l6 < t2w1l8 && t2w1l6 < t2h1u8 && t2w1l6 < t2h1d8 && t2w1l6 < t2w1rwt8 && t2w1l6 < t2w1lwt8 && t2w1l6 < t2h1uwt8 && t2w1l6 < t2h1dwt8
      && t2w1l6 < t2w1r9 && t2w1l6 < t2w1l9 && t2w1l6 < t2h1u9 && t2w1l6 < t2h1d9 && t2w1l6 < t2w1rwt9 && t2w1l6 < t2w1lwt9 && t2w1l6 < t2h1uwt9 && t2w1l6 < t2h1dwt9
      && t2w1l6 < t2w1r10 && t2w1l6 < t2w1l10 && t2w1l6 < t2h1u10 && t2w1l6 < t2h1d10 && t2w1l6 < t2w1rwt10 && t2w1l6 < t2w1lwt10 && t2w1l6 < t2h1uwt10 && t2w1l6 < t2h1dwt10
      && ((linwl6!=0) && (loutwl6!=0) )){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1l6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1l6+z))*(z0hd6+(vz*t2w1l6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1l6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1l6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1l6+z))*(z0hu6+(vz*t2w1l6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1l6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1l6+y;
  xlimitl=bwl6*sqrt(1-((vz*t2w1l6+z)+z0wl6)*((vz*t2w1l6+z)+z0wl6)/a2wl6);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl6>0){
  i=245;
  }else{
  i=259;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl6!=-1 && t2w1l6 > 0 && t2w1l6 < t1 
      && t2w1l6 < t2w1r && t2w1l6 < t2w1l && t2w1l6 < t2h1u && t2w1l6 < t2h1d && t2w1l6 < t2w1rwt && t2w1l6 < t2w1lwt && t2w1l6 < t2h1uwt && t2w1l6 < t2h1dwt
      && t2w1l6 < t2w1r1 && t2w1l6 < t2w1l1 && t2w1l6 < t2h1u1 && t2w1l6 < t2h1d1 && t2w1l6 < t2w1rwt1 && t2w1l6 < t2w1lwt1 && t2w1l6 < t2h1uwt1 && t2w1l6 < t2h1dwt1
      && t2w1l6 < t2w1r2 && t2w1l6 < t2w1l2 && t2w1l6 < t2h1u2 && t2w1l6 < t2h1d2 && t2w1l6 < t2w1rwt2 && t2w1l6 < t2w1lwt2 && t2w1l6 < t2h1uwt2 && t2w1l6 < t2h1dwt2
      && t2w1l6 < t2w1r3 && t2w1l6 < t2w1l3 && t2w1l6 < t2h1u3 && t2w1l6 < t2h1d3 && t2w1l6 < t2w1rwt3 && t2w1l6 < t2w1lwt3 && t2w1l6 < t2h1uwt3 && t2w1l6 < t2h1dwt3
      && t2w1l6 < t2w1r4 && t2w1l6 < t2w1l4 && t2w1l6 < t2h1u4 && t2w1l6 < t2h1d4 && t2w1l6 < t2w1rwt4 && t2w1l6 < t2w1lwt4 && t2w1l6 < t2h1uwt4 && t2w1l6 < t2h1dwt4
      && t2w1l6 < t2w1r5 && t2w1l6 < t2w1l5 && t2w1l6 < t2h1u5 && t2w1l6 < t2h1d5 && t2w1l6 < t2w1rwt5 && t2w1l6 < t2w1lwt5 && t2w1l6 < t2h1uwt5 && t2w1l6 < t2h1dwt5
      && t2w1l6 < t2w1r6 && t2w1l6 < t2h1u6 && t2w1l6 < t2h1d6 && t2w1l6 < t2w1rwt6 && t2w1l6 < t2w1lwt6 && t2w1l6 < t2h1uwt6 && t2w1l6 < t2h1dwt6
      && t2w1l6 < t2w1r7 && t2w1l6 < t2w1l7 && t2w1l6 < t2h1u7 && t2w1l6 < t2h1d7 && t2w1l6 < t2w1rwt7 && t2w1l6 < t2w1lwt7 && t2w1l6 < t2h1uwt7 && t2w1l6 < t2h1dwt7
      && t2w1l6 < t2w1r8 && t2w1l6 < t2w1l8 && t2w1l6 < t2h1u8 && t2w1l6 < t2h1d8 && t2w1l6 < t2w1rwt8 && t2w1l6 < t2w1lwt8 && t2w1l6 < t2h1uwt8 && t2w1l6 < t2h1dwt8
      && t2w1l6 < t2w1r9 && t2w1l6 < t2w1l9 && t2w1l6 < t2h1u9 && t2w1l6 < t2h1d9 && t2w1l6 < t2w1rwt9 && t2w1l6 < t2w1lwt9 && t2w1l6 < t2h1uwt9 && t2w1l6 < t2h1dwt9
      && t2w1l6 < t2w1r10 && t2w1l6 < t2w1l10 && t2w1l6 < t2h1u10 && t2w1l6 < t2h1d10 && t2w1l6 < t2w1rwt10 && t2w1l6 < t2w1lwt10 && t2w1l6 < t2h1uwt10 && t2w1l6 < t2h1dwt10
      && ((loutwl6!=0 && linwl6==0) || (loutwl6==0 && linwl6!=0))){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1l6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1l6+z))*(z0hd6+(vz*t2w1l6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1l6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1l6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1l6+z))*(z0hu6+(vz*t2w1l6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1l6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1l6+y;
  xlimitl=sqrt(pbwl6-(vz*t2w1l6+z)/pawl6);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl6>0){
  i=246;
  }else{
  i=259;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl6!=-1 && t2w1l6 > 0 && t2w1l6 < t1 
      && t2w1l6 < t2w1r && t2w1l6 < t2w1l && t2w1l6 < t2h1u && t2w1l6 < t2h1d && t2w1l6 < t2w1rwt && t2w1l6 < t2w1lwt && t2w1l6 < t2h1uwt && t2w1l6 < t2h1dwt
      && t2w1l6 < t2w1r1 && t2w1l6 < t2w1l1 && t2w1l6 < t2h1u1 && t2w1l6 < t2h1d1 && t2w1l6 < t2w1rwt1 && t2w1l6 < t2w1lwt1 && t2w1l6 < t2h1uwt1 && t2w1l6 < t2h1dwt1
      && t2w1l6 < t2w1r2 && t2w1l6 < t2w1l2 && t2w1l6 < t2h1u2 && t2w1l6 < t2h1d2 && t2w1l6 < t2w1rwt2 && t2w1l6 < t2w1lwt2 && t2w1l6 < t2h1uwt2 && t2w1l6 < t2h1dwt2
      && t2w1l6 < t2w1r3 && t2w1l6 < t2w1l3 && t2w1l6 < t2h1u3 && t2w1l6 < t2h1d3 && t2w1l6 < t2w1rwt3 && t2w1l6 < t2w1lwt3 && t2w1l6 < t2h1uwt3 && t2w1l6 < t2h1dwt3
      && t2w1l6 < t2w1r4 && t2w1l6 < t2w1l4 && t2w1l6 < t2h1u4 && t2w1l6 < t2h1d4 && t2w1l6 < t2w1rwt4 && t2w1l6 < t2w1lwt4 && t2w1l6 < t2h1uwt4 && t2w1l6 < t2h1dwt4
      && t2w1l6 < t2w1r5 && t2w1l6 < t2w1l5 && t2w1l6 < t2h1u5 && t2w1l6 < t2h1d5 && t2w1l6 < t2w1rwt5 && t2w1l6 < t2w1lwt5 && t2w1l6 < t2h1uwt5 && t2w1l6 < t2h1dwt5
      && t2w1l6 < t2w1r6 && t2w1l6 < t2h1u6 && t2w1l6 < t2h1d6 && t2w1l6 < t2w1rwt6 && t2w1l6 < t2w1lwt6 && t2w1l6 < t2h1uwt6 && t2w1l6 < t2h1dwt6
      && t2w1l6 < t2w1r7 && t2w1l6 < t2w1l7 && t2w1l6 < t2h1u7 && t2w1l6 < t2h1d7 && t2w1l6 < t2w1rwt7 && t2w1l6 < t2w1lwt7 && t2w1l6 < t2h1uwt7 && t2w1l6 < t2h1dwt7
      && t2w1l6 < t2w1r8 && t2w1l6 < t2w1l8 && t2w1l6 < t2h1u8 && t2w1l6 < t2h1d8 && t2w1l6 < t2w1rwt8 && t2w1l6 < t2w1lwt8 && t2w1l6 < t2h1uwt8 && t2w1l6 < t2h1dwt8
      && t2w1l6 < t2w1r9 && t2w1l6 < t2w1l9 && t2w1l6 < t2h1u9 && t2w1l6 < t2h1d9 && t2w1l6 < t2w1rwt9 && t2w1l6 < t2w1lwt9 && t2w1l6 < t2h1uwt9 && t2w1l6 < t2h1dwt9
      && t2w1l6 < t2w1r10 && t2w1l6 < t2w1l10 && t2w1l6 < t2h1u10 && t2w1l6 < t2h1d10 && t2w1l6 < t2w1rwt10 && t2w1l6 < t2w1lwt10 && t2w1l6 < t2h1uwt10 && t2w1l6 < t2h1dwt10
      && (loutwl6==0 && linwl6==0)){
 if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1l6+z)-h1d6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhd6*sqrt(1-((z0hd6+(vz*t2w1l6+z))*(z0hd6+(vz*t2w1l6+z)))/a2hd6);
      }else{
      ylimitd=-sqrt(((vz*t2w1l6+z)-pbhd6)/-pahd6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1l6+z)+h1u6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhu6*sqrt(1-((z0hu6+(vz*t2w1l6+z))*(z0hu6+(vz*t2w1l6+z)))/a2hu6);
     }else{
     ylimitu=sqrt(((vz*t2w1l6+z)-pbhu6)/-pahu6);
    }
    }
  ytest=vy*t2w1l6+y;
  xlimitl=(w2l6-w1l6)*(vz*t2w1l6+z)/l+w1l6;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl6>0){
  i=247;
  }else{
  i=259;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu6!=-1 && t2h1u6 > 0 && t2h1u6 < t1 
  && t2h1u6 < t2w1r && t2h1u6 < t2w1l && t2h1u6 < t2h1u && t2h1u6 < t2h1d && t2h1u6 < t2w1rwt && t2h1u6 < t2w1lwt && t2h1u6 < t2h1uwt && t2h1u6 < t2h1dwt
  && t2h1u6 < t2w1r1 && t2h1u6 < t2w1l1 && t2h1u6 < t2h1u1 && t2h1u6 < t2h1d1 && t2h1u6 < t2w1rwt1 && t2h1u6 < t2w1lwt1 && t2h1u6 < t2h1uwt1 && t2h1u6 < t2h1dwt1
  && t2h1u6 < t2w1r2 && t2h1u6 < t2w1l2 && t2h1u6 < t2h1u2 && t2h1u6 < t2h1d2 && t2h1u6 < t2w1rwt2 && t2h1u6 < t2w1lwt2 && t2h1u6 < t2h1uwt2 && t2h1u6 < t2h1dwt2
  && t2h1u6 < t2w1r3 && t2h1u6 < t2w1l3 && t2h1u6 < t2h1u3 && t2h1u6 < t2h1d3 && t2h1u6 < t2w1rwt3 && t2h1u6 < t2w1lwt3 && t2h1u6 < t2h1uwt3 && t2h1u6 < t2h1dwt3
  && t2h1u6 < t2w1r4 && t2h1u6 < t2w1l4 && t2h1u6 < t2h1u4 && t2h1u6 < t2h1d4 && t2h1u6 < t2w1rwt4 && t2h1u6 < t2w1lwt4 && t2h1u6 < t2h1uwt4 && t2h1u6 < t2h1dwt4
  && t2h1u6 < t2w1r5 && t2h1u6 < t2w1l5 && t2h1u6 < t2h1u5 && t2h1u6 < t2h1d5 && t2h1u6 < t2w1rwt5 && t2h1u6 < t2w1lwt5 && t2h1u6 < t2h1uwt5 && t2h1u6 < t2h1dwt5
  && t2h1u6 < t2w1r6 && t2h1u6 < t2w1l6 && t2h1u6 < t2h1d6 && t2h1u6 < t2w1rwt6 && t2h1u6 < t2w1lwt6 && t2h1u6 < t2h1uwt6 && t2h1u6 < t2h1dwt6
  && t2h1u6 < t2w1r7 && t2h1u6 < t2w1l7 && t2h1u6 < t2h1u7 && t2h1u6 < t2h1d7 && t2h1u6 < t2w1rwt7 && t2h1u6 < t2w1lwt7 && t2h1u6 < t2h1uwt7 && t2h1u6 < t2h1dwt7
  && t2h1u6 < t2w1r8 && t2h1u6 < t2w1l8 && t2h1u6 < t2h1u8 && t2h1u6 < t2h1d8 && t2h1u6 < t2w1rwt8 && t2h1u6 < t2w1lwt8 && t2h1u6 < t2h1uwt8 && t2h1u6 < t2h1dwt8
  && t2h1u6 < t2w1r9 && t2h1u6 < t2w1l9 && t2h1u6 < t2h1u9 && t2h1u6 < t2h1d9 && t2h1u6 < t2w1rwt9 && t2h1u6 < t2w1lwt9 && t2h1u6 < t2h1uwt9 && t2h1u6 < t2h1dwt9
  && t2h1u6 < t2w1r10 && t2h1u6 < t2w1l10 && t2h1u6 < t2h1u10 && t2h1u6 < t2h1d10 && t2h1u6 < t2w1rwt10 && t2h1u6 < t2w1lwt10 && t2h1u6 < t2h1uwt10 && t2h1u6 < t2h1dwt10
  && (louthu6 !=0 && linhu6!=0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1u6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1u6+z))*(z0wr6+(vz*t2h1u6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1u6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1u6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1u6+z))*(z0wl6+(vz*t2h1u6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1u6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1u6+x;
  ylimitu=bhu6*sqrt(1-((vz*t2h1u6+z)+z0hu6)*((vz*t2h1u6+z)+z0hu6)/a2hu6);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu6>0 ){
  i=248;
  }else{
  i=260;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu6!=-1 && t2h1u6 > 0 && t2h1u6 < t1
  && t2h1u6 < t2w1r && t2h1u6 < t2w1l && t2h1u6 < t2h1u && t2h1u6 < t2h1d && t2h1u6 < t2w1rwt && t2h1u6 < t2w1lwt && t2h1u6 < t2h1uwt && t2h1u6 < t2h1dwt
  && t2h1u6 < t2w1r1 && t2h1u6 < t2w1l1 && t2h1u6 < t2h1u1 && t2h1u6 < t2h1d1 && t2h1u6 < t2w1rwt1 && t2h1u6 < t2w1lwt1 && t2h1u6 < t2h1uwt1 && t2h1u6 < t2h1dwt1
  && t2h1u6 < t2w1r2 && t2h1u6 < t2w1l2 && t2h1u6 < t2h1u2 && t2h1u6 < t2h1d2 && t2h1u6 < t2w1rwt2 && t2h1u6 < t2w1lwt2 && t2h1u6 < t2h1uwt2 && t2h1u6 < t2h1dwt2
  && t2h1u6 < t2w1r3 && t2h1u6 < t2w1l3 && t2h1u6 < t2h1u3 && t2h1u6 < t2h1d3 && t2h1u6 < t2w1rwt3 && t2h1u6 < t2w1lwt3 && t2h1u6 < t2h1uwt3 && t2h1u6 < t2h1dwt3
  && t2h1u6 < t2w1r4 && t2h1u6 < t2w1l4 && t2h1u6 < t2h1u4 && t2h1u6 < t2h1d4 && t2h1u6 < t2w1rwt4 && t2h1u6 < t2w1lwt4 && t2h1u6 < t2h1uwt4 && t2h1u6 < t2h1dwt4
  && t2h1u6 < t2w1r5 && t2h1u6 < t2w1l5 && t2h1u6 < t2h1u5 && t2h1u6 < t2h1d5 && t2h1u6 < t2w1rwt5 && t2h1u6 < t2w1lwt5 && t2h1u6 < t2h1uwt5 && t2h1u6 < t2h1dwt5
  && t2h1u6 < t2w1r6 && t2h1u6 < t2w1l6 && t2h1u6 < t2h1d6 && t2h1u6 < t2w1rwt6 && t2h1u6 < t2w1lwt6 && t2h1u6 < t2h1uwt6 && t2h1u6 < t2h1dwt6
  && t2h1u6 < t2w1r7 && t2h1u6 < t2w1l7 && t2h1u6 < t2h1u7 && t2h1u6 < t2h1d7 && t2h1u6 < t2w1rwt7 && t2h1u6 < t2w1lwt7 && t2h1u6 < t2h1uwt7 && t2h1u6 < t2h1dwt7
  && t2h1u6 < t2w1r8 && t2h1u6 < t2w1l8 && t2h1u6 < t2h1u8 && t2h1u6 < t2h1d8 && t2h1u6 < t2w1rwt8 && t2h1u6 < t2w1lwt8 && t2h1u6 < t2h1uwt8 && t2h1u6 < t2h1dwt8
  && t2h1u6 < t2w1r9 && t2h1u6 < t2w1l9 && t2h1u6 < t2h1u9 && t2h1u6 < t2h1d9 && t2h1u6 < t2w1rwt9 && t2h1u6 < t2w1lwt9 && t2h1u6 < t2h1uwt9 && t2h1u6 < t2h1dwt9
  && t2h1u6 < t2w1r10 && t2h1u6 < t2w1l10 && t2h1u6 < t2h1u10 && t2h1u6 < t2h1d10 && t2h1u6 < t2w1rwt10 && t2h1u6 < t2w1lwt10 && t2h1u6 < t2h1uwt10 && t2h1u6 < t2h1dwt10 
  && ((louthu6!=0 && linhu6==0) || (louthu6==0 && linhu6!=0))){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1u6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1u6+z))*(z0wr6+(vz*t2h1u6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1u6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1u6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1u6+z))*(z0wl6+(vz*t2h1u6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1u6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1u6+x;
  ylimitu=sqrt(pbhu6-(vz*t2h1u6+z)/pahu6);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu6>0){
  i=249;
  }else{
  i=260;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu6!=-1 && t2h1u6 > 0 && t2h1u6 < t1
  && t2h1u6 < t2w1r && t2h1u6 < t2w1l && t2h1u6 < t2h1u && t2h1u6 < t2h1d && t2h1u6 < t2w1rwt && t2h1u6 < t2w1lwt && t2h1u6 < t2h1uwt && t2h1u6 < t2h1dwt
  && t2h1u6 < t2w1r1 && t2h1u6 < t2w1l1 && t2h1u6 < t2h1u1 && t2h1u6 < t2h1d1 && t2h1u6 < t2w1rwt1 && t2h1u6 < t2w1lwt1 && t2h1u6 < t2h1uwt1 && t2h1u6 < t2h1dwt1
  && t2h1u6 < t2w1r2 && t2h1u6 < t2w1l2 && t2h1u6 < t2h1u2 && t2h1u6 < t2h1d2 && t2h1u6 < t2w1rwt2 && t2h1u6 < t2w1lwt2 && t2h1u6 < t2h1uwt2 && t2h1u6 < t2h1dwt2
  && t2h1u6 < t2w1r3 && t2h1u6 < t2w1l3 && t2h1u6 < t2h1u3 && t2h1u6 < t2h1d3 && t2h1u6 < t2w1rwt3 && t2h1u6 < t2w1lwt3 && t2h1u6 < t2h1uwt3 && t2h1u6 < t2h1dwt3
  && t2h1u6 < t2w1r4 && t2h1u6 < t2w1l4 && t2h1u6 < t2h1u4 && t2h1u6 < t2h1d4 && t2h1u6 < t2w1rwt4 && t2h1u6 < t2w1lwt4 && t2h1u6 < t2h1uwt4 && t2h1u6 < t2h1dwt4
  && t2h1u6 < t2w1r5 && t2h1u6 < t2w1l5 && t2h1u6 < t2h1u5 && t2h1u6 < t2h1d5 && t2h1u6 < t2w1rwt5 && t2h1u6 < t2w1lwt5 && t2h1u6 < t2h1uwt5 && t2h1u6 < t2h1dwt5
  && t2h1u6 < t2w1r6 && t2h1u6 < t2w1l6 && t2h1u6 < t2h1d6 && t2h1u6 < t2w1rwt6 && t2h1u6 < t2w1lwt6 && t2h1u6 < t2h1uwt6 && t2h1u6 < t2h1dwt6
  && t2h1u6 < t2w1r7 && t2h1u6 < t2w1l7 && t2h1u6 < t2h1u7 && t2h1u6 < t2h1d7 && t2h1u6 < t2w1rwt7 && t2h1u6 < t2w1lwt7 && t2h1u6 < t2h1uwt7 && t2h1u6 < t2h1dwt7
  && t2h1u6 < t2w1r8 && t2h1u6 < t2w1l8 && t2h1u6 < t2h1u8 && t2h1u6 < t2h1d8 && t2h1u6 < t2w1rwt8 && t2h1u6 < t2w1lwt8 && t2h1u6 < t2h1uwt8 && t2h1u6 < t2h1dwt8
  && t2h1u6 < t2w1r9 && t2h1u6 < t2w1l9 && t2h1u6 < t2h1u9 && t2h1u6 < t2h1d9 && t2h1u6 < t2w1rwt9 && t2h1u6 < t2w1lwt9 && t2h1u6 < t2h1uwt9 && t2h1u6 < t2h1dwt9
  && t2h1u6 < t2w1r10 && t2h1u6 < t2w1l10 && t2h1u6 < t2h1u10 && t2h1u6 < t2h1d10 && t2h1u6 < t2w1rwt10 && t2h1u6 < t2w1lwt10 && t2h1u6 < t2h1uwt10 && t2h1u6 < t2h1dwt10
  && (louthu6 == 0 && linhu6 == 0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1u6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1u6+z))*(z0wr6+(vz*t2h1u6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1u6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1u6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1u6+z))*(z0wl6+(vz*t2h1u6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1u6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1u6+x;
  ylimitu=(h2u6-h1u6)*(vz*t2h1u6+z)/l+h1u6;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu6>0 ){
  i=250;
  }else{
  i=260;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd6!=-1 && t2h1d6 > 0 && t2h1d6 < t1 
  && t2h1d6 < t2w1r && t2h1d6 < t2w1l && t2h1d6 < t2h1u && t2h1d6 < t2h1d && t2h1d6 < t2w1rwt && t2h1d6 < t2w1lwt && t2h1d6 < t2h1uwt && t2h1d6 < t2h1dwt
  && t2h1d6 < t2w1r1 && t2h1d6 < t2w1l1 && t2h1d6 < t2h1u1 && t2h1d6 < t2h1d1 && t2h1d6 < t2w1rwt1 && t2h1d6 < t2w1lwt1 && t2h1d6 < t2h1uwt1 && t2h1d6 < t2h1dwt1
  && t2h1d6 < t2w1r2 && t2h1d6 < t2w1l2 && t2h1d6 < t2h1u2 && t2h1d6 < t2h1d2 && t2h1d6 < t2w1rwt2 && t2h1d6 < t2w1lwt2 && t2h1d6 < t2h1uwt2 && t2h1d6 < t2h1dwt2
  && t2h1d6 < t2w1r3 && t2h1d6 < t2w1l3 && t2h1d6 < t2h1u3 && t2h1d6 < t2h1d3 && t2h1d6 < t2w1rwt3 && t2h1d6 < t2w1lwt3 && t2h1d6 < t2h1uwt3 && t2h1d6 < t2h1dwt3
  && t2h1d6 < t2w1r4 && t2h1d6 < t2w1l4 && t2h1d6 < t2h1u4 && t2h1d6 < t2h1d4 && t2h1d6 < t2w1rwt4 && t2h1d6 < t2w1lwt4 && t2h1d6 < t2h1uwt4 && t2h1d6 < t2h1dwt4
  && t2h1d6 < t2w1r5 && t2h1d6 < t2w1l5 && t2h1d6 < t2h1u5 && t2h1d6 < t2h1d5 && t2h1d6 < t2w1rwt5 && t2h1d6 < t2w1lwt5 && t2h1d6 < t2h1uwt5 && t2h1d6 < t2h1dwt5
  && t2h1d6 < t2w1r6 && t2h1d6 < t2w1l6 && t2h1d6 < t2h1u6 && t2h1d6 < t2w1rwt6 && t2h1d6 < t2w1lwt6 && t2h1d6 < t2h1uwt6 && t2h1d6 < t2h1dwt6
  && t2h1d6 < t2w1r7 && t2h1d6 < t2w1l7 && t2h1d6 < t2h1u7 && t2h1d6 < t2h1d7 && t2h1d6 < t2w1rwt7 && t2h1d6 < t2w1lwt7 && t2h1d6 < t2h1uwt7 && t2h1d6 < t2h1dwt7
  && t2h1d6 < t2w1r8 && t2h1d6 < t2w1l8 && t2h1d6 < t2h1u8 && t2h1d6 < t2h1d8 && t2h1d6 < t2w1rwt8 && t2h1d6 < t2w1lwt8 && t2h1d6 < t2h1uwt8 && t2h1d6 < t2h1dwt8
  && t2h1d6 < t2w1r9 && t2h1d6 < t2w1l9 && t2h1d6 < t2h1u9 && t2h1d6 < t2h1d9 && t2h1d6 < t2w1rwt9 && t2h1d6 < t2w1lwt9 && t2h1d6 < t2h1uwt9 && t2h1d6 < t2h1dwt9
  && t2h1d6 < t2w1r10 && t2h1d6 < t2w1l10 && t2h1d6 < t2h1u10 && t2h1d6 < t2h1d10 && t2h1d6 < t2w1rwt10 && t2h1d6 < t2w1lwt10 && t2h1d6 < t2h1uwt10 && t2h1d6 < t2h1dwt10
  && (louthd6 !=0 && linhd6!=0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1d6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1d6+z))*(z0wr6+(vz*t2h1d6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1d6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1d6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1d6+z))*(z0wl6+(vz*t2h1d6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1d6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1d6+x;
  ylimitd=-bhd6*sqrt(1-((vz*t2h1d6+z)+z0hd6)*((vz*t2h1d6+z)+z0hd6)/a2hd6);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd6>0){
  i=251;
  }else{
  i=261;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd6!=-1 && t2h1d6 > 0 && t2h1d6 < t1 
  && t2h1d6 < t2w1r && t2h1d6 < t2w1l && t2h1d6 < t2h1u && t2h1d6 < t2h1d && t2h1d6 < t2w1rwt && t2h1d6 < t2w1lwt && t2h1d6 < t2h1uwt && t2h1d6 < t2h1dwt
  && t2h1d6 < t2w1r1 && t2h1d6 < t2w1l1 && t2h1d6 < t2h1u1 && t2h1d6 < t2h1d1 && t2h1d6 < t2w1rwt1 && t2h1d6 < t2w1lwt1 && t2h1d6 < t2h1uwt1 && t2h1d6 < t2h1dwt1
  && t2h1d6 < t2w1r2 && t2h1d6 < t2w1l2 && t2h1d6 < t2h1u2 && t2h1d6 < t2h1d2 && t2h1d6 < t2w1rwt2 && t2h1d6 < t2w1lwt2 && t2h1d6 < t2h1uwt2 && t2h1d6 < t2h1dwt2
  && t2h1d6 < t2w1r3 && t2h1d6 < t2w1l3 && t2h1d6 < t2h1u3 && t2h1d6 < t2h1d3 && t2h1d6 < t2w1rwt3 && t2h1d6 < t2w1lwt3 && t2h1d6 < t2h1uwt3 && t2h1d6 < t2h1dwt3
  && t2h1d6 < t2w1r4 && t2h1d6 < t2w1l4 && t2h1d6 < t2h1u4 && t2h1d6 < t2h1d4 && t2h1d6 < t2w1rwt4 && t2h1d6 < t2w1lwt4 && t2h1d6 < t2h1uwt4 && t2h1d6 < t2h1dwt4
  && t2h1d6 < t2w1r5 && t2h1d6 < t2w1l5 && t2h1d6 < t2h1u5 && t2h1d6 < t2h1d5 && t2h1d6 < t2w1rwt5 && t2h1d6 < t2w1lwt5 && t2h1d6 < t2h1uwt5 && t2h1d6 < t2h1dwt5
  && t2h1d6 < t2w1r6 && t2h1d6 < t2w1l6 && t2h1d6 < t2h1u6 && t2h1d6 < t2w1rwt6 && t2h1d6 < t2w1lwt6 && t2h1d6 < t2h1uwt6 && t2h1d6 < t2h1dwt6
  && t2h1d6 < t2w1r7 && t2h1d6 < t2w1l7 && t2h1d6 < t2h1u7 && t2h1d6 < t2h1d7 && t2h1d6 < t2w1rwt7 && t2h1d6 < t2w1lwt7 && t2h1d6 < t2h1uwt7 && t2h1d6 < t2h1dwt7
  && t2h1d6 < t2w1r8 && t2h1d6 < t2w1l8 && t2h1d6 < t2h1u8 && t2h1d6 < t2h1d8 && t2h1d6 < t2w1rwt8 && t2h1d6 < t2w1lwt8 && t2h1d6 < t2h1uwt8 && t2h1d6 < t2h1dwt8
  && t2h1d6 < t2w1r9 && t2h1d6 < t2w1l9 && t2h1d6 < t2h1u9 && t2h1d6 < t2h1d9 && t2h1d6 < t2w1rwt9 && t2h1d6 < t2w1lwt9 && t2h1d6 < t2h1uwt9 && t2h1d6 < t2h1dwt9
  && t2h1d6 < t2w1r10 && t2h1d6 < t2w1l10 && t2h1d6 < t2h1u10 && t2h1d6 < t2h1d10 && t2h1d6 < t2w1rwt10 && t2h1d6 < t2w1lwt10 && t2h1d6 < t2h1uwt10 && t2h1d6 < t2h1dwt10
  && ((louthd6 !=0 && linhd6==0) || (louthd6 ==0 && linhd6!=0))){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1d6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1d6+z))*(z0wr6+(vz*t2h1d6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1d6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1d6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1d6+z))*(z0wl6+(vz*t2h1d6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1d6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1d6+x;
  ylimitd=-sqrt(pbhd6-(vz*t2h1d6+z)/pahd6);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd6>0 ){
  i=252;
  }else{
  i=261;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd6!=-1 && t2h1d6 > 0 && t2h1d6 < t1 
  && t2h1d6 < t2w1r && t2h1d6 < t2w1l && t2h1d6 < t2h1u && t2h1d6 < t2h1d && t2h1d6 < t2w1rwt && t2h1d6 < t2w1lwt && t2h1d6 < t2h1uwt && t2h1d6 < t2h1dwt
  && t2h1d6 < t2w1r1 && t2h1d6 < t2w1l1 && t2h1d6 < t2h1u1 && t2h1d6 < t2h1d1 && t2h1d6 < t2w1rwt1 && t2h1d6 < t2w1lwt1 && t2h1d6 < t2h1uwt1 && t2h1d6 < t2h1dwt1
  && t2h1d6 < t2w1r2 && t2h1d6 < t2w1l2 && t2h1d6 < t2h1u2 && t2h1d6 < t2h1d2 && t2h1d6 < t2w1rwt2 && t2h1d6 < t2w1lwt2 && t2h1d6 < t2h1uwt2 && t2h1d6 < t2h1dwt2
  && t2h1d6 < t2w1r3 && t2h1d6 < t2w1l3 && t2h1d6 < t2h1u3 && t2h1d6 < t2h1d3 && t2h1d6 < t2w1rwt3 && t2h1d6 < t2w1lwt3 && t2h1d6 < t2h1uwt3 && t2h1d6 < t2h1dwt3
  && t2h1d6 < t2w1r4 && t2h1d6 < t2w1l4 && t2h1d6 < t2h1u4 && t2h1d6 < t2h1d4 && t2h1d6 < t2w1rwt4 && t2h1d6 < t2w1lwt4 && t2h1d6 < t2h1uwt4 && t2h1d6 < t2h1dwt4
  && t2h1d6 < t2w1r5 && t2h1d6 < t2w1l5 && t2h1d6 < t2h1u5 && t2h1d6 < t2h1d5 && t2h1d6 < t2w1rwt5 && t2h1d6 < t2w1lwt5 && t2h1d6 < t2h1uwt5 && t2h1d6 < t2h1dwt5
  && t2h1d6 < t2w1r6 && t2h1d6 < t2w1l6 && t2h1d6 < t2h1u6 && t2h1d6 < t2w1rwt6 && t2h1d6 < t2w1lwt6 && t2h1d6 < t2h1uwt6 && t2h1d6 < t2h1dwt6
  && t2h1d6 < t2w1r7 && t2h1d6 < t2w1l7 && t2h1d6 < t2h1u7 && t2h1d6 < t2h1d7 && t2h1d6 < t2w1rwt7 && t2h1d6 < t2w1lwt7 && t2h1d6 < t2h1uwt7 && t2h1d6 < t2h1dwt7
  && t2h1d6 < t2w1r8 && t2h1d6 < t2w1l8 && t2h1d6 < t2h1u8 && t2h1d6 < t2h1d8 && t2h1d6 < t2w1rwt8 && t2h1d6 < t2w1lwt8 && t2h1d6 < t2h1uwt8 && t2h1d6 < t2h1dwt8
  && t2h1d6 < t2w1r9 && t2h1d6 < t2w1l9 && t2h1d6 < t2h1u9 && t2h1d6 < t2h1d9 && t2h1d6 < t2w1rwt9 && t2h1d6 < t2w1lwt9 && t2h1d6 < t2h1uwt9 && t2h1d6 < t2h1dwt9
  && t2h1d6 < t2w1r10 && t2h1d6 < t2w1l10 && t2h1d6 < t2h1u10 && t2h1d6 < t2h1d10 && t2h1d6 < t2w1rwt10 && t2h1d6 < t2w1lwt10 && t2h1d6 < t2h1uwt10 && t2h1d6 < t2h1dwt10
  && (louthd6 == 0 && linhd6 == 0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1d6+z)-w1r6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwr6*sqrt(1-((z0wr6+(vz*t2h1d6+z))*(z0wr6+(vz*t2h1d6+z)))/a2wr6);
    }else{
    xlimitr=-sqrt(((vz*t2h1d6+z)-pbwr6)/-pawr6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1d6+z)+w1l6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwl6*sqrt(1-((z0wl6+(vz*t2h1d6+z))*(z0wl6+(vz*t2h1d6+z)))/a2wl6);
      }else{
      xlimitl=sqrt(((vz*t2h1d6+z)-pbwl6)/-pawl6);
      }
   }
  xtest=vx*t2h1d6+x;
  ylimitd=(-h2d6+h1d6)*(vz*t2h1d6+z)/l-h1d6;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd6>0 ){
  i=253;
  }else{
  i=261;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr6==-1 && t2w1r6 > 0 && t2w1r6 < t1 
     && t2w1r6 < t2w1r && t2w1r6 < t2w1l && t2w1r6 < t2h1u && t2w1r6 < t2h1d && t2w1r6 < t2w1rwt && t2w1r6 < t2w1lwt && t2w1r6 < t2h1uwt && t2w1r6 < t2h1dwt
     && t2w1r6 < t2w1r1 && t2w1r6 < t2w1l1 && t2w1r6 < t2h1u1 && t2w1r6 < t2h1d1 && t2w1r6 < t2w1rwt1 && t2w1r6 < t2w1lwt1 && t2w1r6 < t2h1uwt1 && t2w1r6 < t2h1dwt1
     && t2w1r6 < t2w1r2 && t2w1r6 < t2w1l2 && t2w1r6 < t2h1u2 && t2w1r6 < t2h1d2 && t2w1r6 < t2w1rwt2 && t2w1r6 < t2w1lwt2 && t2w1r6 < t2h1uwt2 && t2w1r6 < t2h1dwt2 
     && t2w1r6 < t2w1r3 && t2w1r6 < t2w1l3 && t2w1r6 < t2h1u3 && t2w1r6 < t2h1d3 && t2w1r6 < t2w1rwt3 && t2w1r6 < t2w1lwt3 && t2w1r6 < t2h1uwt3 && t2w1r6 < t2h1dwt3
     && t2w1r6 < t2w1r4 && t2w1r6 < t2w1l4 && t2w1r6 < t2h1u4 && t2w1r6 < t2h1d4 && t2w1r6 < t2w1rwt4 && t2w1r6 < t2w1lwt4 && t2w1r6 < t2h1uwt4 && t2w1r6 < t2h1dwt4
     && t2w1r6 < t2w1r5 && t2w1r6 < t2w1l5 && t2w1r6 < t2h1u5 && t2w1r6 < t2h1d5 && t2w1r6 < t2w1rwt5 && t2w1r6 < t2w1lwt5 && t2w1r6 < t2h1uwt5 && t2w1r6 < t2h1dwt5
     && t2w1r6 < t2w1l6 && t2w1r6 < t2h1u6 && t2w1r6 < t2h1d6 && t2w1r6 < t2w1rwt6 && t2w1r6 < t2w1lwt6 && t2w1r6 < t2h1uwt6 && t2w1r6 < t2h1dwt6
     && t2w1r6 < t2w1r7 && t2w1r6 < t2w1l7 && t2w1r6 < t2h1u7 && t2w1r6 < t2h1d7 && t2w1r6 < t2w1rwt7 && t2w1r6 < t2w1lwt7 && t2w1r6 < t2h1uwt7 && t2w1r6 < t2h1dwt7
     && t2w1r6 < t2w1r8 && t2w1r6 < t2w1l8 && t2w1r6 < t2h1u8 && t2w1r6 < t2h1d8 && t2w1r6 < t2w1rwt8 && t2w1r6 < t2w1lwt8 && t2w1r6 < t2h1uwt8 && t2w1r6 < t2h1dwt8
     && t2w1r6 < t2w1r9 && t2w1r6 < t2w1l9 && t2w1r6 < t2h1u9 && t2w1r6 < t2h1d9 && t2w1r6 < t2w1rwt9 && t2w1r6 < t2w1lwt9 && t2w1r6 < t2h1uwt9 && t2w1r6 < t2h1dwt9
     && t2w1r6 < t2w1r10 && t2w1r6 < t2w1l10 && t2w1r6 < t2h1u10 && t2w1r6 < t2h1d10 && t2w1r6 < t2w1rwt10 && t2w1r6 < t2w1lwt10 && t2w1r6 < t2h1uwt10 && t2w1r6 < t2h1dwt10
     && ((linwr6!=0) && (loutwr6!=0) )) {
  i=254;
  }

  if (mxr6==-1 && t2w1r6 > 0 && t2w1r6 < t1 
     && t2w1r6 < t2w1r && t2w1r6 < t2w1l && t2w1r6 < t2h1u && t2w1r6 < t2h1d && t2w1r6 < t2w1rwt && t2w1r6 < t2w1lwt && t2w1r6 < t2h1uwt && t2w1r6 < t2h1dwt
     && t2w1r6 < t2w1r1 && t2w1r6 < t2w1l1 && t2w1r6 < t2h1u1 && t2w1r6 < t2h1d1 && t2w1r6 < t2w1rwt1 && t2w1r6 < t2w1lwt1 && t2w1r6 < t2h1uwt1 && t2w1r6 < t2h1dwt1
     && t2w1r6 < t2w1r2 && t2w1r6 < t2w1l2 && t2w1r6 < t2h1u2 && t2w1r6 < t2h1d2 && t2w1r6 < t2w1rwt2 && t2w1r6 < t2w1lwt2 && t2w1r6 < t2h1uwt2 && t2w1r6 < t2h1dwt2 
     && t2w1r6 < t2w1r3 && t2w1r6 < t2w1l3 && t2w1r6 < t2h1u3 && t2w1r6 < t2h1d3 && t2w1r6 < t2w1rwt3 && t2w1r6 < t2w1lwt3 && t2w1r6 < t2h1uwt3 && t2w1r6 < t2h1dwt3
     && t2w1r6 < t2w1r4 && t2w1r6 < t2w1l4 && t2w1r6 < t2h1u4 && t2w1r6 < t2h1d4 && t2w1r6 < t2w1rwt4 && t2w1r6 < t2w1lwt4 && t2w1r6 < t2h1uwt4 && t2w1r6 < t2h1dwt4
     && t2w1r6 < t2w1r5 && t2w1r6 < t2w1l5 && t2w1r6 < t2h1u5 && t2w1r6 < t2h1d5 && t2w1r6 < t2w1rwt5 && t2w1r6 < t2w1lwt5 && t2w1r6 < t2h1uwt5 && t2w1r6 < t2h1dwt5
     && t2w1r6 < t2w1l6 && t2w1r6 < t2h1u6 && t2w1r6 < t2h1d6 && t2w1r6 < t2w1rwt6 && t2w1r6 < t2w1lwt6 && t2w1r6 < t2h1uwt6 && t2w1r6 < t2h1dwt6
     && t2w1r6 < t2w1r7 && t2w1r6 < t2w1l7 && t2w1r6 < t2h1u7 && t2w1r6 < t2h1d7 && t2w1r6 < t2w1rwt7 && t2w1r6 < t2w1lwt7 && t2w1r6 < t2h1uwt7 && t2w1r6 < t2h1dwt7
     && t2w1r6 < t2w1r8 && t2w1r6 < t2w1l8 && t2w1r6 < t2h1u8 && t2w1r6 < t2h1d8 && t2w1r6 < t2w1rwt8 && t2w1r6 < t2w1lwt8 && t2w1r6 < t2h1uwt8 && t2w1r6 < t2h1dwt8
     && t2w1r6 < t2w1r9 && t2w1r6 < t2w1l9 && t2w1r6 < t2h1u9 && t2w1r6 < t2h1d9 && t2w1r6 < t2w1rwt9 && t2w1r6 < t2w1lwt9 && t2w1r6 < t2h1uwt9 && t2w1r6 < t2h1dwt9
     && t2w1r6 < t2w1r10 && t2w1r6 < t2w1l10 && t2w1r6 < t2h1u10 && t2w1r6 < t2h1d10 && t2w1r6 < t2w1rwt10 && t2w1r6 < t2w1lwt10 && t2w1r6 < t2h1uwt10 && t2w1r6 < t2h1dwt10
     && ((loutwr6!=0 && linwr6==0) || (loutwr6==0 && linwr6!=0))){
  i=254;
  }

  if (mxr6==-1 && t2w1r6 > 0 && t2w1r6 < t1 
     && t2w1r6 < t2w1r && t2w1r6 < t2w1l && t2w1r6 < t2h1u && t2w1r6 < t2h1d && t2w1r6 < t2w1rwt && t2w1r6 < t2w1lwt && t2w1r6 < t2h1uwt && t2w1r6 < t2h1dwt
     && t2w1r6 < t2w1r1 && t2w1r6 < t2w1l1 && t2w1r6 < t2h1u1 && t2w1r6 < t2h1d1 && t2w1r6 < t2w1rwt1 && t2w1r6 < t2w1lwt1 && t2w1r6 < t2h1uwt1 && t2w1r6 < t2h1dwt1
     && t2w1r6 < t2w1r2 && t2w1r6 < t2w1l2 && t2w1r6 < t2h1u2 && t2w1r6 < t2h1d2 && t2w1r6 < t2w1rwt2 && t2w1r6 < t2w1lwt2 && t2w1r6 < t2h1uwt2 && t2w1r6 < t2h1dwt2 
     && t2w1r6 < t2w1r3 && t2w1r6 < t2w1l3 && t2w1r6 < t2h1u3 && t2w1r6 < t2h1d3 && t2w1r6 < t2w1rwt3 && t2w1r6 < t2w1lwt3 && t2w1r6 < t2h1uwt3 && t2w1r6 < t2h1dwt3
     && t2w1r6 < t2w1r4 && t2w1r6 < t2w1l4 && t2w1r6 < t2h1u4 && t2w1r6 < t2h1d4 && t2w1r6 < t2w1rwt4 && t2w1r6 < t2w1lwt4 && t2w1r6 < t2h1uwt4 && t2w1r6 < t2h1dwt4
     && t2w1r6 < t2w1r5 && t2w1r6 < t2w1l5 && t2w1r6 < t2h1u5 && t2w1r6 < t2h1d5 && t2w1r6 < t2w1rwt5 && t2w1r6 < t2w1lwt5 && t2w1r6 < t2h1uwt5 && t2w1r6 < t2h1dwt5
     && t2w1r6 < t2w1l6 && t2w1r6 < t2h1u6 && t2w1r6 < t2h1d6 && t2w1r6 < t2w1rwt6 && t2w1r6 < t2w1lwt6 && t2w1r6 < t2h1uwt6 && t2w1r6 < t2h1dwt6
     && t2w1r6 < t2w1r7 && t2w1r6 < t2w1l7 && t2w1r6 < t2h1u7 && t2w1r6 < t2h1d7 && t2w1r6 < t2w1rwt7 && t2w1r6 < t2w1lwt7 && t2w1r6 < t2h1uwt7 && t2w1r6 < t2h1dwt7
     && t2w1r6 < t2w1r8 && t2w1r6 < t2w1l8 && t2w1r6 < t2h1u8 && t2w1r6 < t2h1d8 && t2w1r6 < t2w1rwt8 && t2w1r6 < t2w1lwt8 && t2w1r6 < t2h1uwt8 && t2w1r6 < t2h1dwt8
     && t2w1r6 < t2w1r9 && t2w1r6 < t2w1l9 && t2w1r6 < t2h1u9 && t2w1r6 < t2h1d9 && t2w1r6 < t2w1rwt9 && t2w1r6 < t2w1lwt9 && t2w1r6 < t2h1uwt9 && t2w1r6 < t2h1dwt9
     && t2w1r6 < t2w1r10 && t2w1r6 < t2w1l10 && t2w1r6 < t2h1u10 && t2w1r6 < t2h1d10 && t2w1r6 < t2w1rwt10 && t2w1r6 < t2w1lwt10 && t2w1r6 < t2h1uwt10 && t2w1r6 < t2h1dwt10
     && (loutwr6==0 && linwr6==0)){
  i=254;
  }

  if (mxl6==-1 && t2w1l6 > 0 && t2w1l6 < t1 
      && t2w1l6 < t2w1r && t2w1l6 < t2w1l && t2w1l6 < t2h1u && t2w1l6 < t2h1d && t2w1l6 < t2w1rwt && t2w1l6 < t2w1lwt && t2w1l6 < t2h1uwt && t2w1l6 < t2h1dwt
      && t2w1l6 < t2w1r1 && t2w1l6 < t2w1l1 && t2w1l6 < t2h1u1 && t2w1l6 < t2h1d1 && t2w1l6 < t2w1rwt1 && t2w1l6 < t2w1lwt1 && t2w1l6 < t2h1uwt1 && t2w1l6 < t2h1dwt1
      && t2w1l6 < t2w1r2 && t2w1l6 < t2w1l2 && t2w1l6 < t2h1u2 && t2w1l6 < t2h1d2 && t2w1l6 < t2w1rwt2 && t2w1l6 < t2w1lwt2 && t2w1l6 < t2h1uwt2 && t2w1l6 < t2h1dwt2
      && t2w1l6 < t2w1r3 && t2w1l6 < t2w1l3 && t2w1l6 < t2h1u3 && t2w1l6 < t2h1d3 && t2w1l6 < t2w1rwt3 && t2w1l6 < t2w1lwt3 && t2w1l6 < t2h1uwt3 && t2w1l6 < t2h1dwt3
      && t2w1l6 < t2w1r4 && t2w1l6 < t2w1l4 && t2w1l6 < t2h1u4 && t2w1l6 < t2h1d4 && t2w1l6 < t2w1rwt4 && t2w1l6 < t2w1lwt4 && t2w1l6 < t2h1uwt4 && t2w1l6 < t2h1dwt4
      && t2w1l6 < t2w1r5 && t2w1l6 < t2w1l5 && t2w1l6 < t2h1u5 && t2w1l6 < t2h1d5 && t2w1l6 < t2w1rwt5 && t2w1l6 < t2w1lwt5 && t2w1l6 < t2h1uwt5 && t2w1l6 < t2h1dwt5
      && t2w1l6 < t2w1r6 && t2w1l6 < t2h1u6 && t2w1l6 < t2h1d6 && t2w1l6 < t2w1rwt6 && t2w1l6 < t2w1lwt6 && t2w1l6 < t2h1uwt6 && t2w1l6 < t2h1dwt6
      && t2w1l6 < t2w1r7 && t2w1l6 < t2w1l7 && t2w1l6 < t2h1u7 && t2w1l6 < t2h1d7 && t2w1l6 < t2w1rwt7 && t2w1l6 < t2w1lwt7 && t2w1l6 < t2h1uwt7 && t2w1l6 < t2h1dwt7
      && t2w1l6 < t2w1r8 && t2w1l6 < t2w1l8 && t2w1l6 < t2h1u8 && t2w1l6 < t2h1d8 && t2w1l6 < t2w1rwt8 && t2w1l6 < t2w1lwt8 && t2w1l6 < t2h1uwt8 && t2w1l6 < t2h1dwt8
      && t2w1l6 < t2w1r9 && t2w1l6 < t2w1l9 && t2w1l6 < t2h1u9 && t2w1l6 < t2h1d9 && t2w1l6 < t2w1rwt9 && t2w1l6 < t2w1lwt9 && t2w1l6 < t2h1uwt9 && t2w1l6 < t2h1dwt9
      && t2w1l6 < t2w1r10 && t2w1l6 < t2w1l10 && t2w1l6 < t2h1u10 && t2w1l6 < t2h1d10 && t2w1l6 < t2w1rwt10 && t2w1l6 < t2w1lwt10 && t2w1l6 < t2h1uwt10 && t2w1l6 < t2h1dwt10
      && ((linwl6!=0) && (loutwl6!=0) )){
  i=255;
  }

  if (mxl6==-1 && t2w1l6 > 0 && t2w1l6 < t1 
      && t2w1l6 < t2w1r && t2w1l6 < t2w1l && t2w1l6 < t2h1u && t2w1l6 < t2h1d && t2w1l6 < t2w1rwt && t2w1l6 < t2w1lwt && t2w1l6 < t2h1uwt && t2w1l6 < t2h1dwt
      && t2w1l6 < t2w1r1 && t2w1l6 < t2w1l1 && t2w1l6 < t2h1u1 && t2w1l6 < t2h1d1 && t2w1l6 < t2w1rwt1 && t2w1l6 < t2w1lwt1 && t2w1l6 < t2h1uwt1 && t2w1l6 < t2h1dwt1
      && t2w1l6 < t2w1r2 && t2w1l6 < t2w1l2 && t2w1l6 < t2h1u2 && t2w1l6 < t2h1d2 && t2w1l6 < t2w1rwt2 && t2w1l6 < t2w1lwt2 && t2w1l6 < t2h1uwt2 && t2w1l6 < t2h1dwt2
      && t2w1l6 < t2w1r3 && t2w1l6 < t2w1l3 && t2w1l6 < t2h1u3 && t2w1l6 < t2h1d3 && t2w1l6 < t2w1rwt3 && t2w1l6 < t2w1lwt3 && t2w1l6 < t2h1uwt3 && t2w1l6 < t2h1dwt3
      && t2w1l6 < t2w1r4 && t2w1l6 < t2w1l4 && t2w1l6 < t2h1u4 && t2w1l6 < t2h1d4 && t2w1l6 < t2w1rwt4 && t2w1l6 < t2w1lwt4 && t2w1l6 < t2h1uwt4 && t2w1l6 < t2h1dwt4
      && t2w1l6 < t2w1r5 && t2w1l6 < t2w1l5 && t2w1l6 < t2h1u5 && t2w1l6 < t2h1d5 && t2w1l6 < t2w1rwt5 && t2w1l6 < t2w1lwt5 && t2w1l6 < t2h1uwt5 && t2w1l6 < t2h1dwt5
      && t2w1l6 < t2w1r6 && t2w1l6 < t2h1u6 && t2w1l6 < t2h1d6 && t2w1l6 < t2w1rwt6 && t2w1l6 < t2w1lwt6 && t2w1l6 < t2h1uwt6 && t2w1l6 < t2h1dwt6
      && t2w1l6 < t2w1r7 && t2w1l6 < t2w1l7 && t2w1l6 < t2h1u7 && t2w1l6 < t2h1d7 && t2w1l6 < t2w1rwt7 && t2w1l6 < t2w1lwt7 && t2w1l6 < t2h1uwt7 && t2w1l6 < t2h1dwt7
      && t2w1l6 < t2w1r8 && t2w1l6 < t2w1l8 && t2w1l6 < t2h1u8 && t2w1l6 < t2h1d8 && t2w1l6 < t2w1rwt8 && t2w1l6 < t2w1lwt8 && t2w1l6 < t2h1uwt8 && t2w1l6 < t2h1dwt8
      && t2w1l6 < t2w1r9 && t2w1l6 < t2w1l9 && t2w1l6 < t2h1u9 && t2w1l6 < t2h1d9 && t2w1l6 < t2w1rwt9 && t2w1l6 < t2w1lwt9 && t2w1l6 < t2h1uwt9 && t2w1l6 < t2h1dwt9
      && t2w1l6 < t2w1r10 && t2w1l6 < t2w1l10 && t2w1l6 < t2h1u10 && t2w1l6 < t2h1d10 && t2w1l6 < t2w1rwt10 && t2w1l6 < t2w1lwt10 && t2w1l6 < t2h1uwt10 && t2w1l6 < t2h1dwt10
      &&  ((loutwl6!=0 && linwl6==0) || (loutwl6==0 && linwl6!=0))){
  i=255;
  }

  if (mxl6==-1 && t2w1l6 > 0 && t2w1l6 < t1 
      && t2w1l6 < t2w1r && t2w1l6 < t2w1l && t2w1l6 < t2h1u && t2w1l6 < t2h1d && t2w1l6 < t2w1rwt && t2w1l6 < t2w1lwt && t2w1l6 < t2h1uwt && t2w1l6 < t2h1dwt
      && t2w1l6 < t2w1r1 && t2w1l6 < t2w1l1 && t2w1l6 < t2h1u1 && t2w1l6 < t2h1d1 && t2w1l6 < t2w1rwt1 && t2w1l6 < t2w1lwt1 && t2w1l6 < t2h1uwt1 && t2w1l6 < t2h1dwt1
      && t2w1l6 < t2w1r2 && t2w1l6 < t2w1l2 && t2w1l6 < t2h1u2 && t2w1l6 < t2h1d2 && t2w1l6 < t2w1rwt2 && t2w1l6 < t2w1lwt2 && t2w1l6 < t2h1uwt2 && t2w1l6 < t2h1dwt2
      && t2w1l6 < t2w1r3 && t2w1l6 < t2w1l3 && t2w1l6 < t2h1u3 && t2w1l6 < t2h1d3 && t2w1l6 < t2w1rwt3 && t2w1l6 < t2w1lwt3 && t2w1l6 < t2h1uwt3 && t2w1l6 < t2h1dwt3
      && t2w1l6 < t2w1r4 && t2w1l6 < t2w1l4 && t2w1l6 < t2h1u4 && t2w1l6 < t2h1d4 && t2w1l6 < t2w1rwt4 && t2w1l6 < t2w1lwt4 && t2w1l6 < t2h1uwt4 && t2w1l6 < t2h1dwt4
      && t2w1l6 < t2w1r5 && t2w1l6 < t2w1l5 && t2w1l6 < t2h1u5 && t2w1l6 < t2h1d5 && t2w1l6 < t2w1rwt5 && t2w1l6 < t2w1lwt5 && t2w1l6 < t2h1uwt5 && t2w1l6 < t2h1dwt5
      && t2w1l6 < t2w1r6 && t2w1l6 < t2h1u6 && t2w1l6 < t2h1d6 && t2w1l6 < t2w1rwt6 && t2w1l6 < t2w1lwt6 && t2w1l6 < t2h1uwt6 && t2w1l6 < t2h1dwt6
      && t2w1l6 < t2w1r7 && t2w1l6 < t2w1l7 && t2w1l6 < t2h1u7 && t2w1l6 < t2h1d7 && t2w1l6 < t2w1rwt7 && t2w1l6 < t2w1lwt7 && t2w1l6 < t2h1uwt7 && t2w1l6 < t2h1dwt7
      && t2w1l6 < t2w1r8 && t2w1l6 < t2w1l8 && t2w1l6 < t2h1u8 && t2w1l6 < t2h1d8 && t2w1l6 < t2w1rwt8 && t2w1l6 < t2w1lwt8 && t2w1l6 < t2h1uwt8 && t2w1l6 < t2h1dwt8
      && t2w1l6 < t2w1r9 && t2w1l6 < t2w1l9 && t2w1l6 < t2h1u9 && t2w1l6 < t2h1d9 && t2w1l6 < t2w1rwt9 && t2w1l6 < t2w1lwt9 && t2w1l6 < t2h1uwt9 && t2w1l6 < t2h1dwt9
      && t2w1l6 < t2w1r10 && t2w1l6 < t2w1l10 && t2w1l6 < t2h1u10 && t2w1l6 < t2h1d10 && t2w1l6 < t2w1rwt10 && t2w1l6 < t2w1lwt10 && t2w1l6 < t2h1uwt10 && t2w1l6 < t2h1dwt10
      && (loutwl6==0 && linwl6==0)){
  i=255;
  }

  if (myu6==-1 && t2h1u6 > 0 && t2h1u6 < t1 
  && t2h1u6 < t2w1r && t2h1u6 < t2w1l && t2h1u6 < t2h1u && t2h1u6 < t2h1d && t2h1u6 < t2w1rwt && t2h1u6 < t2w1lwt && t2h1u6 < t2h1uwt && t2h1u6 < t2h1dwt
  && t2h1u6 < t2w1r1 && t2h1u6 < t2w1l1 && t2h1u6 < t2h1u1 && t2h1u6 < t2h1d1 && t2h1u6 < t2w1rwt1 && t2h1u6 < t2w1lwt1 && t2h1u6 < t2h1uwt1 && t2h1u6 < t2h1dwt1
  && t2h1u6 < t2w1r2 && t2h1u6 < t2w1l2 && t2h1u6 < t2h1u2 && t2h1u6 < t2h1d2 && t2h1u6 < t2w1rwt2 && t2h1u6 < t2w1lwt2 && t2h1u6 < t2h1uwt2 && t2h1u6 < t2h1dwt2
  && t2h1u6 < t2w1r3 && t2h1u6 < t2w1l3 && t2h1u6 < t2h1u3 && t2h1u6 < t2h1d3 && t2h1u6 < t2w1rwt3 && t2h1u6 < t2w1lwt3 && t2h1u6 < t2h1uwt3 && t2h1u6 < t2h1dwt3
  && t2h1u6 < t2w1r4 && t2h1u6 < t2w1l4 && t2h1u6 < t2h1u4 && t2h1u6 < t2h1d4 && t2h1u6 < t2w1rwt4 && t2h1u6 < t2w1lwt4 && t2h1u6 < t2h1uwt4 && t2h1u6 < t2h1dwt4
  && t2h1u6 < t2w1r5 && t2h1u6 < t2w1l5 && t2h1u6 < t2h1u5 && t2h1u6 < t2h1d5 && t2h1u6 < t2w1rwt5 && t2h1u6 < t2w1lwt5 && t2h1u6 < t2h1uwt5 && t2h1u6 < t2h1dwt5
  && t2h1u6 < t2w1r6 && t2h1u6 < t2w1l6 && t2h1u6 < t2h1d6 && t2h1u6 < t2w1rwt6 && t2h1u6 < t2w1lwt6 && t2h1u6 < t2h1uwt6 && t2h1u6 < t2h1dwt6
  && t2h1u6 < t2w1r7 && t2h1u6 < t2w1l7 && t2h1u6 < t2h1u7 && t2h1u6 < t2h1d7 && t2h1u6 < t2w1rwt7 && t2h1u6 < t2w1lwt7 && t2h1u6 < t2h1uwt7 && t2h1u6 < t2h1dwt7
  && t2h1u6 < t2w1r8 && t2h1u6 < t2w1l8 && t2h1u6 < t2h1u8 && t2h1u6 < t2h1d8 && t2h1u6 < t2w1rwt8 && t2h1u6 < t2w1lwt8 && t2h1u6 < t2h1uwt8 && t2h1u6 < t2h1dwt8
  && t2h1u6 < t2w1r9 && t2h1u6 < t2w1l9 && t2h1u6 < t2h1u9 && t2h1u6 < t2h1d9 && t2h1u6 < t2w1rwt9 && t2h1u6 < t2w1lwt9 && t2h1u6 < t2h1uwt9 && t2h1u6 < t2h1dwt9
  && t2h1u6 < t2w1r10 && t2h1u6 < t2w1l10 && t2h1u6 < t2h1u10 && t2h1u6 < t2h1d10 && t2h1u6 < t2w1rwt10 && t2h1u6 < t2w1lwt10 && t2h1u6 < t2h1uwt10 && t2h1u6 < t2h1dwt10
  && (louthu6 !=0 && linhu6!=0)){
  i=256;
  }

  if (myu6==-1 && t2h1u6 > 0 && t2h1u6 < t1 
  && t2h1u6 < t2w1r && t2h1u6 < t2w1l && t2h1u6 < t2h1u && t2h1u6 < t2h1d && t2h1u6 < t2w1rwt && t2h1u6 < t2w1lwt && t2h1u6 < t2h1uwt && t2h1u6 < t2h1dwt
  && t2h1u6 < t2w1r1 && t2h1u6 < t2w1l1 && t2h1u6 < t2h1u1 && t2h1u6 < t2h1d1 && t2h1u6 < t2w1rwt1 && t2h1u6 < t2w1lwt1 && t2h1u6 < t2h1uwt1 && t2h1u6 < t2h1dwt1
  && t2h1u6 < t2w1r2 && t2h1u6 < t2w1l2 && t2h1u6 < t2h1u2 && t2h1u6 < t2h1d2 && t2h1u6 < t2w1rwt2 && t2h1u6 < t2w1lwt2 && t2h1u6 < t2h1uwt2 && t2h1u6 < t2h1dwt2
  && t2h1u6 < t2w1r3 && t2h1u6 < t2w1l3 && t2h1u6 < t2h1u3 && t2h1u6 < t2h1d3 && t2h1u6 < t2w1rwt3 && t2h1u6 < t2w1lwt3 && t2h1u6 < t2h1uwt3 && t2h1u6 < t2h1dwt3
  && t2h1u6 < t2w1r4 && t2h1u6 < t2w1l4 && t2h1u6 < t2h1u4 && t2h1u6 < t2h1d4 && t2h1u6 < t2w1rwt4 && t2h1u6 < t2w1lwt4 && t2h1u6 < t2h1uwt4 && t2h1u6 < t2h1dwt4
  && t2h1u6 < t2w1r5 && t2h1u6 < t2w1l5 && t2h1u6 < t2h1u5 && t2h1u6 < t2h1d5 && t2h1u6 < t2w1rwt5 && t2h1u6 < t2w1lwt5 && t2h1u6 < t2h1uwt5 && t2h1u6 < t2h1dwt5
  && t2h1u6 < t2w1r6 && t2h1u6 < t2w1l6 && t2h1u6 < t2h1d6 && t2h1u6 < t2w1rwt6 && t2h1u6 < t2w1lwt6 && t2h1u6 < t2h1uwt6 && t2h1u6 < t2h1dwt6
  && t2h1u6 < t2w1r7 && t2h1u6 < t2w1l7 && t2h1u6 < t2h1u7 && t2h1u6 < t2h1d7 && t2h1u6 < t2w1rwt7 && t2h1u6 < t2w1lwt7 && t2h1u6 < t2h1uwt7 && t2h1u6 < t2h1dwt7
  && t2h1u6 < t2w1r8 && t2h1u6 < t2w1l8 && t2h1u6 < t2h1u8 && t2h1u6 < t2h1d8 && t2h1u6 < t2w1rwt8 && t2h1u6 < t2w1lwt8 && t2h1u6 < t2h1uwt8 && t2h1u6 < t2h1dwt8
  && t2h1u6 < t2w1r9 && t2h1u6 < t2w1l9 && t2h1u6 < t2h1u9 && t2h1u6 < t2h1d9 && t2h1u6 < t2w1rwt9 && t2h1u6 < t2w1lwt9 && t2h1u6 < t2h1uwt9 && t2h1u6 < t2h1dwt9
  && t2h1u6 < t2w1r10 && t2h1u6 < t2w1l10 && t2h1u6 < t2h1u10 && t2h1u6 < t2h1d10 && t2h1u6 < t2w1rwt10 && t2h1u6 < t2w1lwt10 && t2h1u6 < t2h1uwt10 && t2h1u6 < t2h1dwt10
  && ((louthu6!=0 && linhu6==0) || (louthu6==0 && linhu6!=0))){
  i=256;
  }

  if (myu6==-1 && t2h1u6 > 0 && t2h1u6 < t1 
  && t2h1u6 < t2w1r && t2h1u6 < t2w1l && t2h1u6 < t2h1u && t2h1u6 < t2h1d && t2h1u6 < t2w1rwt && t2h1u6 < t2w1lwt && t2h1u6 < t2h1uwt && t2h1u6 < t2h1dwt
  && t2h1u6 < t2w1r1 && t2h1u6 < t2w1l1 && t2h1u6 < t2h1u1 && t2h1u6 < t2h1d1 && t2h1u6 < t2w1rwt1 && t2h1u6 < t2w1lwt1 && t2h1u6 < t2h1uwt1 && t2h1u6 < t2h1dwt1
  && t2h1u6 < t2w1r2 && t2h1u6 < t2w1l2 && t2h1u6 < t2h1u2 && t2h1u6 < t2h1d2 && t2h1u6 < t2w1rwt2 && t2h1u6 < t2w1lwt2 && t2h1u6 < t2h1uwt2 && t2h1u6 < t2h1dwt2
  && t2h1u6 < t2w1r3 && t2h1u6 < t2w1l3 && t2h1u6 < t2h1u3 && t2h1u6 < t2h1d3 && t2h1u6 < t2w1rwt3 && t2h1u6 < t2w1lwt3 && t2h1u6 < t2h1uwt3 && t2h1u6 < t2h1dwt3
  && t2h1u6 < t2w1r4 && t2h1u6 < t2w1l4 && t2h1u6 < t2h1u4 && t2h1u6 < t2h1d4 && t2h1u6 < t2w1rwt4 && t2h1u6 < t2w1lwt4 && t2h1u6 < t2h1uwt4 && t2h1u6 < t2h1dwt4
  && t2h1u6 < t2w1r5 && t2h1u6 < t2w1l5 && t2h1u6 < t2h1u5 && t2h1u6 < t2h1d5 && t2h1u6 < t2w1rwt5 && t2h1u6 < t2w1lwt5 && t2h1u6 < t2h1uwt5 && t2h1u6 < t2h1dwt5
  && t2h1u6 < t2w1r6 && t2h1u6 < t2w1l6 && t2h1u6 < t2h1d6 && t2h1u6 < t2w1rwt6 && t2h1u6 < t2w1lwt6 && t2h1u6 < t2h1uwt6 && t2h1u6 < t2h1dwt6
  && t2h1u6 < t2w1r7 && t2h1u6 < t2w1l7 && t2h1u6 < t2h1u7 && t2h1u6 < t2h1d7 && t2h1u6 < t2w1rwt7 && t2h1u6 < t2w1lwt7 && t2h1u6 < t2h1uwt7 && t2h1u6 < t2h1dwt7
  && t2h1u6 < t2w1r8 && t2h1u6 < t2w1l8 && t2h1u6 < t2h1u8 && t2h1u6 < t2h1d8 && t2h1u6 < t2w1rwt8 && t2h1u6 < t2w1lwt8 && t2h1u6 < t2h1uwt8 && t2h1u6 < t2h1dwt8
  && t2h1u6 < t2w1r9 && t2h1u6 < t2w1l9 && t2h1u6 < t2h1u9 && t2h1u6 < t2h1d9 && t2h1u6 < t2w1rwt9 && t2h1u6 < t2w1lwt9 && t2h1u6 < t2h1uwt9 && t2h1u6 < t2h1dwt9
  && t2h1u6 < t2w1r10 && t2h1u6 < t2w1l10 && t2h1u6 < t2h1u10 && t2h1u6 < t2h1d10 && t2h1u6 < t2w1rwt10 && t2h1u6 < t2w1lwt10 && t2h1u6 < t2h1uwt10 && t2h1u6 < t2h1dwt10
  && (louthu6 == 0 && linhu6 == 0)){
  i=256;
  }

  if (myd6==-1 && t2h1d6 > 0 && t2h1d6 < t1 
  && t2h1d6 < t2w1r && t2h1d6 < t2w1l && t2h1d6 < t2h1u && t2h1d6 < t2h1d && t2h1d6 < t2w1rwt && t2h1d6 < t2w1lwt && t2h1d6 < t2h1uwt && t2h1d6 < t2h1dwt
  && t2h1d6 < t2w1r1 && t2h1d6 < t2w1l1 && t2h1d6 < t2h1u1 && t2h1d6 < t2h1d1 && t2h1d6 < t2w1rwt1 && t2h1d6 < t2w1lwt1 && t2h1d6 < t2h1uwt1 && t2h1d6 < t2h1dwt1
  && t2h1d6 < t2w1r2 && t2h1d6 < t2w1l2 && t2h1d6 < t2h1u2 && t2h1d6 < t2h1d2 && t2h1d6 < t2w1rwt2 && t2h1d6 < t2w1lwt2 && t2h1d6 < t2h1uwt2 && t2h1d6 < t2h1dwt2
  && t2h1d6 < t2w1r3 && t2h1d6 < t2w1l3 && t2h1d6 < t2h1u3 && t2h1d6 < t2h1d3 && t2h1d6 < t2w1rwt3 && t2h1d6 < t2w1lwt3 && t2h1d6 < t2h1uwt3 && t2h1d6 < t2h1dwt3
  && t2h1d6 < t2w1r4 && t2h1d6 < t2w1l4 && t2h1d6 < t2h1u4 && t2h1d6 < t2h1d4 && t2h1d6 < t2w1rwt4 && t2h1d6 < t2w1lwt4 && t2h1d6 < t2h1uwt4 && t2h1d6 < t2h1dwt4
  && t2h1d6 < t2w1r5 && t2h1d6 < t2w1l5 && t2h1d6 < t2h1u5 && t2h1d6 < t2h1d5 && t2h1d6 < t2w1rwt5 && t2h1d6 < t2w1lwt5 && t2h1d6 < t2h1uwt5 && t2h1d6 < t2h1dwt5
  && t2h1d6 < t2w1r6 && t2h1d6 < t2w1l6 && t2h1d6 < t2h1u6 && t2h1d6 < t2w1rwt6 && t2h1d6 < t2w1lwt6 && t2h1d6 < t2h1uwt6 && t2h1d6 < t2h1dwt6
  && t2h1d6 < t2w1r7 && t2h1d6 < t2w1l7 && t2h1d6 < t2h1u7 && t2h1d6 < t2h1d7 && t2h1d6 < t2w1rwt7 && t2h1d6 < t2w1lwt7 && t2h1d6 < t2h1uwt7 && t2h1d6 < t2h1dwt7
  && t2h1d6 < t2w1r8 && t2h1d6 < t2w1l8 && t2h1d6 < t2h1u8 && t2h1d6 < t2h1d8 && t2h1d6 < t2w1rwt8 && t2h1d6 < t2w1lwt8 && t2h1d6 < t2h1uwt8 && t2h1d6 < t2h1dwt8
  && t2h1d6 < t2w1r9 && t2h1d6 < t2w1l9 && t2h1d6 < t2h1u9 && t2h1d6 < t2h1d9 && t2h1d6 < t2w1rwt9 && t2h1d6 < t2w1lwt9 && t2h1d6 < t2h1uwt9 && t2h1d6 < t2h1dwt9
  && t2h1d6 < t2w1r10 && t2h1d6 < t2w1l10 && t2h1d6 < t2h1u10 && t2h1d6 < t2h1d10 && t2h1d6 < t2w1rwt10 && t2h1d6 < t2w1lwt10 && t2h1d6 < t2h1uwt10 && t2h1d6 < t2h1dwt10
  && (louthd6 !=0 && linhd6!=0)){
  i=257;
  }

  if (myd6==-1 && t2h1d6 > 0 && t2h1d6 < t1 
  && t2h1d6 < t2w1r && t2h1d6 < t2w1l && t2h1d6 < t2h1u && t2h1d6 < t2h1d && t2h1d6 < t2w1rwt && t2h1d6 < t2w1lwt && t2h1d6 < t2h1uwt && t2h1d6 < t2h1dwt
  && t2h1d6 < t2w1r1 && t2h1d6 < t2w1l1 && t2h1d6 < t2h1u1 && t2h1d6 < t2h1d1 && t2h1d6 < t2w1rwt1 && t2h1d6 < t2w1lwt1 && t2h1d6 < t2h1uwt1 && t2h1d6 < t2h1dwt1
  && t2h1d6 < t2w1r2 && t2h1d6 < t2w1l2 && t2h1d6 < t2h1u2 && t2h1d6 < t2h1d2 && t2h1d6 < t2w1rwt2 && t2h1d6 < t2w1lwt2 && t2h1d6 < t2h1uwt2 && t2h1d6 < t2h1dwt2
  && t2h1d6 < t2w1r3 && t2h1d6 < t2w1l3 && t2h1d6 < t2h1u3 && t2h1d6 < t2h1d3 && t2h1d6 < t2w1rwt3 && t2h1d6 < t2w1lwt3 && t2h1d6 < t2h1uwt3 && t2h1d6 < t2h1dwt3
  && t2h1d6 < t2w1r4 && t2h1d6 < t2w1l4 && t2h1d6 < t2h1u4 && t2h1d6 < t2h1d4 && t2h1d6 < t2w1rwt4 && t2h1d6 < t2w1lwt4 && t2h1d6 < t2h1uwt4 && t2h1d6 < t2h1dwt4
  && t2h1d6 < t2w1r5 && t2h1d6 < t2w1l5 && t2h1d6 < t2h1u5 && t2h1d6 < t2h1d5 && t2h1d6 < t2w1rwt5 && t2h1d6 < t2w1lwt5 && t2h1d6 < t2h1uwt5 && t2h1d6 < t2h1dwt5
  && t2h1d6 < t2w1r6 && t2h1d6 < t2w1l6 && t2h1d6 < t2h1u6 && t2h1d6 < t2w1rwt6 && t2h1d6 < t2w1lwt6 && t2h1d6 < t2h1uwt6 && t2h1d6 < t2h1dwt6
  && t2h1d6 < t2w1r7 && t2h1d6 < t2w1l7 && t2h1d6 < t2h1u7 && t2h1d6 < t2h1d7 && t2h1d6 < t2w1rwt7 && t2h1d6 < t2w1lwt7 && t2h1d6 < t2h1uwt7 && t2h1d6 < t2h1dwt7
  && t2h1d6 < t2w1r8 && t2h1d6 < t2w1l8 && t2h1d6 < t2h1u8 && t2h1d6 < t2h1d8 && t2h1d6 < t2w1rwt8 && t2h1d6 < t2w1lwt8 && t2h1d6 < t2h1uwt8 && t2h1d6 < t2h1dwt8
  && t2h1d6 < t2w1r9 && t2h1d6 < t2w1l9 && t2h1d6 < t2h1u9 && t2h1d6 < t2h1d9 && t2h1d6 < t2w1rwt9 && t2h1d6 < t2w1lwt9 && t2h1d6 < t2h1uwt9 && t2h1d6 < t2h1dwt9
  && t2h1d6 < t2w1r10 && t2h1d6 < t2w1l10 && t2h1d6 < t2h1u10 && t2h1d6 < t2h1d10 && t2h1d6 < t2w1rwt10 && t2h1d6 < t2w1lwt10 && t2h1d6 < t2h1uwt10 && t2h1d6 < t2h1dwt10
  && ((louthd6 !=0 && linhd6==0) || (louthd6 ==0 && linhd6!=0))){
  i=257;
  }

  if (myd6==-1 && t2h1d6 > 0 && t2h1d6 < t1 
  && t2h1d6 < t2w1r && t2h1d6 < t2w1l && t2h1d6 < t2h1u && t2h1d6 < t2h1d && t2h1d6 < t2w1rwt && t2h1d6 < t2w1lwt && t2h1d6 < t2h1uwt && t2h1d6 < t2h1dwt
  && t2h1d6 < t2w1r1 && t2h1d6 < t2w1l1 && t2h1d6 < t2h1u1 && t2h1d6 < t2h1d1 && t2h1d6 < t2w1rwt1 && t2h1d6 < t2w1lwt1 && t2h1d6 < t2h1uwt1 && t2h1d6 < t2h1dwt1
  && t2h1d6 < t2w1r2 && t2h1d6 < t2w1l2 && t2h1d6 < t2h1u2 && t2h1d6 < t2h1d2 && t2h1d6 < t2w1rwt2 && t2h1d6 < t2w1lwt2 && t2h1d6 < t2h1uwt2 && t2h1d6 < t2h1dwt2
  && t2h1d6 < t2w1r3 && t2h1d6 < t2w1l3 && t2h1d6 < t2h1u3 && t2h1d6 < t2h1d3 && t2h1d6 < t2w1rwt3 && t2h1d6 < t2w1lwt3 && t2h1d6 < t2h1uwt3 && t2h1d6 < t2h1dwt3
  && t2h1d6 < t2w1r4 && t2h1d6 < t2w1l4 && t2h1d6 < t2h1u4 && t2h1d6 < t2h1d4 && t2h1d6 < t2w1rwt4 && t2h1d6 < t2w1lwt4 && t2h1d6 < t2h1uwt4 && t2h1d6 < t2h1dwt4
  && t2h1d6 < t2w1r5 && t2h1d6 < t2w1l5 && t2h1d6 < t2h1u5 && t2h1d6 < t2h1d5 && t2h1d6 < t2w1rwt5 && t2h1d6 < t2w1lwt5 && t2h1d6 < t2h1uwt5 && t2h1d6 < t2h1dwt5
  && t2h1d6 < t2w1r6 && t2h1d6 < t2w1l6 && t2h1d6 < t2h1u6 && t2h1d6 < t2w1rwt6 && t2h1d6 < t2w1lwt6 && t2h1d6 < t2h1uwt6 && t2h1d6 < t2h1dwt6
  && t2h1d6 < t2w1r7 && t2h1d6 < t2w1l7 && t2h1d6 < t2h1u7 && t2h1d6 < t2h1d7 && t2h1d6 < t2w1rwt7 && t2h1d6 < t2w1lwt7 && t2h1d6 < t2h1uwt7 && t2h1d6 < t2h1dwt7
  && t2h1d6 < t2w1r8 && t2h1d6 < t2w1l8 && t2h1d6 < t2h1u8 && t2h1d6 < t2h1d8 && t2h1d6 < t2w1rwt8 && t2h1d6 < t2w1lwt8 && t2h1d6 < t2h1uwt8 && t2h1d6 < t2h1dwt8
  && t2h1d6 < t2w1r9 && t2h1d6 < t2w1l9 && t2h1d6 < t2h1u9 && t2h1d6 < t2h1d9 && t2h1d6 < t2w1rwt9 && t2h1d6 < t2w1lwt9 && t2h1d6 < t2h1uwt9 && t2h1d6 < t2h1dwt9
  && t2h1d6 < t2w1r10 && t2h1d6 < t2w1l10 && t2h1d6 < t2h1u10 && t2h1d6 < t2h1d10 && t2h1d6 < t2w1rwt10 && t2h1d6 < t2w1lwt10 && t2h1d6 < t2h1uwt10 && t2h1d6 < t2h1dwt10
  && (louthd6 == 0 && linhd6 == 0)){
  i=257;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW6!=-1 && t2w1rwt6 > 0 && t2w1rwt6 < t1 
  && t2w1rwt6 < t2w1r && t2w1rwt6 < t2w1l && t2w1rwt6 < t2h1u && t2w1rwt6 < t2h1d && t2w1rwt6 <t2w1rwt && t2w1rwt6 <t2w1lwt && t2w1rwt6 < t2h1uwt && t2w1rwt6 < t2h1dwt
  && t2w1rwt6 < t2w1r1 && t2w1rwt6 < t2w1l1 && t2w1rwt6 < t2h1u1 && t2w1rwt6 < t2h1d1 && t2w1rwt6 <t2w1rwt1 && t2w1rwt6 <t2w1lwt1 && t2w1rwt6 < t2h1uwt1 && t2w1rwt6 < t2h1dwt1
  && t2w1rwt6 < t2w1r2 && t2w1rwt6 < t2w1l2 && t2w1rwt6 < t2h1u2 && t2w1rwt6 < t2h1d2 && t2w1rwt6 <t2w1rwt2 && t2w1rwt6 <t2w1lwt2 && t2w1rwt6 < t2h1uwt2 && t2w1rwt6 < t2h1dwt2
  && t2w1rwt6 < t2w1r3 && t2w1rwt6 < t2w1l3 && t2w1rwt6 < t2h1u3 && t2w1rwt6 < t2h1d3 && t2w1rwt6 <t2w1rwt3 && t2w1rwt6 <t2w1lwt3 && t2w1rwt6 < t2h1uwt3 && t2w1rwt6 < t2h1dwt3
  && t2w1rwt6 < t2w1r4 && t2w1rwt6 < t2w1l4 && t2w1rwt6 < t2h1u4 && t2w1rwt6 < t2h1d4 && t2w1rwt6 <t2w1rwt4 && t2w1rwt6 <t2w1lwt4 && t2w1rwt6 < t2h1uwt4 && t2w1rwt6 < t2h1dwt4
  && t2w1rwt6 < t2w1r5 && t2w1rwt6 < t2w1l5 && t2w1rwt6 < t2h1u5 && t2w1rwt6 < t2h1d5 && t2w1rwt6 <t2w1rwt5 && t2w1rwt6 <t2w1lwt5 && t2w1rwt6 < t2h1uwt5 && t2w1rwt6 < t2h1dwt5
  && t2w1rwt6 < t2w1r6 && t2w1rwt6 < t2w1l6 && t2w1rwt6 < t2h1u6 && t2w1rwt6 < t2h1d6 && t2w1rwt6 <t2w1lwt6 && t2w1rwt6 < t2h1uwt6 && t2w1rwt6 < t2h1dwt6
  && t2w1rwt6 < t2w1r7 && t2w1rwt6 < t2w1l7 && t2w1rwt6 < t2h1u7 && t2w1rwt6 < t2h1d7 && t2w1rwt6 <t2w1rwt7 && t2w1rwt6 <t2w1lwt7 && t2w1rwt6 < t2h1uwt7 && t2w1rwt6 < t2h1dwt7
  && t2w1rwt6 < t2w1r8 && t2w1rwt6 < t2w1l8 && t2w1rwt6 < t2h1u8 && t2w1rwt6 < t2h1d8 && t2w1rwt6 <t2w1rwt8 && t2w1rwt6 <t2w1lwt8 && t2w1rwt6 < t2h1uwt8 && t2w1rwt6 < t2h1dwt8
  && t2w1rwt6 < t2w1r9 && t2w1rwt6 < t2w1l9 && t2w1rwt6 < t2h1u9 && t2w1rwt6 < t2h1d9 && t2w1rwt6 <t2w1rwt9 && t2w1rwt6 <t2w1lwt9 && t2w1rwt6 < t2h1uwt9 && t2w1rwt6 < t2h1dwt9
  && t2w1rwt6 < t2w1r10 && t2w1rwt6 < t2w1l10 && t2w1rwt6 < t2h1u10 && t2w1rwt6 < t2h1d10 && t2w1rwt6 <t2w1rwt10 && t2w1rwt6 <t2w1lwt10 && t2w1rwt6 < t2h1uwt10 && t2w1rwt6 < t2h1dwt10
  && ((linwr6!=0) && (loutwr6!=0) )){	
   if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1rwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1rwt6+z))*(z0hd6+(vz*t2w1rwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1rwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1rwt6+z))*(z0hu6+(vz*t2w1rwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1rwt6+y;
  xtest=vx*t2w1rwt6+x;
  xlimitrwt=-bwrwt6*sqrt(1-((vz*t2w1rwt6+z)+z0wr6)*((vz*t2w1rwt6+z)+z0wr6)/a2wrwt6);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW6 > 0){
  i=262;
  }
  else{
  i=274;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW6!=-1 && t2w1rwt6 > 0 && t2w1rwt6 < t1 
  && t2w1rwt6 < t2w1r && t2w1rwt6 < t2w1l && t2w1rwt6 < t2h1u && t2w1rwt6 < t2h1d && t2w1rwt6 <t2w1rwt && t2w1rwt6 <t2w1lwt && t2w1rwt6 < t2h1uwt && t2w1rwt6 < t2h1dwt
  && t2w1rwt6 < t2w1r1 && t2w1rwt6 < t2w1l1 && t2w1rwt6 < t2h1u1 && t2w1rwt6 < t2h1d1 && t2w1rwt6 <t2w1rwt1 && t2w1rwt6 <t2w1lwt1 && t2w1rwt6 < t2h1uwt1 && t2w1rwt6 < t2h1dwt1
  && t2w1rwt6 < t2w1r2 && t2w1rwt6 < t2w1l2 && t2w1rwt6 < t2h1u2 && t2w1rwt6 < t2h1d2 && t2w1rwt6 <t2w1rwt2 && t2w1rwt6 <t2w1lwt2 && t2w1rwt6 < t2h1uwt2 && t2w1rwt6 < t2h1dwt2
  && t2w1rwt6 < t2w1r3 && t2w1rwt6 < t2w1l3 && t2w1rwt6 < t2h1u3 && t2w1rwt6 < t2h1d3 && t2w1rwt6 <t2w1rwt3 && t2w1rwt6 <t2w1lwt3 && t2w1rwt6 < t2h1uwt3 && t2w1rwt6 < t2h1dwt3
  && t2w1rwt6 < t2w1r4 && t2w1rwt6 < t2w1l4 && t2w1rwt6 < t2h1u4 && t2w1rwt6 < t2h1d4 && t2w1rwt6 <t2w1rwt4 && t2w1rwt6 <t2w1lwt4 && t2w1rwt6 < t2h1uwt4 && t2w1rwt6 < t2h1dwt4
  && t2w1rwt6 < t2w1r5 && t2w1rwt6 < t2w1l5 && t2w1rwt6 < t2h1u5 && t2w1rwt6 < t2h1d5 && t2w1rwt6 <t2w1rwt5 && t2w1rwt6 <t2w1lwt5 && t2w1rwt6 < t2h1uwt5 && t2w1rwt6 < t2h1dwt5
  && t2w1rwt6 < t2w1r6 && t2w1rwt6 < t2w1l6 && t2w1rwt6 < t2h1u6 && t2w1rwt6 < t2h1d6 && t2w1rwt6 <t2w1lwt6 && t2w1rwt6 < t2h1uwt6 && t2w1rwt6 < t2h1dwt6
  && t2w1rwt6 < t2w1r7 && t2w1rwt6 < t2w1l7 && t2w1rwt6 < t2h1u7 && t2w1rwt6 < t2h1d7 && t2w1rwt6 <t2w1rwt7 && t2w1rwt6 <t2w1lwt7 && t2w1rwt6 < t2h1uwt7 && t2w1rwt6 < t2h1dwt7
  && t2w1rwt6 < t2w1r8 && t2w1rwt6 < t2w1l8 && t2w1rwt6 < t2h1u8 && t2w1rwt6 < t2h1d8 && t2w1rwt6 <t2w1rwt8 && t2w1rwt6 <t2w1lwt8 && t2w1rwt6 < t2h1uwt8 && t2w1rwt6 < t2h1dwt8
  && t2w1rwt6 < t2w1r9 && t2w1rwt6 < t2w1l9 && t2w1rwt6 < t2h1u9 && t2w1rwt6 < t2h1d9 && t2w1rwt6 <t2w1rwt9 && t2w1rwt6 <t2w1lwt9 && t2w1rwt6 < t2h1uwt9 && t2w1rwt6 < t2h1dwt9
  && t2w1rwt6 < t2w1r10 && t2w1rwt6 < t2w1l10 && t2w1rwt6 < t2h1u10 && t2w1rwt6 < t2h1d10 && t2w1rwt6 <t2w1rwt10 && t2w1rwt6 <t2w1lwt10 && t2w1rwt6 < t2h1uwt10 && t2w1rwt6 < t2h1dwt10
  && ((loutwr6!=0 && linwr6==0) || (loutwr6==0 && linwr6!=0))){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1rwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1rwt6+z))*(z0hd6+(vz*t2w1rwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1rwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1rwt6+z))*(z0hu6+(vz*t2w1rwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1rwt6+y;
  xtest=vx*t2w1rwt6+x;
  xlimitr=-sqrt((pbwrwt6-(vz*t2w1rwt6+z))/pawrwt6);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW6 > 0){
  i=263; 
  }else{
  i=274;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW6!=-1 && t2w1rwt6 > 0 && t2w1rwt6 < t1 
  && t2w1rwt6 < t2w1r && t2w1rwt6 < t2w1l && t2w1rwt6 < t2h1u && t2w1rwt6 < t2h1d && t2w1rwt6 <t2w1rwt && t2w1rwt6 <t2w1lwt && t2w1rwt6 < t2h1uwt && t2w1rwt6 < t2h1dwt
  && t2w1rwt6 < t2w1r1 && t2w1rwt6 < t2w1l1 && t2w1rwt6 < t2h1u1 && t2w1rwt6 < t2h1d1 && t2w1rwt6 <t2w1rwt1 && t2w1rwt6 <t2w1lwt1 && t2w1rwt6 < t2h1uwt1 && t2w1rwt6 < t2h1dwt1
  && t2w1rwt6 < t2w1r2 && t2w1rwt6 < t2w1l2 && t2w1rwt6 < t2h1u2 && t2w1rwt6 < t2h1d2 && t2w1rwt6 <t2w1rwt2 && t2w1rwt6 <t2w1lwt2 && t2w1rwt6 < t2h1uwt2 && t2w1rwt6 < t2h1dwt2
  && t2w1rwt6 < t2w1r3 && t2w1rwt6 < t2w1l3 && t2w1rwt6 < t2h1u3 && t2w1rwt6 < t2h1d3 && t2w1rwt6 <t2w1rwt3 && t2w1rwt6 <t2w1lwt3 && t2w1rwt6 < t2h1uwt3 && t2w1rwt6 < t2h1dwt3
  && t2w1rwt6 < t2w1r4 && t2w1rwt6 < t2w1l4 && t2w1rwt6 < t2h1u4 && t2w1rwt6 < t2h1d4 && t2w1rwt6 <t2w1rwt4 && t2w1rwt6 <t2w1lwt4 && t2w1rwt6 < t2h1uwt4 && t2w1rwt6 < t2h1dwt4
  && t2w1rwt6 < t2w1r5 && t2w1rwt6 < t2w1l5 && t2w1rwt6 < t2h1u5 && t2w1rwt6 < t2h1d5 && t2w1rwt6 <t2w1rwt5 && t2w1rwt6 <t2w1lwt5 && t2w1rwt6 < t2h1uwt5 && t2w1rwt6 < t2h1dwt5
  && t2w1rwt6 < t2w1r6 && t2w1rwt6 < t2w1l6 && t2w1rwt6 < t2h1u6 && t2w1rwt6 < t2h1d6 && t2w1rwt6 <t2w1lwt6 && t2w1rwt6 < t2h1uwt6 && t2w1rwt6 < t2h1dwt6
  && t2w1rwt6 < t2w1r7 && t2w1rwt6 < t2w1l7 && t2w1rwt6 < t2h1u7 && t2w1rwt6 < t2h1d7 && t2w1rwt6 <t2w1rwt7 && t2w1rwt6 <t2w1lwt7 && t2w1rwt6 < t2h1uwt7 && t2w1rwt6 < t2h1dwt7
  && t2w1rwt6 < t2w1r8 && t2w1rwt6 < t2w1l8 && t2w1rwt6 < t2h1u8 && t2w1rwt6 < t2h1d8 && t2w1rwt6 <t2w1rwt8 && t2w1rwt6 <t2w1lwt8 && t2w1rwt6 < t2h1uwt8 && t2w1rwt6 < t2h1dwt8
  && t2w1rwt6 < t2w1r9 && t2w1rwt6 < t2w1l9 && t2w1rwt6 < t2h1u9 && t2w1rwt6 < t2h1d9 && t2w1rwt6 <t2w1rwt9 && t2w1rwt6 <t2w1lwt9 && t2w1rwt6 < t2h1uwt9 && t2w1rwt6 < t2h1dwt9
  && t2w1rwt6 < t2w1r10 && t2w1rwt6 < t2w1l10 && t2w1rwt6 < t2h1u10 && t2w1rwt6 < t2h1d10 && t2w1rwt6 <t2w1rwt10 && t2w1rwt6 <t2w1lwt10 && t2w1rwt6 < t2h1uwt10 && t2w1rwt6 < t2h1dwt10
  && (loutwr6==0 && linwr6==0)){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1rwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1rwt6+z))*(z0hd6+(vz*t2w1rwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1rwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1rwt6+z))*(z0hu6+(vz*t2w1rwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1rwt6+y; 
  xtest=vx*t2w1rwt6+x;
  xlimitr=-(-w2r6+w1r6)*(vz*t2w1rwt6+z)/l-w1rwt6;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW6>0){
  i=264;
  }else{
  i=274;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW6!=-1 && t2w1lwt6 > 0 && t2w1lwt6 < t1 
  && t2w1lwt6 < t2w1r && t2w1lwt6 < t2w1l && t2w1lwt6 < t2h1u && t2w1lwt6 < t2h1d && t2w1lwt6 <t2w1rwt && t2w1lwt6 <t2w1lwt && t2w1lwt6 < t2h1uwt && t2w1lwt6 < t2h1dwt
  && t2w1lwt6 < t2w1r1 && t2w1lwt6 < t2w1l1 && t2w1lwt6 < t2h1u1 && t2w1lwt6 < t2h1d1 && t2w1lwt6 <t2w1rwt1 && t2w1lwt6 <t2w1lwt1 && t2w1lwt6 < t2h1uwt1 && t2w1lwt6 < t2h1dwt1
  && t2w1lwt6 < t2w1r2 && t2w1lwt6 < t2w1l2 && t2w1lwt6 < t2h1u2 && t2w1lwt6 < t2h1d2 && t2w1lwt6 <t2w1rwt2 && t2w1lwt6 <t2w1lwt2 && t2w1lwt6 < t2h1uwt2 && t2w1lwt6 < t2h1dwt2
  && t2w1lwt6 < t2w1r3 && t2w1lwt6 < t2w1l3 && t2w1lwt6 < t2h1u3 && t2w1lwt6 < t2h1d3 && t2w1lwt6 <t2w1rwt3 && t2w1lwt6 <t2w1lwt3 && t2w1lwt6 < t2h1uwt3 && t2w1lwt6 < t2h1dwt3
  && t2w1lwt6 < t2w1r4 && t2w1lwt6 < t2w1l4 && t2w1lwt6 < t2h1u4 && t2w1lwt6 < t2h1d4 && t2w1lwt6 <t2w1rwt4 && t2w1lwt6 <t2w1lwt4 && t2w1lwt6 < t2h1uwt4 && t2w1lwt6 < t2h1dwt4
  && t2w1lwt6 < t2w1r5 && t2w1lwt6 < t2w1l5 && t2w1lwt6 < t2h1u5 && t2w1lwt6 < t2h1d5 && t2w1lwt6 <t2w1rwt5 && t2w1lwt6 <t2w1lwt5 && t2w1lwt6 < t2h1uwt5 && t2w1lwt6 < t2h1dwt5
  && t2w1lwt6 < t2w1r6 && t2w1lwt6 < t2w1l6 && t2w1lwt6 < t2h1u6 && t2w1lwt6 < t2h1d6 && t2w1lwt6 <t2w1rwt6 && t2w1lwt6 < t2h1uwt6 && t2w1lwt6 < t2h1dwt6
  && t2w1lwt6 < t2w1r7 && t2w1lwt6 < t2w1l7 && t2w1lwt6 < t2h1u7 && t2w1lwt6 < t2h1d7 && t2w1lwt6 <t2w1rwt7 && t2w1lwt6 <t2w1lwt7 && t2w1lwt6 < t2h1uwt7 && t2w1lwt6 < t2h1dwt7
  && t2w1lwt6 < t2w1r8 && t2w1lwt6 < t2w1l8 && t2w1lwt6 < t2h1u8 && t2w1lwt6 < t2h1d8 && t2w1lwt6 <t2w1rwt8 && t2w1lwt6 <t2w1lwt8 && t2w1lwt6 < t2h1uwt8 && t2w1lwt6 < t2h1dwt8
  && t2w1lwt6 < t2w1r9 && t2w1lwt6 < t2w1l9 && t2w1lwt6 < t2h1u9 && t2w1lwt6 < t2h1d9 && t2w1lwt6 <t2w1rwt9 && t2w1lwt6 <t2w1lwt9 && t2w1lwt6 < t2h1uwt9 && t2w1lwt6 < t2h1dwt9
  && t2w1lwt6 < t2w1r10 && t2w1lwt6 < t2w1l10 && t2w1lwt6 < t2h1u10 && t2w1lwt6 < t2h1d10 && t2w1lwt6 <t2w1rwt10 && t2w1lwt6 <t2w1lwt10 && t2w1lwt6 < t2h1uwt10 && t2w1lwt6 < t2h1dwt10
  && ((linwl6!=0) && (loutwl6!=0) )){
  if(linhd6==0 && louthd6==0)
   if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1lwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1lwt6+z))*(z0hd6+(vz*t2w1lwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1lwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1lwt6+z))*(z0hu6+(vz*t2w1lwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1lwt6+y;
  xtest=vx*t2w1lwt6+x;
  xlimitlwt=-bwlwt6*sqrt(1-((vz*t2w1lwt6+z)+z0wl6)*((vz*t2w1lwt6+z)+z0wl6)/a2wlwt6);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW6>0){
  i=265;
  }else{
  i=275;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW6!=-1 && t2w1lwt6 > 0 && t2w1lwt6 < t1 
  && t2w1lwt6 < t2w1r && t2w1lwt6 < t2w1l && t2w1lwt6 < t2h1u && t2w1lwt6 < t2h1d && t2w1lwt6 <t2w1rwt && t2w1lwt6 <t2w1lwt && t2w1lwt6 < t2h1uwt && t2w1lwt6 < t2h1dwt
  && t2w1lwt6 < t2w1r1 && t2w1lwt6 < t2w1l1 && t2w1lwt6 < t2h1u1 && t2w1lwt6 < t2h1d1 && t2w1lwt6 <t2w1rwt1 && t2w1lwt6 <t2w1lwt1 && t2w1lwt6 < t2h1uwt1 && t2w1lwt6 < t2h1dwt1
  && t2w1lwt6 < t2w1r2 && t2w1lwt6 < t2w1l2 && t2w1lwt6 < t2h1u2 && t2w1lwt6 < t2h1d2 && t2w1lwt6 <t2w1rwt2 && t2w1lwt6 <t2w1lwt2 && t2w1lwt6 < t2h1uwt2 && t2w1lwt6 < t2h1dwt2
  && t2w1lwt6 < t2w1r3 && t2w1lwt6 < t2w1l3 && t2w1lwt6 < t2h1u3 && t2w1lwt6 < t2h1d3 && t2w1lwt6 <t2w1rwt3 && t2w1lwt6 <t2w1lwt3 && t2w1lwt6 < t2h1uwt3 && t2w1lwt6 < t2h1dwt3
  && t2w1lwt6 < t2w1r4 && t2w1lwt6 < t2w1l4 && t2w1lwt6 < t2h1u4 && t2w1lwt6 < t2h1d4 && t2w1lwt6 <t2w1rwt4 && t2w1lwt6 <t2w1lwt4 && t2w1lwt6 < t2h1uwt4 && t2w1lwt6 < t2h1dwt4
  && t2w1lwt6 < t2w1r5 && t2w1lwt6 < t2w1l5 && t2w1lwt6 < t2h1u5 && t2w1lwt6 < t2h1d5 && t2w1lwt6 <t2w1rwt5 && t2w1lwt6 <t2w1lwt5 && t2w1lwt6 < t2h1uwt5 && t2w1lwt6 < t2h1dwt5
  && t2w1lwt6 < t2w1r6 && t2w1lwt6 < t2w1l6 && t2w1lwt6 < t2h1u6 && t2w1lwt6 < t2h1d6 && t2w1lwt6 <t2w1rwt6 && t2w1lwt6 < t2h1uwt6 && t2w1lwt6 < t2h1dwt6
  && t2w1lwt6 < t2w1r7 && t2w1lwt6 < t2w1l7 && t2w1lwt6 < t2h1u7 && t2w1lwt6 < t2h1d7 && t2w1lwt6 <t2w1rwt7 && t2w1lwt6 <t2w1lwt7 && t2w1lwt6 < t2h1uwt7 && t2w1lwt6 < t2h1dwt7
  && t2w1lwt6 < t2w1r8 && t2w1lwt6 < t2w1l8 && t2w1lwt6 < t2h1u8 && t2w1lwt6 < t2h1d8 && t2w1lwt6 <t2w1rwt8 && t2w1lwt6 <t2w1lwt8 && t2w1lwt6 < t2h1uwt8 && t2w1lwt6 < t2h1dwt8
  && t2w1lwt6 < t2w1r9 && t2w1lwt6 < t2w1l9 && t2w1lwt6 < t2h1u9 && t2w1lwt6 < t2h1d9 && t2w1lwt6 <t2w1rwt9 && t2w1lwt6 <t2w1lwt9 && t2w1lwt6 < t2h1uwt9 && t2w1lwt6 < t2h1dwt9
  && t2w1lwt6 < t2w1r10 && t2w1lwt6 < t2w1l10 && t2w1lwt6 < t2h1u10 && t2w1lwt6 < t2h1d10 && t2w1lwt6 <t2w1rwt10 && t2w1lwt6 <t2w1lwt10 && t2w1lwt6 < t2h1uwt10 && t2w1lwt6 < t2h1dwt10
  && ((loutwl6!=0 && linwl6==0) || (loutwl6==0 && linwl6!=0))){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1lwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1lwt6+z))*(z0hd6+(vz*t2w1lwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1lwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1lwt6+z))*(z0hu6+(vz*t2w1lwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1lwt6+y;
  xtest=vx*t2w1lwt6+x;
  xlimitl=-sqrt((pbwlwt6-(vz*t2w1lwt6+z))/pawlwt6);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW6>0){
  i=266;
  }else{
  i=275;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW6!=-1 && t2w1lwt6 > 0 && t2w1lwt6 < t1 
  && t2w1lwt6 < t2w1r && t2w1lwt6 < t2w1l && t2w1lwt6 < t2h1u && t2w1lwt6 < t2h1d && t2w1lwt6 <t2w1rwt && t2w1lwt6 <t2w1lwt && t2w1lwt6 < t2h1uwt && t2w1lwt6 < t2h1dwt
  && t2w1lwt6 < t2w1r1 && t2w1lwt6 < t2w1l1 && t2w1lwt6 < t2h1u1 && t2w1lwt6 < t2h1d1 && t2w1lwt6 <t2w1rwt1 && t2w1lwt6 <t2w1lwt1 && t2w1lwt6 < t2h1uwt1 && t2w1lwt6 < t2h1dwt1
  && t2w1lwt6 < t2w1r2 && t2w1lwt6 < t2w1l2 && t2w1lwt6 < t2h1u2 && t2w1lwt6 < t2h1d2 && t2w1lwt6 <t2w1rwt2 && t2w1lwt6 <t2w1lwt2 && t2w1lwt6 < t2h1uwt2 && t2w1lwt6 < t2h1dwt2
  && t2w1lwt6 < t2w1r3 && t2w1lwt6 < t2w1l3 && t2w1lwt6 < t2h1u3 && t2w1lwt6 < t2h1d3 && t2w1lwt6 <t2w1rwt3 && t2w1lwt6 <t2w1lwt3 && t2w1lwt6 < t2h1uwt3 && t2w1lwt6 < t2h1dwt3
  && t2w1lwt6 < t2w1r4 && t2w1lwt6 < t2w1l4 && t2w1lwt6 < t2h1u4 && t2w1lwt6 < t2h1d4 && t2w1lwt6 <t2w1rwt4 && t2w1lwt6 <t2w1lwt4 && t2w1lwt6 < t2h1uwt4 && t2w1lwt6 < t2h1dwt4
  && t2w1lwt6 < t2w1r5 && t2w1lwt6 < t2w1l5 && t2w1lwt6 < t2h1u5 && t2w1lwt6 < t2h1d5 && t2w1lwt6 <t2w1rwt5 && t2w1lwt6 <t2w1lwt5 && t2w1lwt6 < t2h1uwt5 && t2w1lwt6 < t2h1dwt5
  && t2w1lwt6 < t2w1r6 && t2w1lwt6 < t2w1l6 && t2w1lwt6 < t2h1u6 && t2w1lwt6 < t2h1d6 && t2w1lwt6 <t2w1rwt6 && t2w1lwt6 < t2h1uwt6 && t2w1lwt6 < t2h1dwt6
  && t2w1lwt6 < t2w1r7 && t2w1lwt6 < t2w1l7 && t2w1lwt6 < t2h1u7 && t2w1lwt6 < t2h1d7 && t2w1lwt6 <t2w1rwt7 && t2w1lwt6 <t2w1lwt7 && t2w1lwt6 < t2h1uwt7 && t2w1lwt6 < t2h1dwt7
  && t2w1lwt6 < t2w1r8 && t2w1lwt6 < t2w1l8 && t2w1lwt6 < t2h1u8 && t2w1lwt6 < t2h1d8 && t2w1lwt6 <t2w1rwt8 && t2w1lwt6 <t2w1lwt8 && t2w1lwt6 < t2h1uwt8 && t2w1lwt6 < t2h1dwt8
  && t2w1lwt6 < t2w1r9 && t2w1lwt6 < t2w1l9 && t2w1lwt6 < t2h1u9 && t2w1lwt6 < t2h1d9 && t2w1lwt6 <t2w1rwt9 && t2w1lwt6 <t2w1lwt9 && t2w1lwt6 < t2h1uwt9 && t2w1lwt6 < t2h1dwt9
  && t2w1lwt6 < t2w1r10 && t2w1lwt6 < t2w1l10 && t2w1lwt6 < t2h1u10 && t2w1lwt6 < t2h1d10 && t2w1lwt6 <t2w1rwt10 && t2w1lwt6 <t2w1lwt10 && t2w1lwt6 < t2h1uwt10 && t2w1lwt6 < t2h1dwt10
  && (loutwl6==0 && linwl6==0)){
  if(linhd6==0 && louthd6==0)
   {
      ylimitd=(-h2d6+h1d6)/l*(vz*t2w1lwt6+z)-h1dwt6;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ylimitd=-bhdwt6*sqrt(1-((z0hd6+(vz*t2w1lwt6+z))*(z0hd6+(vz*t2w1lwt6+z)))/a2hdwt6);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt6+z)-pbhdwt6)/-pahdwt6);
      }
   }
   if(linhu6==0 && louthu6==0)
    {
     ylimitu=(h2u6-h1u6)/l*(vz*t2w1lwt6+z)+h1uwt6;
    }else{
     if(linhu6!=0 && louthu6!=0)
     {
     ylimitu=bhuwt6*sqrt(1-((z0hu6+(vz*t2w1lwt6+z))*(z0hu6+(vz*t2w1lwt6+z)))/a2huwt6);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt6+z)-pbhuwt6)/-pahuwt6);
    }
    }
  ytest=vy*t2w1lwt6+y; 
  xtest=vx*t2w1lwt6+x;
  xlimitl=(w2l6-w1l6)*(vz*t2w1lwt6+z)/l+w1lwt6;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW6>0){
  i=267;
  }else{
  i=275;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW6!=-1 && t2h1uwt6 > 0 && t2h1uwt6 < t1 
  && t2h1uwt6 < t2w1r && t2h1uwt6 < t2w1l && t2h1uwt6 < t2h1u && t2h1uwt6 < t2h1d && t2h1uwt6 < t2w1rwt && t2h1uwt6 < t2w1lwt && t2h1uwt6 < t2h1uwt && t2h1uwt6 < t2h1dwt 
  && t2h1uwt6 < t2w1r1 && t2h1uwt6 < t2w1l1 && t2h1uwt6 < t2h1u1 && t2h1uwt6 < t2h1d1 && t2h1uwt6 < t2w1rwt1 && t2h1uwt6 < t2w1lwt1 && t2h1uwt6 < t2h1uwt1 && t2h1uwt6 < t2h1dwt1
  && t2h1uwt6 < t2w1r2 && t2h1uwt6 < t2w1l2 && t2h1uwt6 < t2h1u2 && t2h1uwt6 < t2h1d2 && t2h1uwt6 < t2w1rwt2 && t2h1uwt6 < t2w1lwt2 && t2h1uwt6 < t2h1uwt2 && t2h1uwt6 < t2h1dwt2
  && t2h1uwt6 < t2w1r3 && t2h1uwt6 < t2w1l3 && t2h1uwt6 < t2h1u3 && t2h1uwt6 < t2h1d3 && t2h1uwt6 < t2w1rwt3 && t2h1uwt6 < t2w1lwt3 && t2h1uwt6 < t2h1uwt3 && t2h1uwt6 < t2h1dwt3
  && t2h1uwt6 < t2w1r4 && t2h1uwt6 < t2w1l4 && t2h1uwt6 < t2h1u4 && t2h1uwt6 < t2h1d4 && t2h1uwt6 < t2w1rwt4 && t2h1uwt6 < t2w1lwt4 && t2h1uwt6 < t2h1uwt4 && t2h1uwt6 < t2h1dwt4
  && t2h1uwt6 < t2w1r5 && t2h1uwt6 < t2w1l5 && t2h1uwt6 < t2h1u5 && t2h1uwt6 < t2h1d5 && t2h1uwt6 < t2w1rwt5 && t2h1uwt6 < t2w1lwt5 && t2h1uwt6 < t2h1uwt5 && t2h1uwt6 < t2h1dwt5
  && t2h1uwt6 < t2w1r6 && t2h1uwt6 < t2w1l6 && t2h1uwt6 < t2h1u6 && t2h1uwt6 < t2h1d6 && t2h1uwt6 < t2w1rwt6 && t2h1uwt6 < t2w1lwt6 && t2h1uwt6 < t2h1dwt6
  && t2h1uwt6 < t2w1r7 && t2h1uwt6 < t2w1l7 && t2h1uwt6 < t2h1u7 && t2h1uwt6 < t2h1d7 && t2h1uwt6 < t2w1rwt7 && t2h1uwt6 < t2w1lwt7 && t2h1uwt6 < t2h1uwt7 && t2h1uwt6 < t2h1dwt7
  && t2h1uwt6 < t2w1r8 && t2h1uwt6 < t2w1l8 && t2h1uwt6 < t2h1u8 && t2h1uwt6 < t2h1d8 && t2h1uwt6 < t2w1rwt8 && t2h1uwt6 < t2w1lwt8 && t2h1uwt6 < t2h1uwt8 && t2h1uwt6 < t2h1dwt8
  && t2h1uwt6 < t2w1r9 && t2h1uwt6 < t2w1l9 && t2h1uwt6 < t2h1u9 && t2h1uwt6 < t2h1d9 && t2h1uwt6 < t2w1rwt9 && t2h1uwt6 < t2w1lwt9 && t2h1uwt6 < t2h1uwt9 && t2h1uwt6 < t2h1dwt9
  && t2h1uwt6 < t2w1r10 && t2h1uwt6 < t2w1l10 && t2h1uwt6 < t2h1u10 && t2h1uwt6 < t2h1d10 && t2h1uwt6 < t2w1rwt10 && t2h1uwt6 < t2w1lwt10 && t2h1uwt6 < t2h1uwt10 && t2h1uwt6 < t2h1dwt10
  && (louthu6 !=0 && linhu6!=0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1uwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1uwt6+z))*(z0wr6+(vz*t2h1uwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1uwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1uwt6+z))*(z0wl6+(vz*t2h1uwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1uwt6+x;
  ytest=vy*t2w1lwt6+y;
  ylimitu=bhuwt6*sqrt(1-((vz*t2h1uwt6+z)+z0hu6)*((vz*t2h1uwt6+z)+z0hu6)/a2huwt6);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW6>0 ){
  i=268;
  }else{
  i=276;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW6!=-1 && t2h1uwt6 > 0 && t2h1uwt6 < t1 
  && t2h1uwt6 < t2w1r && t2h1uwt6 < t2w1l && t2h1uwt6 < t2h1u && t2h1uwt6 < t2h1d && t2h1uwt6 < t2w1rwt && t2h1uwt6 < t2w1lwt && t2h1uwt6 < t2h1uwt && t2h1uwt6 < t2h1dwt 
  && t2h1uwt6 < t2w1r1 && t2h1uwt6 < t2w1l1 && t2h1uwt6 < t2h1u1 && t2h1uwt6 < t2h1d1 && t2h1uwt6 < t2w1rwt1 && t2h1uwt6 < t2w1lwt1 && t2h1uwt6 < t2h1uwt1 && t2h1uwt6 < t2h1dwt1
  && t2h1uwt6 < t2w1r2 && t2h1uwt6 < t2w1l2 && t2h1uwt6 < t2h1u2 && t2h1uwt6 < t2h1d2 && t2h1uwt6 < t2w1rwt2 && t2h1uwt6 < t2w1lwt2 && t2h1uwt6 < t2h1uwt2 && t2h1uwt6 < t2h1dwt2
  && t2h1uwt6 < t2w1r3 && t2h1uwt6 < t2w1l3 && t2h1uwt6 < t2h1u3 && t2h1uwt6 < t2h1d3 && t2h1uwt6 < t2w1rwt3 && t2h1uwt6 < t2w1lwt3 && t2h1uwt6 < t2h1uwt3 && t2h1uwt6 < t2h1dwt3
  && t2h1uwt6 < t2w1r4 && t2h1uwt6 < t2w1l4 && t2h1uwt6 < t2h1u4 && t2h1uwt6 < t2h1d4 && t2h1uwt6 < t2w1rwt4 && t2h1uwt6 < t2w1lwt4 && t2h1uwt6 < t2h1uwt4 && t2h1uwt6 < t2h1dwt4
  && t2h1uwt6 < t2w1r5 && t2h1uwt6 < t2w1l5 && t2h1uwt6 < t2h1u5 && t2h1uwt6 < t2h1d5 && t2h1uwt6 < t2w1rwt5 && t2h1uwt6 < t2w1lwt5 && t2h1uwt6 < t2h1uwt5 && t2h1uwt6 < t2h1dwt5
  && t2h1uwt6 < t2w1r6 && t2h1uwt6 < t2w1l6 && t2h1uwt6 < t2h1u6 && t2h1uwt6 < t2h1d6 && t2h1uwt6 < t2w1rwt6 && t2h1uwt6 < t2w1lwt6 && t2h1uwt6 < t2h1dwt6
  && t2h1uwt6 < t2w1r7 && t2h1uwt6 < t2w1l7 && t2h1uwt6 < t2h1u7 && t2h1uwt6 < t2h1d7 && t2h1uwt6 < t2w1rwt7 && t2h1uwt6 < t2w1lwt7 && t2h1uwt6 < t2h1uwt7 && t2h1uwt6 < t2h1dwt7
  && t2h1uwt6 < t2w1r8 && t2h1uwt6 < t2w1l8 && t2h1uwt6 < t2h1u8 && t2h1uwt6 < t2h1d8 && t2h1uwt6 < t2w1rwt8 && t2h1uwt6 < t2w1lwt8 && t2h1uwt6 < t2h1uwt8 && t2h1uwt6 < t2h1dwt8
  && t2h1uwt6 < t2w1r9 && t2h1uwt6 < t2w1l9 && t2h1uwt6 < t2h1u9 && t2h1uwt6 < t2h1d9 && t2h1uwt6 < t2w1rwt9 && t2h1uwt6 < t2w1lwt9 && t2h1uwt6 < t2h1uwt9 && t2h1uwt6 < t2h1dwt9
  && t2h1uwt6 < t2w1r10 && t2h1uwt6 < t2w1l10 && t2h1uwt6 < t2h1u10 && t2h1uwt6 < t2h1d10 && t2h1uwt6 < t2w1rwt10 && t2h1uwt6 < t2w1lwt10 && t2h1uwt6 < t2h1uwt10 && t2h1uwt6 < t2h1dwt10
  && ((louthu6!=0 && linhu6==0) || (louthu6==0 && linhu6!=0))){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1uwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1uwt6+z))*(z0wr6+(vz*t2h1uwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1uwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1uwt6+z))*(z0wl6+(vz*t2h1uwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1uwt6+x;
  ytest=vy*t2w1lwt6+y;
  ylimitu=sqrt((pbhuwt6-(vz*t2h1uwt6+z))/pahuwt6);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW6>0){
  i=269;
  }else{
  i=276;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW6!=-1 && t2h1uwt6 > 0 && t2h1uwt6 < t1 
  && t2h1uwt6 < t2w1r && t2h1uwt6 < t2w1l && t2h1uwt6 < t2h1u && t2h1uwt6 < t2h1d && t2h1uwt6 < t2w1rwt && t2h1uwt6 < t2w1lwt && t2h1uwt6 < t2h1uwt && t2h1uwt6 < t2h1dwt 
  && t2h1uwt6 < t2w1r1 && t2h1uwt6 < t2w1l1 && t2h1uwt6 < t2h1u1 && t2h1uwt6 < t2h1d1 && t2h1uwt6 < t2w1rwt1 && t2h1uwt6 < t2w1lwt1 && t2h1uwt6 < t2h1uwt1 && t2h1uwt6 < t2h1dwt1
  && t2h1uwt6 < t2w1r2 && t2h1uwt6 < t2w1l2 && t2h1uwt6 < t2h1u2 && t2h1uwt6 < t2h1d2 && t2h1uwt6 < t2w1rwt2 && t2h1uwt6 < t2w1lwt2 && t2h1uwt6 < t2h1uwt2 && t2h1uwt6 < t2h1dwt2
  && t2h1uwt6 < t2w1r3 && t2h1uwt6 < t2w1l3 && t2h1uwt6 < t2h1u3 && t2h1uwt6 < t2h1d3 && t2h1uwt6 < t2w1rwt3 && t2h1uwt6 < t2w1lwt3 && t2h1uwt6 < t2h1uwt3 && t2h1uwt6 < t2h1dwt3
  && t2h1uwt6 < t2w1r4 && t2h1uwt6 < t2w1l4 && t2h1uwt6 < t2h1u4 && t2h1uwt6 < t2h1d4 && t2h1uwt6 < t2w1rwt4 && t2h1uwt6 < t2w1lwt4 && t2h1uwt6 < t2h1uwt4 && t2h1uwt6 < t2h1dwt4
  && t2h1uwt6 < t2w1r5 && t2h1uwt6 < t2w1l5 && t2h1uwt6 < t2h1u5 && t2h1uwt6 < t2h1d5 && t2h1uwt6 < t2w1rwt5 && t2h1uwt6 < t2w1lwt5 && t2h1uwt6 < t2h1uwt5 && t2h1uwt6 < t2h1dwt5
  && t2h1uwt6 < t2w1r6 && t2h1uwt6 < t2w1l6 && t2h1uwt6 < t2h1u6 && t2h1uwt6 < t2h1d6 && t2h1uwt6 < t2w1rwt6 && t2h1uwt6 < t2w1lwt6 && t2h1uwt6 < t2h1dwt6
  && t2h1uwt6 < t2w1r7 && t2h1uwt6 < t2w1l7 && t2h1uwt6 < t2h1u7 && t2h1uwt6 < t2h1d7 && t2h1uwt6 < t2w1rwt7 && t2h1uwt6 < t2w1lwt7 && t2h1uwt6 < t2h1uwt7 && t2h1uwt6 < t2h1dwt7
  && t2h1uwt6 < t2w1r8 && t2h1uwt6 < t2w1l8 && t2h1uwt6 < t2h1u8 && t2h1uwt6 < t2h1d8 && t2h1uwt6 < t2w1rwt8 && t2h1uwt6 < t2w1lwt8 && t2h1uwt6 < t2h1uwt8 && t2h1uwt6 < t2h1dwt8
  && t2h1uwt6 < t2w1r9 && t2h1uwt6 < t2w1l9 && t2h1uwt6 < t2h1u9 && t2h1uwt6 < t2h1d9 && t2h1uwt6 < t2w1rwt9 && t2h1uwt6 < t2w1lwt9 && t2h1uwt6 < t2h1uwt9 && t2h1uwt6 < t2h1dwt9
  && t2h1uwt6 < t2w1r10 && t2h1uwt6 < t2w1l10 && t2h1uwt6 < t2h1u10 && t2h1uwt6 < t2h1d10 && t2h1uwt6 < t2w1rwt10 && t2h1uwt6 < t2w1lwt10 && t2h1uwt6 < t2h1uwt10 && t2h1uwt6 < t2h1dwt10
  && (louthu6 == 0 && linhu6 == 0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1uwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1uwt6+z))*(z0wr6+(vz*t2h1uwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1uwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1uwt6+z))*(z0wl6+(vz*t2h1uwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1uwt6+x;
  ytest=vy*t2w1lwt6+y;
  ylimitu=(h2u6-h1u6)*(vz*t2h1uwt6+z)/l+h1uwt6;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW6>0 ){
  i=270;
  }else{
  i=276;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW6!=-1 && t2h1dwt6 > 0 && t2h1dwt6 < t1 
  && t2h1dwt6 < t2w1r && t2h1dwt6 < t2w1l && t2h1dwt6 < t2h1u && t2h1dwt6 < t2h1d && t2h1dwt6 < t2w1rwt && t2h1dwt6 < t2w1lwt && t2h1dwt6 < t2h1uwt && t2h1dwt6 < t2h1dwt 
  && t2h1dwt6 < t2w1r1 && t2h1dwt6 < t2w1l1 && t2h1dwt6 < t2h1u1 && t2h1dwt6 < t2h1d1 && t2h1dwt6 < t2w1rwt1 && t2h1dwt6 < t2w1lwt1 && t2h1dwt6 < t2h1uwt1 && t2h1dwt6 < t2h1dwt1
  && t2h1dwt6 < t2w1r2 && t2h1dwt6 < t2w1l2 && t2h1dwt6 < t2h1u2 && t2h1dwt6 < t2h1d2 && t2h1dwt6 < t2w1rwt2 && t2h1dwt6 < t2w1lwt2 && t2h1dwt6 < t2h1uwt2 && t2h1dwt6 < t2h1dwt2 
  && t2h1dwt6 < t2w1r3 && t2h1dwt6 < t2w1l3 && t2h1dwt6 < t2h1u3 && t2h1dwt6 < t2h1d3 && t2h1dwt6 < t2w1rwt3 && t2h1dwt6 < t2w1lwt3 && t2h1dwt6 < t2h1uwt3 && t2h1dwt6 < t2h1dwt3
  && t2h1dwt6 < t2w1r4 && t2h1dwt6 < t2w1l4 && t2h1dwt6 < t2h1u4 && t2h1dwt6 < t2h1d4 && t2h1dwt6 < t2w1rwt4 && t2h1dwt6 < t2w1lwt4 && t2h1dwt6 < t2h1uwt4 && t2h1dwt6 < t2h1dwt4
  && t2h1dwt6 < t2w1r5 && t2h1dwt6 < t2w1l5 && t2h1dwt6 < t2h1u5 && t2h1dwt6 < t2h1d5 && t2h1dwt6 < t2w1rwt5 && t2h1dwt6 < t2w1lwt5 && t2h1dwt6 < t2h1uwt5 && t2h1dwt6 < t2h1dwt5
  && t2h1dwt6 < t2w1r6 && t2h1dwt6 < t2w1l6 && t2h1dwt6 < t2h1u6 && t2h1dwt6 < t2h1d6 && t2h1dwt6 < t2w1rwt6 && t2h1dwt6 < t2w1lwt6 && t2h1dwt6 < t2h1uwt6 
  && t2h1dwt6 < t2w1r7 && t2h1dwt6 < t2w1l7 && t2h1dwt6 < t2h1u7 && t2h1dwt6 < t2h1d7 && t2h1dwt6 < t2w1rwt7 && t2h1dwt6 < t2w1lwt7 && t2h1dwt6 < t2h1uwt7 && t2h1dwt6 < t2h1dwt7 
  && t2h1dwt6 < t2w1r8 && t2h1dwt6 < t2w1l8 && t2h1dwt6 < t2h1u8 && t2h1dwt6 < t2h1d8 && t2h1dwt6 < t2w1rwt8 && t2h1dwt6 < t2w1lwt8 && t2h1dwt6 < t2h1uwt8 && t2h1dwt6 < t2h1dwt8
  && t2h1dwt6 < t2w1r9 && t2h1dwt6 < t2w1l9 && t2h1dwt6 < t2h1u9 && t2h1dwt6 < t2h1d9 && t2h1dwt6 < t2w1rwt9 && t2h1dwt6 < t2w1lwt9 && t2h1dwt6 < t2h1uwt9 && t2h1dwt6 < t2h1dwt9 
  && t2h1dwt6 < t2w1r10 && t2h1dwt6 < t2w1l10 && t2h1dwt6 < t2h1u10 && t2h1dwt6 < t2h1d10 && t2h1dwt6 < t2w1rwt10 && t2h1dwt6 < t2w1lwt10 && t2h1dwt6 < t2h1uwt10 && t2h1dwt6 < t2h1dwt10  
  && (louthd6 !=0 && linhd6!=0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1dwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1dwt6+z))*(z0wr6+(vz*t2h1dwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1dwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1dwt6+z))*(z0wl6+(vz*t2h1dwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1dwt6+x;
  ytest=vy*t2w1lwt6+y;
  ylimitd=-bhdwt6*sqrt(1-((vz*t2h1dwt6+z)+z0hd6)*((vz*t2h1dwt6+z)+z0hd6)/a2hdwt6);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW6>0){
  i=271;
  }else{
  i=277;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW6!=-1 && t2h1dwt6 > 0 && t2h1dwt6 < t1 
  && t2h1dwt6 < t2w1r && t2h1dwt6 < t2w1l && t2h1dwt6 < t2h1u && t2h1dwt6 < t2h1d && t2h1dwt6 < t2w1rwt && t2h1dwt6 < t2w1lwt && t2h1dwt6 < t2h1uwt && t2h1dwt6 < t2h1dwt 
  && t2h1dwt6 < t2w1r1 && t2h1dwt6 < t2w1l1 && t2h1dwt6 < t2h1u1 && t2h1dwt6 < t2h1d1 && t2h1dwt6 < t2w1rwt1 && t2h1dwt6 < t2w1lwt1 && t2h1dwt6 < t2h1uwt1 && t2h1dwt6 < t2h1dwt1
  && t2h1dwt6 < t2w1r2 && t2h1dwt6 < t2w1l2 && t2h1dwt6 < t2h1u2 && t2h1dwt6 < t2h1d2 && t2h1dwt6 < t2w1rwt2 && t2h1dwt6 < t2w1lwt2 && t2h1dwt6 < t2h1uwt2 && t2h1dwt6 < t2h1dwt2 
  && t2h1dwt6 < t2w1r3 && t2h1dwt6 < t2w1l3 && t2h1dwt6 < t2h1u3 && t2h1dwt6 < t2h1d3 && t2h1dwt6 < t2w1rwt3 && t2h1dwt6 < t2w1lwt3 && t2h1dwt6 < t2h1uwt3 && t2h1dwt6 < t2h1dwt3
  && t2h1dwt6 < t2w1r4 && t2h1dwt6 < t2w1l4 && t2h1dwt6 < t2h1u4 && t2h1dwt6 < t2h1d4 && t2h1dwt6 < t2w1rwt4 && t2h1dwt6 < t2w1lwt4 && t2h1dwt6 < t2h1uwt4 && t2h1dwt6 < t2h1dwt4
  && t2h1dwt6 < t2w1r5 && t2h1dwt6 < t2w1l5 && t2h1dwt6 < t2h1u5 && t2h1dwt6 < t2h1d5 && t2h1dwt6 < t2w1rwt5 && t2h1dwt6 < t2w1lwt5 && t2h1dwt6 < t2h1uwt5 && t2h1dwt6 < t2h1dwt5
  && t2h1dwt6 < t2w1r6 && t2h1dwt6 < t2w1l6 && t2h1dwt6 < t2h1u6 && t2h1dwt6 < t2h1d6 && t2h1dwt6 < t2w1rwt6 && t2h1dwt6 < t2w1lwt6 && t2h1dwt6 < t2h1uwt6 
  && t2h1dwt6 < t2w1r7 && t2h1dwt6 < t2w1l7 && t2h1dwt6 < t2h1u7 && t2h1dwt6 < t2h1d7 && t2h1dwt6 < t2w1rwt7 && t2h1dwt6 < t2w1lwt7 && t2h1dwt6 < t2h1uwt7 && t2h1dwt6 < t2h1dwt7 
  && t2h1dwt6 < t2w1r8 && t2h1dwt6 < t2w1l8 && t2h1dwt6 < t2h1u8 && t2h1dwt6 < t2h1d8 && t2h1dwt6 < t2w1rwt8 && t2h1dwt6 < t2w1lwt8 && t2h1dwt6 < t2h1uwt8 && t2h1dwt6 < t2h1dwt8
  && t2h1dwt6 < t2w1r9 && t2h1dwt6 < t2w1l9 && t2h1dwt6 < t2h1u9 && t2h1dwt6 < t2h1d9 && t2h1dwt6 < t2w1rwt9 && t2h1dwt6 < t2w1lwt9 && t2h1dwt6 < t2h1uwt9 && t2h1dwt6 < t2h1dwt9 
  && t2h1dwt6 < t2w1r10 && t2h1dwt6 < t2w1l10 && t2h1dwt6 < t2h1u10 && t2h1dwt6 < t2h1d10 && t2h1dwt6 < t2w1rwt10 && t2h1dwt6 < t2w1lwt10 && t2h1dwt6 < t2h1uwt10 && t2h1dwt6 < t2h1dwt10
  && ((louthd6 !=0 && linhd6==0) || (louthd6 ==0 && linhd6!=0))){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1dwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1dwt6+z))*(z0wr6+(vz*t2h1dwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
     xlimitl=(w2l6-w1l6)/l*(vz*t2h1dwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1dwt6+z))*(z0wl6+(vz*t2h1dwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1dwt6+x;
  ytest=vy*t2w1lwt6+y;
  ylimitd=-sqrt((pbhdwt6-(vz*t2h1dwt6+z))/pahdwt6);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW6>0 ){
  i=272;
  }else{
  i=277;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW6!=-1 && t2h1dwt6 > 0 && t2h1dwt6 < t1 
  && t2h1dwt6 < t2w1r && t2h1dwt6 < t2w1l && t2h1dwt6 < t2h1u && t2h1dwt6 < t2h1d && t2h1dwt6 < t2w1rwt && t2h1dwt6 < t2w1lwt && t2h1dwt6 < t2h1uwt && t2h1dwt6 < t2h1dwt 
  && t2h1dwt6 < t2w1r1 && t2h1dwt6 < t2w1l1 && t2h1dwt6 < t2h1u1 && t2h1dwt6 < t2h1d1 && t2h1dwt6 < t2w1rwt1 && t2h1dwt6 < t2w1lwt1 && t2h1dwt6 < t2h1uwt1 && t2h1dwt6 < t2h1dwt1
  && t2h1dwt6 < t2w1r2 && t2h1dwt6 < t2w1l2 && t2h1dwt6 < t2h1u2 && t2h1dwt6 < t2h1d2 && t2h1dwt6 < t2w1rwt2 && t2h1dwt6 < t2w1lwt2 && t2h1dwt6 < t2h1uwt2 && t2h1dwt6 < t2h1dwt2 
  && t2h1dwt6 < t2w1r3 && t2h1dwt6 < t2w1l3 && t2h1dwt6 < t2h1u3 && t2h1dwt6 < t2h1d3 && t2h1dwt6 < t2w1rwt3 && t2h1dwt6 < t2w1lwt3 && t2h1dwt6 < t2h1uwt3 && t2h1dwt6 < t2h1dwt3
  && t2h1dwt6 < t2w1r4 && t2h1dwt6 < t2w1l4 && t2h1dwt6 < t2h1u4 && t2h1dwt6 < t2h1d4 && t2h1dwt6 < t2w1rwt4 && t2h1dwt6 < t2w1lwt4 && t2h1dwt6 < t2h1uwt4 && t2h1dwt6 < t2h1dwt4
  && t2h1dwt6 < t2w1r5 && t2h1dwt6 < t2w1l5 && t2h1dwt6 < t2h1u5 && t2h1dwt6 < t2h1d5 && t2h1dwt6 < t2w1rwt5 && t2h1dwt6 < t2w1lwt5 && t2h1dwt6 < t2h1uwt5 && t2h1dwt6 < t2h1dwt5
  && t2h1dwt6 < t2w1r6 && t2h1dwt6 < t2w1l6 && t2h1dwt6 < t2h1u6 && t2h1dwt6 < t2h1d6 && t2h1dwt6 < t2w1rwt6 && t2h1dwt6 < t2w1lwt6 && t2h1dwt6 < t2h1uwt6 
  && t2h1dwt6 < t2w1r7 && t2h1dwt6 < t2w1l7 && t2h1dwt6 < t2h1u7 && t2h1dwt6 < t2h1d7 && t2h1dwt6 < t2w1rwt7 && t2h1dwt6 < t2w1lwt7 && t2h1dwt6 < t2h1uwt7 && t2h1dwt6 < t2h1dwt7 
  && t2h1dwt6 < t2w1r8 && t2h1dwt6 < t2w1l8 && t2h1dwt6 < t2h1u8 && t2h1dwt6 < t2h1d8 && t2h1dwt6 < t2w1rwt8 && t2h1dwt6 < t2w1lwt8 && t2h1dwt6 < t2h1uwt8 && t2h1dwt6 < t2h1dwt8
  && t2h1dwt6 < t2w1r9 && t2h1dwt6 < t2w1l9 && t2h1dwt6 < t2h1u9 && t2h1dwt6 < t2h1d9 && t2h1dwt6 < t2w1rwt9 && t2h1dwt6 < t2w1lwt9 && t2h1dwt6 < t2h1uwt9 && t2h1dwt6 < t2h1dwt9 
  && t2h1dwt6 < t2w1r10 && t2h1dwt6 < t2w1l10 && t2h1dwt6 < t2h1u10 && t2h1dwt6 < t2h1d10 && t2h1dwt6 < t2w1rwt10 && t2h1dwt6 < t2w1lwt10 && t2h1dwt6 < t2h1uwt10 && t2h1dwt6 < t2h1dwt10
  && (louthd6 == 0 && linhd6 == 0)){
  if(linwr6==0 && loutwr6==0)
  {
    xlimitr=(-w2r6+w1r6)/l*(vz*t2h1dwt6+z)-w1rwt6;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xlimitr=-bwrwt6*sqrt(1-((z0wr6+(vz*t2h1dwt6+z))*(z0wr6+(vz*t2h1dwt6+z)))/a2wrwt6);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt6+z)-pbwrwt6)/-pawrwt6);
    }
  }
  if(linwl6==0 && loutwl6 == 0)
   {
      xlimitl=(w2l6-w1l6)/l*(vz*t2h1dwt6+z)+w1lwt6;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xlimitl=bwlwt6*sqrt(1-((z0wl6+(vz*t2h1dwt6+z))*(z0wl6+(vz*t2h1dwt6+z)))/a2wlwt6);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt6+z)-pbwlwt6)/-pawlwt6);
      }
   }
  xtest=vx*t2h1dwt6+x;
  ytest=vy*t2w1lwt6+y;
  ylimitd=(-h2d6+h1d6)*(vz*t2h1dwt6+z)/l-h1dwt6;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW6>0 ){
  i=273;
  }else{
  i=277;
  }
  }


  if (mxrOW6==-1 && t2w1rwt6 > 0 && t2w1rwt6 < t1 
  && t2w1rwt6 < t2w1r && t2w1rwt6 < t2w1l && t2w1rwt6 < t2h1u && t2w1rwt6 < t2h1d && t2w1rwt6 <t2w1rwt && t2w1rwt6 <t2w1lwt && t2w1rwt6 < t2h1uwt && t2w1rwt6 < t2h1dwt
  && t2w1rwt6 < t2w1r1 && t2w1rwt6 < t2w1l1 && t2w1rwt6 < t2h1u1 && t2w1rwt6 < t2h1d1 && t2w1rwt6 <t2w1rwt1 && t2w1rwt6 <t2w1lwt1 && t2w1rwt6 < t2h1uwt1 && t2w1rwt6 < t2h1dwt1
  && t2w1rwt6 < t2w1r2 && t2w1rwt6 < t2w1l2 && t2w1rwt6 < t2h1u2 && t2w1rwt6 < t2h1d2 && t2w1rwt6 <t2w1rwt2 && t2w1rwt6 <t2w1lwt2 && t2w1rwt6 < t2h1uwt2 && t2w1rwt6 < t2h1dwt2
  && t2w1rwt6 < t2w1r3 && t2w1rwt6 < t2w1l3 && t2w1rwt6 < t2h1u3 && t2w1rwt6 < t2h1d3 && t2w1rwt6 <t2w1rwt3 && t2w1rwt6 <t2w1lwt3 && t2w1rwt6 < t2h1uwt3 && t2w1rwt6 < t2h1dwt3
  && t2w1rwt6 < t2w1r4 && t2w1rwt6 < t2w1l4 && t2w1rwt6 < t2h1u4 && t2w1rwt6 < t2h1d4 && t2w1rwt6 <t2w1rwt4 && t2w1rwt6 <t2w1lwt4 && t2w1rwt6 < t2h1uwt4 && t2w1rwt6 < t2h1dwt4
  && t2w1rwt6 < t2w1r5 && t2w1rwt6 < t2w1l5 && t2w1rwt6 < t2h1u5 && t2w1rwt6 < t2h1d5 && t2w1rwt6 <t2w1rwt5 && t2w1rwt6 <t2w1lwt5 && t2w1rwt6 < t2h1uwt5 && t2w1rwt6 < t2h1dwt5
  && t2w1rwt6 < t2w1r6 && t2w1rwt6 < t2w1l6 && t2w1rwt6 < t2h1u6 && t2w1rwt6 < t2h1d6 && t2w1rwt6 <t2w1lwt6 && t2w1rwt6 < t2h1uwt6 && t2w1rwt6 < t2h1dwt6
  && t2w1rwt6 < t2w1r7 && t2w1rwt6 < t2w1l7 && t2w1rwt6 < t2h1u7 && t2w1rwt6 < t2h1d7 && t2w1rwt6 <t2w1rwt7 && t2w1rwt6 <t2w1lwt7 && t2w1rwt6 < t2h1uwt7 && t2w1rwt6 < t2h1dwt7
  && t2w1rwt6 < t2w1r8 && t2w1rwt6 < t2w1l8 && t2w1rwt6 < t2h1u8 && t2w1rwt6 < t2h1d8 && t2w1rwt6 <t2w1rwt8 && t2w1rwt6 <t2w1lwt8 && t2w1rwt6 < t2h1uwt8 && t2w1rwt6 < t2h1dwt8
  && t2w1rwt6 < t2w1r9 && t2w1rwt6 < t2w1l9 && t2w1rwt6 < t2h1u9 && t2w1rwt6 < t2h1d9 && t2w1rwt6 <t2w1rwt9 && t2w1rwt6 <t2w1lwt9 && t2w1rwt6 < t2h1uwt9 && t2w1rwt6 < t2h1dwt9
  && t2w1rwt6 < t2w1r10 && t2w1rwt6 < t2w1l10 && t2w1rwt6 < t2h1u10 && t2w1rwt6 < t2h1d10 && t2w1rwt6 <t2w1rwt10 && t2w1rwt6 <t2w1lwt10 && t2w1rwt6 < t2h1uwt10 && t2w1rwt6 < t2h1dwt10
  && ((linwr6!=0) && (loutwr6!=0) )){
  i=278;
  }

  if (mxrOW6==-1 && t2w1rwt6 > 0 && t2w1rwt6 < t1 
  && t2w1rwt6 < t2w1r && t2w1rwt6 < t2w1l && t2w1rwt6 < t2h1u && t2w1rwt6 < t2h1d && t2w1rwt6 <t2w1rwt && t2w1rwt6 <t2w1lwt && t2w1rwt6 < t2h1uwt && t2w1rwt6 < t2h1dwt
  && t2w1rwt6 < t2w1r1 && t2w1rwt6 < t2w1l1 && t2w1rwt6 < t2h1u1 && t2w1rwt6 < t2h1d1 && t2w1rwt6 <t2w1rwt1 && t2w1rwt6 <t2w1lwt1 && t2w1rwt6 < t2h1uwt1 && t2w1rwt6 < t2h1dwt1
  && t2w1rwt6 < t2w1r2 && t2w1rwt6 < t2w1l2 && t2w1rwt6 < t2h1u2 && t2w1rwt6 < t2h1d2 && t2w1rwt6 <t2w1rwt2 && t2w1rwt6 <t2w1lwt2 && t2w1rwt6 < t2h1uwt2 && t2w1rwt6 < t2h1dwt2
  && t2w1rwt6 < t2w1r3 && t2w1rwt6 < t2w1l3 && t2w1rwt6 < t2h1u3 && t2w1rwt6 < t2h1d3 && t2w1rwt6 <t2w1rwt3 && t2w1rwt6 <t2w1lwt3 && t2w1rwt6 < t2h1uwt3 && t2w1rwt6 < t2h1dwt3
  && t2w1rwt6 < t2w1r4 && t2w1rwt6 < t2w1l4 && t2w1rwt6 < t2h1u4 && t2w1rwt6 < t2h1d4 && t2w1rwt6 <t2w1rwt4 && t2w1rwt6 <t2w1lwt4 && t2w1rwt6 < t2h1uwt4 && t2w1rwt6 < t2h1dwt4
  && t2w1rwt6 < t2w1r5 && t2w1rwt6 < t2w1l5 && t2w1rwt6 < t2h1u5 && t2w1rwt6 < t2h1d5 && t2w1rwt6 <t2w1rwt5 && t2w1rwt6 <t2w1lwt5 && t2w1rwt6 < t2h1uwt5 && t2w1rwt6 < t2h1dwt5
  && t2w1rwt6 < t2w1r6 && t2w1rwt6 < t2w1l6 && t2w1rwt6 < t2h1u6 && t2w1rwt6 < t2h1d6 && t2w1rwt6 <t2w1lwt6 && t2w1rwt6 < t2h1uwt6 && t2w1rwt6 < t2h1dwt6
  && t2w1rwt6 < t2w1r7 && t2w1rwt6 < t2w1l7 && t2w1rwt6 < t2h1u7 && t2w1rwt6 < t2h1d7 && t2w1rwt6 <t2w1rwt7 && t2w1rwt6 <t2w1lwt7 && t2w1rwt6 < t2h1uwt7 && t2w1rwt6 < t2h1dwt7
  && t2w1rwt6 < t2w1r8 && t2w1rwt6 < t2w1l8 && t2w1rwt6 < t2h1u8 && t2w1rwt6 < t2h1d8 && t2w1rwt6 <t2w1rwt8 && t2w1rwt6 <t2w1lwt8 && t2w1rwt6 < t2h1uwt8 && t2w1rwt6 < t2h1dwt8
  && t2w1rwt6 < t2w1r9 && t2w1rwt6 < t2w1l9 && t2w1rwt6 < t2h1u9 && t2w1rwt6 < t2h1d9 && t2w1rwt6 <t2w1rwt9 && t2w1rwt6 <t2w1lwt9 && t2w1rwt6 < t2h1uwt9 && t2w1rwt6 < t2h1dwt9
  && t2w1rwt6 < t2w1r10 && t2w1rwt6 < t2w1l10 && t2w1rwt6 < t2h1u10 && t2w1rwt6 < t2h1d10 && t2w1rwt6 <t2w1rwt10 && t2w1rwt6 <t2w1lwt10 && t2w1rwt6 < t2h1uwt10 && t2w1rwt6 < t2h1dwt10
  && ((loutwr6!=0 && linwr6==0) || (loutwr6==0 && linwr6!=0))){
  i=278;
  }

  if (mxrOW6==-1 && t2w1rwt6 > 0 && t2w1rwt6 < t1 
  && t2w1rwt6 < t2w1r && t2w1rwt6 < t2w1l && t2w1rwt6 < t2h1u && t2w1rwt6 < t2h1d && t2w1rwt6 <t2w1rwt && t2w1rwt6 <t2w1lwt && t2w1rwt6 < t2h1uwt && t2w1rwt6 < t2h1dwt
  && t2w1rwt6 < t2w1r1 && t2w1rwt6 < t2w1l1 && t2w1rwt6 < t2h1u1 && t2w1rwt6 < t2h1d1 && t2w1rwt6 <t2w1rwt1 && t2w1rwt6 <t2w1lwt1 && t2w1rwt6 < t2h1uwt1 && t2w1rwt6 < t2h1dwt1
  && t2w1rwt6 < t2w1r2 && t2w1rwt6 < t2w1l2 && t2w1rwt6 < t2h1u2 && t2w1rwt6 < t2h1d2 && t2w1rwt6 <t2w1rwt2 && t2w1rwt6 <t2w1lwt2 && t2w1rwt6 < t2h1uwt2 && t2w1rwt6 < t2h1dwt2
  && t2w1rwt6 < t2w1r3 && t2w1rwt6 < t2w1l3 && t2w1rwt6 < t2h1u3 && t2w1rwt6 < t2h1d3 && t2w1rwt6 <t2w1rwt3 && t2w1rwt6 <t2w1lwt3 && t2w1rwt6 < t2h1uwt3 && t2w1rwt6 < t2h1dwt3
  && t2w1rwt6 < t2w1r4 && t2w1rwt6 < t2w1l4 && t2w1rwt6 < t2h1u4 && t2w1rwt6 < t2h1d4 && t2w1rwt6 <t2w1rwt4 && t2w1rwt6 <t2w1lwt4 && t2w1rwt6 < t2h1uwt4 && t2w1rwt6 < t2h1dwt4
  && t2w1rwt6 < t2w1r5 && t2w1rwt6 < t2w1l5 && t2w1rwt6 < t2h1u5 && t2w1rwt6 < t2h1d5 && t2w1rwt6 <t2w1rwt5 && t2w1rwt6 <t2w1lwt5 && t2w1rwt6 < t2h1uwt5 && t2w1rwt6 < t2h1dwt5
  && t2w1rwt6 < t2w1r6 && t2w1rwt6 < t2w1l6 && t2w1rwt6 < t2h1u6 && t2w1rwt6 < t2h1d6 && t2w1rwt6 <t2w1lwt6 && t2w1rwt6 < t2h1uwt6 && t2w1rwt6 < t2h1dwt6
  && t2w1rwt6 < t2w1r7 && t2w1rwt6 < t2w1l7 && t2w1rwt6 < t2h1u7 && t2w1rwt6 < t2h1d7 && t2w1rwt6 <t2w1rwt7 && t2w1rwt6 <t2w1lwt7 && t2w1rwt6 < t2h1uwt7 && t2w1rwt6 < t2h1dwt7
  && t2w1rwt6 < t2w1r8 && t2w1rwt6 < t2w1l8 && t2w1rwt6 < t2h1u8 && t2w1rwt6 < t2h1d8 && t2w1rwt6 <t2w1rwt8 && t2w1rwt6 <t2w1lwt8 && t2w1rwt6 < t2h1uwt8 && t2w1rwt6 < t2h1dwt8
  && t2w1rwt6 < t2w1r9 && t2w1rwt6 < t2w1l9 && t2w1rwt6 < t2h1u9 && t2w1rwt6 < t2h1d9 && t2w1rwt6 <t2w1rwt9 && t2w1rwt6 <t2w1lwt9 && t2w1rwt6 < t2h1uwt9 && t2w1rwt6 < t2h1dwt9
  && t2w1rwt6 < t2w1r10 && t2w1rwt6 < t2w1l10 && t2w1rwt6 < t2h1u10 && t2w1rwt6 < t2h1d10 && t2w1rwt6 <t2w1rwt10 && t2w1rwt6 <t2w1lwt10 && t2w1rwt6 < t2h1uwt10 && t2w1rwt6 < t2h1dwt10
  && (loutwr6==0 && linwr6==0)){
  i=278;
  }

  if (mxlOW6==-1 && t2w1lwt6 > 0 && t2w1lwt6 < t1 
  && t2w1lwt6 < t2w1r && t2w1lwt6 < t2w1l && t2w1lwt6 < t2h1u && t2w1lwt6 < t2h1d && t2w1lwt6 <t2w1rwt && t2w1lwt6 <t2w1lwt && t2w1lwt6 < t2h1uwt && t2w1lwt6 < t2h1dwt
  && t2w1lwt6 < t2w1r1 && t2w1lwt6 < t2w1l1 && t2w1lwt6 < t2h1u1 && t2w1lwt6 < t2h1d1 && t2w1lwt6 <t2w1rwt1 && t2w1lwt6 <t2w1lwt1 && t2w1lwt6 < t2h1uwt1 && t2w1lwt6 < t2h1dwt1
  && t2w1lwt6 < t2w1r2 && t2w1lwt6 < t2w1l2 && t2w1lwt6 < t2h1u2 && t2w1lwt6 < t2h1d2 && t2w1lwt6 <t2w1rwt2 && t2w1lwt6 <t2w1lwt2 && t2w1lwt6 < t2h1uwt2 && t2w1lwt6 < t2h1dwt2
  && t2w1lwt6 < t2w1r3 && t2w1lwt6 < t2w1l3 && t2w1lwt6 < t2h1u3 && t2w1lwt6 < t2h1d3 && t2w1lwt6 <t2w1rwt3 && t2w1lwt6 <t2w1lwt3 && t2w1lwt6 < t2h1uwt3 && t2w1lwt6 < t2h1dwt3
  && t2w1lwt6 < t2w1r4 && t2w1lwt6 < t2w1l4 && t2w1lwt6 < t2h1u4 && t2w1lwt6 < t2h1d4 && t2w1lwt6 <t2w1rwt4 && t2w1lwt6 <t2w1lwt4 && t2w1lwt6 < t2h1uwt4 && t2w1lwt6 < t2h1dwt4
  && t2w1lwt6 < t2w1r5 && t2w1lwt6 < t2w1l5 && t2w1lwt6 < t2h1u5 && t2w1lwt6 < t2h1d5 && t2w1lwt6 <t2w1rwt5 && t2w1lwt6 <t2w1lwt5 && t2w1lwt6 < t2h1uwt5 && t2w1lwt6 < t2h1dwt5
  && t2w1lwt6 < t2w1r6 && t2w1lwt6 < t2w1l6 && t2w1lwt6 < t2h1u6 && t2w1lwt6 < t2h1d6 && t2w1lwt6 <t2w1rwt6 && t2w1lwt6 < t2h1uwt6 && t2w1lwt6 < t2h1dwt6
  && t2w1lwt6 < t2w1r7 && t2w1lwt6 < t2w1l7 && t2w1lwt6 < t2h1u7 && t2w1lwt6 < t2h1d7 && t2w1lwt6 <t2w1rwt7 && t2w1lwt6 <t2w1lwt7 && t2w1lwt6 < t2h1uwt7 && t2w1lwt6 < t2h1dwt7
  && t2w1lwt6 < t2w1r8 && t2w1lwt6 < t2w1l8 && t2w1lwt6 < t2h1u8 && t2w1lwt6 < t2h1d8 && t2w1lwt6 <t2w1rwt8 && t2w1lwt6 <t2w1lwt8 && t2w1lwt6 < t2h1uwt8 && t2w1lwt6 < t2h1dwt8
  && t2w1lwt6 < t2w1r9 && t2w1lwt6 < t2w1l9 && t2w1lwt6 < t2h1u9 && t2w1lwt6 < t2h1d9 && t2w1lwt6 <t2w1rwt9 && t2w1lwt6 <t2w1lwt9 && t2w1lwt6 < t2h1uwt9 && t2w1lwt6 < t2h1dwt9
  && t2w1lwt6 < t2w1r10 && t2w1lwt6 < t2w1l10 && t2w1lwt6 < t2h1u10 && t2w1lwt6 < t2h1d10 && t2w1lwt6 <t2w1rwt10 && t2w1lwt6 <t2w1lwt10 && t2w1lwt6 < t2h1uwt10 && t2w1lwt6 < t2h1dwt10
  && ((linwl6!=0) && (loutwl6!=0) )){
  i=279;
  }

  if (mxlOW6==-1 && t2w1lwt6 > 0 && t2w1lwt6 < t1 
  && t2w1lwt6 < t2w1r && t2w1lwt6 < t2w1l && t2w1lwt6 < t2h1u && t2w1lwt6 < t2h1d && t2w1lwt6 <t2w1rwt && t2w1lwt6 <t2w1lwt && t2w1lwt6 < t2h1uwt && t2w1lwt6 < t2h1dwt
  && t2w1lwt6 < t2w1r1 && t2w1lwt6 < t2w1l1 && t2w1lwt6 < t2h1u1 && t2w1lwt6 < t2h1d1 && t2w1lwt6 <t2w1rwt1 && t2w1lwt6 <t2w1lwt1 && t2w1lwt6 < t2h1uwt1 && t2w1lwt6 < t2h1dwt1
  && t2w1lwt6 < t2w1r2 && t2w1lwt6 < t2w1l2 && t2w1lwt6 < t2h1u2 && t2w1lwt6 < t2h1d2 && t2w1lwt6 <t2w1rwt2 && t2w1lwt6 <t2w1lwt2 && t2w1lwt6 < t2h1uwt2 && t2w1lwt6 < t2h1dwt2
  && t2w1lwt6 < t2w1r3 && t2w1lwt6 < t2w1l3 && t2w1lwt6 < t2h1u3 && t2w1lwt6 < t2h1d3 && t2w1lwt6 <t2w1rwt3 && t2w1lwt6 <t2w1lwt3 && t2w1lwt6 < t2h1uwt3 && t2w1lwt6 < t2h1dwt3
  && t2w1lwt6 < t2w1r4 && t2w1lwt6 < t2w1l4 && t2w1lwt6 < t2h1u4 && t2w1lwt6 < t2h1d4 && t2w1lwt6 <t2w1rwt4 && t2w1lwt6 <t2w1lwt4 && t2w1lwt6 < t2h1uwt4 && t2w1lwt6 < t2h1dwt4
  && t2w1lwt6 < t2w1r5 && t2w1lwt6 < t2w1l5 && t2w1lwt6 < t2h1u5 && t2w1lwt6 < t2h1d5 && t2w1lwt6 <t2w1rwt5 && t2w1lwt6 <t2w1lwt5 && t2w1lwt6 < t2h1uwt5 && t2w1lwt6 < t2h1dwt5
  && t2w1lwt6 < t2w1r6 && t2w1lwt6 < t2w1l6 && t2w1lwt6 < t2h1u6 && t2w1lwt6 < t2h1d6 && t2w1lwt6 <t2w1rwt6 && t2w1lwt6 < t2h1uwt6 && t2w1lwt6 < t2h1dwt6
  && t2w1lwt6 < t2w1r7 && t2w1lwt6 < t2w1l7 && t2w1lwt6 < t2h1u7 && t2w1lwt6 < t2h1d7 && t2w1lwt6 <t2w1rwt7 && t2w1lwt6 <t2w1lwt7 && t2w1lwt6 < t2h1uwt7 && t2w1lwt6 < t2h1dwt7
  && t2w1lwt6 < t2w1r8 && t2w1lwt6 < t2w1l8 && t2w1lwt6 < t2h1u8 && t2w1lwt6 < t2h1d8 && t2w1lwt6 <t2w1rwt8 && t2w1lwt6 <t2w1lwt8 && t2w1lwt6 < t2h1uwt8 && t2w1lwt6 < t2h1dwt8
  && t2w1lwt6 < t2w1r9 && t2w1lwt6 < t2w1l9 && t2w1lwt6 < t2h1u9 && t2w1lwt6 < t2h1d9 && t2w1lwt6 <t2w1rwt9 && t2w1lwt6 <t2w1lwt9 && t2w1lwt6 < t2h1uwt9 && t2w1lwt6 < t2h1dwt9
  && t2w1lwt6 < t2w1r10 && t2w1lwt6 < t2w1l10 && t2w1lwt6 < t2h1u10 && t2w1lwt6 < t2h1d10 && t2w1lwt6 <t2w1rwt10 && t2w1lwt6 <t2w1lwt10 && t2w1lwt6 < t2h1uwt10 && t2w1lwt6 < t2h1dwt10
  && ((loutwl6!=0 && linwl6==0) || (loutwl6==0 && linwl6!=0))){
  i=279;
  }

  if (mxlOW6==-1 && t2w1lwt6 > 0 && t2w1lwt6 < t1 
  && t2w1lwt6 < t2w1r && t2w1lwt6 < t2w1l && t2w1lwt6 < t2h1u && t2w1lwt6 < t2h1d && t2w1lwt6 <t2w1rwt && t2w1lwt6 <t2w1lwt && t2w1lwt6 < t2h1uwt && t2w1lwt6 < t2h1dwt
  && t2w1lwt6 < t2w1r1 && t2w1lwt6 < t2w1l1 && t2w1lwt6 < t2h1u1 && t2w1lwt6 < t2h1d1 && t2w1lwt6 <t2w1rwt1 && t2w1lwt6 <t2w1lwt1 && t2w1lwt6 < t2h1uwt1 && t2w1lwt6 < t2h1dwt1
  && t2w1lwt6 < t2w1r2 && t2w1lwt6 < t2w1l2 && t2w1lwt6 < t2h1u2 && t2w1lwt6 < t2h1d2 && t2w1lwt6 <t2w1rwt2 && t2w1lwt6 <t2w1lwt2 && t2w1lwt6 < t2h1uwt2 && t2w1lwt6 < t2h1dwt2
  && t2w1lwt6 < t2w1r3 && t2w1lwt6 < t2w1l3 && t2w1lwt6 < t2h1u3 && t2w1lwt6 < t2h1d3 && t2w1lwt6 <t2w1rwt3 && t2w1lwt6 <t2w1lwt3 && t2w1lwt6 < t2h1uwt3 && t2w1lwt6 < t2h1dwt3
  && t2w1lwt6 < t2w1r4 && t2w1lwt6 < t2w1l4 && t2w1lwt6 < t2h1u4 && t2w1lwt6 < t2h1d4 && t2w1lwt6 <t2w1rwt4 && t2w1lwt6 <t2w1lwt4 && t2w1lwt6 < t2h1uwt4 && t2w1lwt6 < t2h1dwt4
  && t2w1lwt6 < t2w1r5 && t2w1lwt6 < t2w1l5 && t2w1lwt6 < t2h1u5 && t2w1lwt6 < t2h1d5 && t2w1lwt6 <t2w1rwt5 && t2w1lwt6 <t2w1lwt5 && t2w1lwt6 < t2h1uwt5 && t2w1lwt6 < t2h1dwt5
  && t2w1lwt6 < t2w1r6 && t2w1lwt6 < t2w1l6 && t2w1lwt6 < t2h1u6 && t2w1lwt6 < t2h1d6 && t2w1lwt6 <t2w1rwt6 && t2w1lwt6 < t2h1uwt6 && t2w1lwt6 < t2h1dwt6
  && t2w1lwt6 < t2w1r7 && t2w1lwt6 < t2w1l7 && t2w1lwt6 < t2h1u7 && t2w1lwt6 < t2h1d7 && t2w1lwt6 <t2w1rwt7 && t2w1lwt6 <t2w1lwt7 && t2w1lwt6 < t2h1uwt7 && t2w1lwt6 < t2h1dwt7
  && t2w1lwt6 < t2w1r8 && t2w1lwt6 < t2w1l8 && t2w1lwt6 < t2h1u8 && t2w1lwt6 < t2h1d8 && t2w1lwt6 <t2w1rwt8 && t2w1lwt6 <t2w1lwt8 && t2w1lwt6 < t2h1uwt8 && t2w1lwt6 < t2h1dwt8
  && t2w1lwt6 < t2w1r9 && t2w1lwt6 < t2w1l9 && t2w1lwt6 < t2h1u9 && t2w1lwt6 < t2h1d9 && t2w1lwt6 <t2w1rwt9 && t2w1lwt6 <t2w1lwt9 && t2w1lwt6 < t2h1uwt9 && t2w1lwt6 < t2h1dwt9
  && t2w1lwt6 < t2w1r10 && t2w1lwt6 < t2w1l10 && t2w1lwt6 < t2h1u10 && t2w1lwt6 < t2h1d10 && t2w1lwt6 <t2w1rwt10 && t2w1lwt6 <t2w1lwt10 && t2w1lwt6 < t2h1uwt10 && t2w1lwt6 < t2h1dwt10
  && (loutwl6==0 && linwl6==0)){
  i=279;}

  if (myuOW6==-1 && t2h1uwt6 > 0 && t2h1uwt6 < t1 
  && t2h1uwt6 < t2w1r && t2h1uwt6 < t2w1l && t2h1uwt6 < t2h1u && t2h1uwt6 < t2h1d && t2h1uwt6 < t2w1rwt && t2h1uwt6 < t2w1lwt && t2h1uwt6 < t2h1uwt && t2h1uwt6 < t2h1dwt 
  && t2h1uwt6 < t2w1r1 && t2h1uwt6 < t2w1l1 && t2h1uwt6 < t2h1u1 && t2h1uwt6 < t2h1d1 && t2h1uwt6 < t2w1rwt1 && t2h1uwt6 < t2w1lwt1 && t2h1uwt6 < t2h1uwt1 && t2h1uwt6 < t2h1dwt1
  && t2h1uwt6 < t2w1r2 && t2h1uwt6 < t2w1l2 && t2h1uwt6 < t2h1u2 && t2h1uwt6 < t2h1d2 && t2h1uwt6 < t2w1rwt2 && t2h1uwt6 < t2w1lwt2 && t2h1uwt6 < t2h1uwt2 && t2h1uwt6 < t2h1dwt2
  && t2h1uwt6 < t2w1r3 && t2h1uwt6 < t2w1l3 && t2h1uwt6 < t2h1u3 && t2h1uwt6 < t2h1d3 && t2h1uwt6 < t2w1rwt3 && t2h1uwt6 < t2w1lwt3 && t2h1uwt6 < t2h1uwt3 && t2h1uwt6 < t2h1dwt3
  && t2h1uwt6 < t2w1r4 && t2h1uwt6 < t2w1l4 && t2h1uwt6 < t2h1u4 && t2h1uwt6 < t2h1d4 && t2h1uwt6 < t2w1rwt4 && t2h1uwt6 < t2w1lwt4 && t2h1uwt6 < t2h1uwt4 && t2h1uwt6 < t2h1dwt4
  && t2h1uwt6 < t2w1r5 && t2h1uwt6 < t2w1l5 && t2h1uwt6 < t2h1u5 && t2h1uwt6 < t2h1d5 && t2h1uwt6 < t2w1rwt5 && t2h1uwt6 < t2w1lwt5 && t2h1uwt6 < t2h1uwt5 && t2h1uwt6 < t2h1dwt5
  && t2h1uwt6 < t2w1r6 && t2h1uwt6 < t2w1l6 && t2h1uwt6 < t2h1u6 && t2h1uwt6 < t2h1d6 && t2h1uwt6 < t2w1rwt6 && t2h1uwt6 < t2w1lwt6 && t2h1uwt6 < t2h1dwt6
  && t2h1uwt6 < t2w1r7 && t2h1uwt6 < t2w1l7 && t2h1uwt6 < t2h1u7 && t2h1uwt6 < t2h1d7 && t2h1uwt6 < t2w1rwt7 && t2h1uwt6 < t2w1lwt7 && t2h1uwt6 < t2h1uwt7 && t2h1uwt6 < t2h1dwt7
  && t2h1uwt6 < t2w1r8 && t2h1uwt6 < t2w1l8 && t2h1uwt6 < t2h1u8 && t2h1uwt6 < t2h1d8 && t2h1uwt6 < t2w1rwt8 && t2h1uwt6 < t2w1lwt8 && t2h1uwt6 < t2h1uwt8 && t2h1uwt6 < t2h1dwt8
  && t2h1uwt6 < t2w1r9 && t2h1uwt6 < t2w1l9 && t2h1uwt6 < t2h1u9 && t2h1uwt6 < t2h1d9 && t2h1uwt6 < t2w1rwt9 && t2h1uwt6 < t2w1lwt9 && t2h1uwt6 < t2h1uwt9 && t2h1uwt6 < t2h1dwt9
  && t2h1uwt6 < t2w1r10 && t2h1uwt6 < t2w1l10 && t2h1uwt6 < t2h1u10 && t2h1uwt6 < t2h1d10 && t2h1uwt6 < t2w1rwt10 && t2h1uwt6 < t2w1lwt10 && t2h1uwt6 < t2h1uwt10 && t2h1uwt6 < t2h1dwt10
  && (louthu6 !=0 && linhu6!=0)){
  i=280;
  }

  if (myuOW6==-1 && t2h1uwt6 > 0 && t2h1uwt6 < t1 
  && t2h1uwt6 < t2w1r && t2h1uwt6 < t2w1l && t2h1uwt6 < t2h1u && t2h1uwt6 < t2h1d && t2h1uwt6 < t2w1rwt && t2h1uwt6 < t2w1lwt && t2h1uwt6 < t2h1uwt && t2h1uwt6 < t2h1dwt 
  && t2h1uwt6 < t2w1r1 && t2h1uwt6 < t2w1l1 && t2h1uwt6 < t2h1u1 && t2h1uwt6 < t2h1d1 && t2h1uwt6 < t2w1rwt1 && t2h1uwt6 < t2w1lwt1 && t2h1uwt6 < t2h1uwt1 && t2h1uwt6 < t2h1dwt1
  && t2h1uwt6 < t2w1r2 && t2h1uwt6 < t2w1l2 && t2h1uwt6 < t2h1u2 && t2h1uwt6 < t2h1d2 && t2h1uwt6 < t2w1rwt2 && t2h1uwt6 < t2w1lwt2 && t2h1uwt6 < t2h1uwt2 && t2h1uwt6 < t2h1dwt2
  && t2h1uwt6 < t2w1r3 && t2h1uwt6 < t2w1l3 && t2h1uwt6 < t2h1u3 && t2h1uwt6 < t2h1d3 && t2h1uwt6 < t2w1rwt3 && t2h1uwt6 < t2w1lwt3 && t2h1uwt6 < t2h1uwt3 && t2h1uwt6 < t2h1dwt3
  && t2h1uwt6 < t2w1r4 && t2h1uwt6 < t2w1l4 && t2h1uwt6 < t2h1u4 && t2h1uwt6 < t2h1d4 && t2h1uwt6 < t2w1rwt4 && t2h1uwt6 < t2w1lwt4 && t2h1uwt6 < t2h1uwt4 && t2h1uwt6 < t2h1dwt4
  && t2h1uwt6 < t2w1r5 && t2h1uwt6 < t2w1l5 && t2h1uwt6 < t2h1u5 && t2h1uwt6 < t2h1d5 && t2h1uwt6 < t2w1rwt5 && t2h1uwt6 < t2w1lwt5 && t2h1uwt6 < t2h1uwt5 && t2h1uwt6 < t2h1dwt5
  && t2h1uwt6 < t2w1r6 && t2h1uwt6 < t2w1l6 && t2h1uwt6 < t2h1u6 && t2h1uwt6 < t2h1d6 && t2h1uwt6 < t2w1rwt6 && t2h1uwt6 < t2w1lwt6 && t2h1uwt6 < t2h1dwt6
  && t2h1uwt6 < t2w1r7 && t2h1uwt6 < t2w1l7 && t2h1uwt6 < t2h1u7 && t2h1uwt6 < t2h1d7 && t2h1uwt6 < t2w1rwt7 && t2h1uwt6 < t2w1lwt7 && t2h1uwt6 < t2h1uwt7 && t2h1uwt6 < t2h1dwt7
  && t2h1uwt6 < t2w1r8 && t2h1uwt6 < t2w1l8 && t2h1uwt6 < t2h1u8 && t2h1uwt6 < t2h1d8 && t2h1uwt6 < t2w1rwt8 && t2h1uwt6 < t2w1lwt8 && t2h1uwt6 < t2h1uwt8 && t2h1uwt6 < t2h1dwt8
  && t2h1uwt6 < t2w1r9 && t2h1uwt6 < t2w1l9 && t2h1uwt6 < t2h1u9 && t2h1uwt6 < t2h1d9 && t2h1uwt6 < t2w1rwt9 && t2h1uwt6 < t2w1lwt9 && t2h1uwt6 < t2h1uwt9 && t2h1uwt6 < t2h1dwt9
  && t2h1uwt6 < t2w1r10 && t2h1uwt6 < t2w1l10 && t2h1uwt6 < t2h1u10 && t2h1uwt6 < t2h1d10 && t2h1uwt6 < t2w1rwt10 && t2h1uwt6 < t2w1lwt10 && t2h1uwt6 < t2h1uwt10 && t2h1uwt6 < t2h1dwt10
  && ((louthu6!=0 && linhu6==0) || (louthu6==0 && linhu6!=0))){
  i=280;
  }

  if (myuOW6==-1 && t2h1uwt6 > 0 && t2h1uwt6 < t1 
  && t2h1uwt6 < t2w1r && t2h1uwt6 < t2w1l && t2h1uwt6 < t2h1u && t2h1uwt6 < t2h1d && t2h1uwt6 < t2w1rwt && t2h1uwt6 < t2w1lwt && t2h1uwt6 < t2h1uwt && t2h1uwt6 < t2h1dwt 
  && t2h1uwt6 < t2w1r1 && t2h1uwt6 < t2w1l1 && t2h1uwt6 < t2h1u1 && t2h1uwt6 < t2h1d1 && t2h1uwt6 < t2w1rwt1 && t2h1uwt6 < t2w1lwt1 && t2h1uwt6 < t2h1uwt1 && t2h1uwt6 < t2h1dwt1
  && t2h1uwt6 < t2w1r2 && t2h1uwt6 < t2w1l2 && t2h1uwt6 < t2h1u2 && t2h1uwt6 < t2h1d2 && t2h1uwt6 < t2w1rwt2 && t2h1uwt6 < t2w1lwt2 && t2h1uwt6 < t2h1uwt2 && t2h1uwt6 < t2h1dwt2
  && t2h1uwt6 < t2w1r3 && t2h1uwt6 < t2w1l3 && t2h1uwt6 < t2h1u3 && t2h1uwt6 < t2h1d3 && t2h1uwt6 < t2w1rwt3 && t2h1uwt6 < t2w1lwt3 && t2h1uwt6 < t2h1uwt3 && t2h1uwt6 < t2h1dwt3
  && t2h1uwt6 < t2w1r4 && t2h1uwt6 < t2w1l4 && t2h1uwt6 < t2h1u4 && t2h1uwt6 < t2h1d4 && t2h1uwt6 < t2w1rwt4 && t2h1uwt6 < t2w1lwt4 && t2h1uwt6 < t2h1uwt4 && t2h1uwt6 < t2h1dwt4
  && t2h1uwt6 < t2w1r5 && t2h1uwt6 < t2w1l5 && t2h1uwt6 < t2h1u5 && t2h1uwt6 < t2h1d5 && t2h1uwt6 < t2w1rwt5 && t2h1uwt6 < t2w1lwt5 && t2h1uwt6 < t2h1uwt5 && t2h1uwt6 < t2h1dwt5
  && t2h1uwt6 < t2w1r6 && t2h1uwt6 < t2w1l6 && t2h1uwt6 < t2h1u6 && t2h1uwt6 < t2h1d6 && t2h1uwt6 < t2w1rwt6 && t2h1uwt6 < t2w1lwt6 && t2h1uwt6 < t2h1dwt6
  && t2h1uwt6 < t2w1r7 && t2h1uwt6 < t2w1l7 && t2h1uwt6 < t2h1u7 && t2h1uwt6 < t2h1d7 && t2h1uwt6 < t2w1rwt7 && t2h1uwt6 < t2w1lwt7 && t2h1uwt6 < t2h1uwt7 && t2h1uwt6 < t2h1dwt7
  && t2h1uwt6 < t2w1r8 && t2h1uwt6 < t2w1l8 && t2h1uwt6 < t2h1u8 && t2h1uwt6 < t2h1d8 && t2h1uwt6 < t2w1rwt8 && t2h1uwt6 < t2w1lwt8 && t2h1uwt6 < t2h1uwt8 && t2h1uwt6 < t2h1dwt8
  && t2h1uwt6 < t2w1r9 && t2h1uwt6 < t2w1l9 && t2h1uwt6 < t2h1u9 && t2h1uwt6 < t2h1d9 && t2h1uwt6 < t2w1rwt9 && t2h1uwt6 < t2w1lwt9 && t2h1uwt6 < t2h1uwt9 && t2h1uwt6 < t2h1dwt9
  && t2h1uwt6 < t2w1r10 && t2h1uwt6 < t2w1l10 && t2h1uwt6 < t2h1u10 && t2h1uwt6 < t2h1d10 && t2h1uwt6 < t2w1rwt10 && t2h1uwt6 < t2w1lwt10 && t2h1uwt6 < t2h1uwt10 && t2h1uwt6 < t2h1dwt10
  && (louthu6 == 0 && linhu6 == 0)){
  i=280;
  }

  if (mydOW6==-1 && t2h1dwt6 > 0 && t2h1dwt6 < t1 
  && t2h1dwt6 < t2w1r && t2h1dwt6 < t2w1l && t2h1dwt6 < t2h1u && t2h1dwt6 < t2h1d && t2h1dwt6 < t2w1rwt && t2h1dwt6 < t2w1lwt && t2h1dwt6 < t2h1uwt && t2h1dwt6 < t2h1dwt 
  && t2h1dwt6 < t2w1r1 && t2h1dwt6 < t2w1l1 && t2h1dwt6 < t2h1u1 && t2h1dwt6 < t2h1d1 && t2h1dwt6 < t2w1rwt1 && t2h1dwt6 < t2w1lwt1 && t2h1dwt6 < t2h1uwt1 && t2h1dwt6 < t2h1dwt1
  && t2h1dwt6 < t2w1r2 && t2h1dwt6 < t2w1l2 && t2h1dwt6 < t2h1u2 && t2h1dwt6 < t2h1d2 && t2h1dwt6 < t2w1rwt2 && t2h1dwt6 < t2w1lwt2 && t2h1dwt6 < t2h1uwt2 && t2h1dwt6 < t2h1dwt2 
  && t2h1dwt6 < t2w1r3 && t2h1dwt6 < t2w1l3 && t2h1dwt6 < t2h1u3 && t2h1dwt6 < t2h1d3 && t2h1dwt6 < t2w1rwt3 && t2h1dwt6 < t2w1lwt3 && t2h1dwt6 < t2h1uwt3 && t2h1dwt6 < t2h1dwt3
  && t2h1dwt6 < t2w1r4 && t2h1dwt6 < t2w1l4 && t2h1dwt6 < t2h1u4 && t2h1dwt6 < t2h1d4 && t2h1dwt6 < t2w1rwt4 && t2h1dwt6 < t2w1lwt4 && t2h1dwt6 < t2h1uwt4 && t2h1dwt6 < t2h1dwt4
  && t2h1dwt6 < t2w1r5 && t2h1dwt6 < t2w1l5 && t2h1dwt6 < t2h1u5 && t2h1dwt6 < t2h1d5 && t2h1dwt6 < t2w1rwt5 && t2h1dwt6 < t2w1lwt5 && t2h1dwt6 < t2h1uwt5 && t2h1dwt6 < t2h1dwt5
  && t2h1dwt6 < t2w1r6 && t2h1dwt6 < t2w1l6 && t2h1dwt6 < t2h1u6 && t2h1dwt6 < t2h1d6 && t2h1dwt6 < t2w1rwt6 && t2h1dwt6 < t2w1lwt6 && t2h1dwt6 < t2h1uwt6 
  && t2h1dwt6 < t2w1r7 && t2h1dwt6 < t2w1l7 && t2h1dwt6 < t2h1u7 && t2h1dwt6 < t2h1d7 && t2h1dwt6 < t2w1rwt7 && t2h1dwt6 < t2w1lwt7 && t2h1dwt6 < t2h1uwt7 && t2h1dwt6 < t2h1dwt7 
  && t2h1dwt6 < t2w1r8 && t2h1dwt6 < t2w1l8 && t2h1dwt6 < t2h1u8 && t2h1dwt6 < t2h1d8 && t2h1dwt6 < t2w1rwt8 && t2h1dwt6 < t2w1lwt8 && t2h1dwt6 < t2h1uwt8 && t2h1dwt6 < t2h1dwt8
  && t2h1dwt6 < t2w1r9 && t2h1dwt6 < t2w1l9 && t2h1dwt6 < t2h1u9 && t2h1dwt6 < t2h1d9 && t2h1dwt6 < t2w1rwt9 && t2h1dwt6 < t2w1lwt9 && t2h1dwt6 < t2h1uwt9 && t2h1dwt6 < t2h1dwt9 
  && t2h1dwt6 < t2w1r10 && t2h1dwt6 < t2w1l10 && t2h1dwt6 < t2h1u10 && t2h1dwt6 < t2h1d10 && t2h1dwt6 < t2w1rwt10 && t2h1dwt6 < t2w1lwt10 && t2h1dwt6 < t2h1uwt10 && t2h1dwt6 < t2h1dwt10  
  && (louthd6 !=0 && linhd6!=0)){
  i=281;
  }

  if (mydOW6==-1 && t2h1dwt6 > 0 && t2h1dwt6 < t1 
  && t2h1dwt6 < t2w1r && t2h1dwt6 < t2w1l && t2h1dwt6 < t2h1u && t2h1dwt6 < t2h1d && t2h1dwt6 < t2w1rwt && t2h1dwt6 < t2w1lwt && t2h1dwt6 < t2h1uwt && t2h1dwt6 < t2h1dwt 
  && t2h1dwt6 < t2w1r1 && t2h1dwt6 < t2w1l1 && t2h1dwt6 < t2h1u1 && t2h1dwt6 < t2h1d1 && t2h1dwt6 < t2w1rwt1 && t2h1dwt6 < t2w1lwt1 && t2h1dwt6 < t2h1uwt1 && t2h1dwt6 < t2h1dwt1
  && t2h1dwt6 < t2w1r2 && t2h1dwt6 < t2w1l2 && t2h1dwt6 < t2h1u2 && t2h1dwt6 < t2h1d2 && t2h1dwt6 < t2w1rwt2 && t2h1dwt6 < t2w1lwt2 && t2h1dwt6 < t2h1uwt2 && t2h1dwt6 < t2h1dwt2 
  && t2h1dwt6 < t2w1r3 && t2h1dwt6 < t2w1l3 && t2h1dwt6 < t2h1u3 && t2h1dwt6 < t2h1d3 && t2h1dwt6 < t2w1rwt3 && t2h1dwt6 < t2w1lwt3 && t2h1dwt6 < t2h1uwt3 && t2h1dwt6 < t2h1dwt3
  && t2h1dwt6 < t2w1r4 && t2h1dwt6 < t2w1l4 && t2h1dwt6 < t2h1u4 && t2h1dwt6 < t2h1d4 && t2h1dwt6 < t2w1rwt4 && t2h1dwt6 < t2w1lwt4 && t2h1dwt6 < t2h1uwt4 && t2h1dwt6 < t2h1dwt4
  && t2h1dwt6 < t2w1r5 && t2h1dwt6 < t2w1l5 && t2h1dwt6 < t2h1u5 && t2h1dwt6 < t2h1d5 && t2h1dwt6 < t2w1rwt5 && t2h1dwt6 < t2w1lwt5 && t2h1dwt6 < t2h1uwt5 && t2h1dwt6 < t2h1dwt5
  && t2h1dwt6 < t2w1r6 && t2h1dwt6 < t2w1l6 && t2h1dwt6 < t2h1u6 && t2h1dwt6 < t2h1d6 && t2h1dwt6 < t2w1rwt6 && t2h1dwt6 < t2w1lwt6 && t2h1dwt6 < t2h1uwt6 
  && t2h1dwt6 < t2w1r7 && t2h1dwt6 < t2w1l7 && t2h1dwt6 < t2h1u7 && t2h1dwt6 < t2h1d7 && t2h1dwt6 < t2w1rwt7 && t2h1dwt6 < t2w1lwt7 && t2h1dwt6 < t2h1uwt7 && t2h1dwt6 < t2h1dwt7 
  && t2h1dwt6 < t2w1r8 && t2h1dwt6 < t2w1l8 && t2h1dwt6 < t2h1u8 && t2h1dwt6 < t2h1d8 && t2h1dwt6 < t2w1rwt8 && t2h1dwt6 < t2w1lwt8 && t2h1dwt6 < t2h1uwt8 && t2h1dwt6 < t2h1dwt8
  && t2h1dwt6 < t2w1r9 && t2h1dwt6 < t2w1l9 && t2h1dwt6 < t2h1u9 && t2h1dwt6 < t2h1d9 && t2h1dwt6 < t2w1rwt9 && t2h1dwt6 < t2w1lwt9 && t2h1dwt6 < t2h1uwt9 && t2h1dwt6 < t2h1dwt9 
  && t2h1dwt6 < t2w1r10 && t2h1dwt6 < t2w1l10 && t2h1dwt6 < t2h1u10 && t2h1dwt6 < t2h1d10 && t2h1dwt6 < t2w1rwt10 && t2h1dwt6 < t2w1lwt10 && t2h1dwt6 < t2h1uwt10 && t2h1dwt6 < t2h1dwt10
  && ((louthd6 !=0 && linhd6==0) || (louthd6 ==0 && linhd6!=0))){
  i=281;
  }

  if (mydOW6==-1 && t2h1dwt6 > 0 && t2h1dwt6 < t1 
  && t2h1dwt6 < t2w1r && t2h1dwt6 < t2w1l && t2h1dwt6 < t2h1u && t2h1dwt6 < t2h1d && t2h1dwt6 < t2w1rwt && t2h1dwt6 < t2w1lwt && t2h1dwt6 < t2h1uwt && t2h1dwt6 < t2h1dwt 
  && t2h1dwt6 < t2w1r1 && t2h1dwt6 < t2w1l1 && t2h1dwt6 < t2h1u1 && t2h1dwt6 < t2h1d1 && t2h1dwt6 < t2w1rwt1 && t2h1dwt6 < t2w1lwt1 && t2h1dwt6 < t2h1uwt1 && t2h1dwt6 < t2h1dwt1
  && t2h1dwt6 < t2w1r2 && t2h1dwt6 < t2w1l2 && t2h1dwt6 < t2h1u2 && t2h1dwt6 < t2h1d2 && t2h1dwt6 < t2w1rwt2 && t2h1dwt6 < t2w1lwt2 && t2h1dwt6 < t2h1uwt2 && t2h1dwt6 < t2h1dwt2 
  && t2h1dwt6 < t2w1r3 && t2h1dwt6 < t2w1l3 && t2h1dwt6 < t2h1u3 && t2h1dwt6 < t2h1d3 && t2h1dwt6 < t2w1rwt3 && t2h1dwt6 < t2w1lwt3 && t2h1dwt6 < t2h1uwt3 && t2h1dwt6 < t2h1dwt3
  && t2h1dwt6 < t2w1r4 && t2h1dwt6 < t2w1l4 && t2h1dwt6 < t2h1u4 && t2h1dwt6 < t2h1d4 && t2h1dwt6 < t2w1rwt4 && t2h1dwt6 < t2w1lwt4 && t2h1dwt6 < t2h1uwt4 && t2h1dwt6 < t2h1dwt4
  && t2h1dwt6 < t2w1r5 && t2h1dwt6 < t2w1l5 && t2h1dwt6 < t2h1u5 && t2h1dwt6 < t2h1d5 && t2h1dwt6 < t2w1rwt5 && t2h1dwt6 < t2w1lwt5 && t2h1dwt6 < t2h1uwt5 && t2h1dwt6 < t2h1dwt5
  && t2h1dwt6 < t2w1r6 && t2h1dwt6 < t2w1l6 && t2h1dwt6 < t2h1u6 && t2h1dwt6 < t2h1d6 && t2h1dwt6 < t2w1rwt6 && t2h1dwt6 < t2w1lwt6 && t2h1dwt6 < t2h1uwt6 
  && t2h1dwt6 < t2w1r7 && t2h1dwt6 < t2w1l7 && t2h1dwt6 < t2h1u7 && t2h1dwt6 < t2h1d7 && t2h1dwt6 < t2w1rwt7 && t2h1dwt6 < t2w1lwt7 && t2h1dwt6 < t2h1uwt7 && t2h1dwt6 < t2h1dwt7 
  && t2h1dwt6 < t2w1r8 && t2h1dwt6 < t2w1l8 && t2h1dwt6 < t2h1u8 && t2h1dwt6 < t2h1d8 && t2h1dwt6 < t2w1rwt8 && t2h1dwt6 < t2w1lwt8 && t2h1dwt6 < t2h1uwt8 && t2h1dwt6 < t2h1dwt8
  && t2h1dwt6 < t2w1r9 && t2h1dwt6 < t2w1l9 && t2h1dwt6 < t2h1u9 && t2h1dwt6 < t2h1d9 && t2h1dwt6 < t2w1rwt9 && t2h1dwt6 < t2w1lwt9 && t2h1dwt6 < t2h1uwt9 && t2h1dwt6 < t2h1dwt9 
  && t2h1dwt6 < t2w1r10 && t2h1dwt6 < t2w1l10 && t2h1dwt6 < t2h1u10 && t2h1dwt6 < t2h1d10 && t2h1dwt6 < t2w1rwt10 && t2h1dwt6 < t2w1lwt10 && t2h1dwt6 < t2h1uwt10 && t2h1dwt6 < t2h1dwt10
  && (louthd6 == 0 && linhd6 == 0)){ 
  i=281;
  }


  if (mxr7!=-1 && t2w1r7 > 0 && t2w1r7 < t1 
     && t2w1r7 < t2w1r && t2w1r7 < t2w1l && t2w1r7 < t2h1u && t2w1r7 < t2h1d && t2w1r7 < t2w1rwt && t2w1r7 < t2w1lwt && t2w1r7 < t2h1uwt && t2w1r7 < t2h1dwt
     && t2w1r7 < t2w1r1 && t2w1r7 < t2w1l1 && t2w1r7 < t2h1u1 && t2w1r7 < t2h1d1 && t2w1r7 < t2w1rwt1 && t2w1r7 < t2w1lwt1 && t2w1r7 < t2h1uwt1 && t2w1r7 < t2h1dwt1
     && t2w1r7 < t2w1r2 && t2w1r7 < t2w1l2 && t2w1r7 < t2h1u2 && t2w1r7 < t2h1d2 && t2w1r7 < t2w1rwt2 && t2w1r7 < t2w1lwt2 && t2w1r7 < t2h1uwt2 && t2w1r7 < t2h1dwt2 
     && t2w1r7 < t2w1r3 && t2w1r7 < t2w1l3 && t2w1r7 < t2h1u3 && t2w1r7 < t2h1d3 && t2w1r7 < t2w1rwt3 && t2w1r7 < t2w1lwt3 && t2w1r7 < t2h1uwt3 && t2w1r7 < t2h1dwt3
     && t2w1r7 < t2w1r4 && t2w1r7 < t2w1l4 && t2w1r7 < t2h1u4 && t2w1r7 < t2h1d4 && t2w1r7 < t2w1rwt4 && t2w1r7 < t2w1lwt4 && t2w1r7 < t2h1uwt4 && t2w1r7 < t2h1dwt4
     && t2w1r7 < t2w1r5 && t2w1r7 < t2w1l5 && t2w1r7 < t2h1u5 && t2w1r7 < t2h1d5 && t2w1r7 < t2w1rwt5 && t2w1r7 < t2w1lwt5 && t2w1r7 < t2h1uwt5 && t2w1r7 < t2h1dwt5
     && t2w1r7 < t2w1r6 && t2w1r7 < t2w1l6 && t2w1r7 < t2h1u6 && t2w1r7 < t2h1d6 && t2w1r7 < t2w1rwt6 && t2w1r7 < t2w1lwt6 && t2w1r7 < t2h1uwt6 && t2w1r7 < t2h1dwt6
     && t2w1r7 < t2w1l7 && t2w1r7 < t2h1u7 && t2w1r7 < t2h1d7 && t2w1r7 < t2w1rwt7 && t2w1r7 < t2w1lwt7 && t2w1r7 < t2h1uwt7 && t2w1r7 < t2h1dwt7
     && t2w1r7 < t2w1r8 && t2w1r7 < t2w1l8 && t2w1r7 < t2h1u8 && t2w1r7 < t2h1d8 && t2w1r7 < t2w1rwt8 && t2w1r7 < t2w1lwt8 && t2w1r7 < t2h1uwt8 && t2w1r7 < t2h1dwt8
     && t2w1r7 < t2w1r9 && t2w1r7 < t2w1l9 && t2w1r7 < t2h1u9 && t2w1r7 < t2h1d9 && t2w1r7 < t2w1rwt9 && t2w1r7 < t2w1lwt9 && t2w1r7 < t2h1uwt9 && t2w1r7 < t2h1dwt9
     && t2w1r7 < t2w1r10 && t2w1r7 < t2w1l10 && t2w1r7 < t2h1u10 && t2w1r7 < t2h1d10 && t2w1r7 < t2w1rwt10 && t2w1r7 < t2w1lwt10 && t2w1r7 < t2h1uwt10 && t2w1r7 < t2h1dwt10
     && ((linwr7!=0) && (loutwr7!=0) )) {	
    if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1r7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1r7+z))*(z0hd7+(vz*t2w1r7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1r7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1r7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1r7+z))*(z0hu7+(vz*t2w1r7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1r7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1r7+y;
  xlimitr=bwr7*sqrt(1-((vz*t2w1r7+z)+z0wr7)*((vz*t2w1r7+z)+z0wr7)/a2wr7);
  xtest=vx*t2w1r7+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr7 > 0){
  i=282;
  }else{
  i=298;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr7!=-1 && t2w1r7 > 0 && t2w1r7 < t1 
     && t2w1r7 < t2w1r && t2w1r7 < t2w1l && t2w1r7 < t2h1u && t2w1r7 < t2h1d && t2w1r7 < t2w1rwt && t2w1r7 < t2w1lwt && t2w1r7 < t2h1uwt && t2w1r7 < t2h1dwt
     && t2w1r7 < t2w1r1 && t2w1r7 < t2w1l1 && t2w1r7 < t2h1u1 && t2w1r7 < t2h1d1 && t2w1r7 < t2w1rwt1 && t2w1r7 < t2w1lwt1 && t2w1r7 < t2h1uwt1 && t2w1r7 < t2h1dwt1
     && t2w1r7 < t2w1r2 && t2w1r7 < t2w1l2 && t2w1r7 < t2h1u2 && t2w1r7 < t2h1d2 && t2w1r7 < t2w1rwt2 && t2w1r7 < t2w1lwt2 && t2w1r7 < t2h1uwt2 && t2w1r7 < t2h1dwt2 
     && t2w1r7 < t2w1r3 && t2w1r7 < t2w1l3 && t2w1r7 < t2h1u3 && t2w1r7 < t2h1d3 && t2w1r7 < t2w1rwt3 && t2w1r7 < t2w1lwt3 && t2w1r7 < t2h1uwt3 && t2w1r7 < t2h1dwt3
     && t2w1r7 < t2w1r4 && t2w1r7 < t2w1l4 && t2w1r7 < t2h1u4 && t2w1r7 < t2h1d4 && t2w1r7 < t2w1rwt4 && t2w1r7 < t2w1lwt4 && t2w1r7 < t2h1uwt4 && t2w1r7 < t2h1dwt4
     && t2w1r7 < t2w1r5 && t2w1r7 < t2w1l5 && t2w1r7 < t2h1u5 && t2w1r7 < t2h1d5 && t2w1r7 < t2w1rwt5 && t2w1r7 < t2w1lwt5 && t2w1r7 < t2h1uwt5 && t2w1r7 < t2h1dwt5
     && t2w1r7 < t2w1r6 && t2w1r7 < t2w1l6 && t2w1r7 < t2h1u6 && t2w1r7 < t2h1d6 && t2w1r7 < t2w1rwt6 && t2w1r7 < t2w1lwt6 && t2w1r7 < t2h1uwt6 && t2w1r7 < t2h1dwt6
     && t2w1r7 < t2w1l7 && t2w1r7 < t2h1u7 && t2w1r7 < t2h1d7 && t2w1r7 < t2w1rwt7 && t2w1r7 < t2w1lwt7 && t2w1r7 < t2h1uwt7 && t2w1r7 < t2h1dwt7
     && t2w1r7 < t2w1r8 && t2w1r7 < t2w1l8 && t2w1r7 < t2h1u8 && t2w1r7 < t2h1d8 && t2w1r7 < t2w1rwt8 && t2w1r7 < t2w1lwt8 && t2w1r7 < t2h1uwt8 && t2w1r7 < t2h1dwt8
     && t2w1r7 < t2w1r9 && t2w1r7 < t2w1l9 && t2w1r7 < t2h1u9 && t2w1r7 < t2h1d9 && t2w1r7 < t2w1rwt9 && t2w1r7 < t2w1lwt9 && t2w1r7 < t2h1uwt9 && t2w1r7 < t2h1dwt9
     && t2w1r7 < t2w1r10 && t2w1r7 < t2w1l10 && t2w1r7 < t2h1u10 && t2w1r7 < t2h1d10 && t2w1r7 < t2w1rwt10 && t2w1r7 < t2w1lwt10 && t2w1r7 < t2h1uwt10 && t2w1r7 < t2h1dwt10
     && ((loutwr7!=0 && linwr7==0) || (loutwr7==0 && linwr7!=0))){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1r7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1r7+z))*(z0hd7+(vz*t2w1r7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1r7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1r7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1r7+z))*(z0hu7+(vz*t2w1r7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1r7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1r7+y;
  xtest=vx*t2w1r7+x;
  xlimitr=-sqrt(pbwr7-(vz*t2w1r7+z)/pawr7);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr7 > 0){
  i=283;
  }else{
  i=298;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr7!=-1 && t2w1r7 > 0 && t2w1r7 < t1 
     && t2w1r7 < t2w1r && t2w1r7 < t2w1l && t2w1r7 < t2h1u && t2w1r7 < t2h1d && t2w1r7 < t2w1rwt && t2w1r7 < t2w1lwt && t2w1r7 < t2h1uwt && t2w1r7 < t2h1dwt
     && t2w1r7 < t2w1r1 && t2w1r7 < t2w1l1 && t2w1r7 < t2h1u1 && t2w1r7 < t2h1d1 && t2w1r7 < t2w1rwt1 && t2w1r7 < t2w1lwt1 && t2w1r7 < t2h1uwt1 && t2w1r7 < t2h1dwt1
     && t2w1r7 < t2w1r2 && t2w1r7 < t2w1l2 && t2w1r7 < t2h1u2 && t2w1r7 < t2h1d2 && t2w1r7 < t2w1rwt2 && t2w1r7 < t2w1lwt2 && t2w1r7 < t2h1uwt2 && t2w1r7 < t2h1dwt2 
     && t2w1r7 < t2w1r3 && t2w1r7 < t2w1l3 && t2w1r7 < t2h1u3 && t2w1r7 < t2h1d3 && t2w1r7 < t2w1rwt3 && t2w1r7 < t2w1lwt3 && t2w1r7 < t2h1uwt3 && t2w1r7 < t2h1dwt3
     && t2w1r7 < t2w1r4 && t2w1r7 < t2w1l4 && t2w1r7 < t2h1u4 && t2w1r7 < t2h1d4 && t2w1r7 < t2w1rwt4 && t2w1r7 < t2w1lwt4 && t2w1r7 < t2h1uwt4 && t2w1r7 < t2h1dwt4
     && t2w1r7 < t2w1r5 && t2w1r7 < t2w1l5 && t2w1r7 < t2h1u5 && t2w1r7 < t2h1d5 && t2w1r7 < t2w1rwt5 && t2w1r7 < t2w1lwt5 && t2w1r7 < t2h1uwt5 && t2w1r7 < t2h1dwt5
     && t2w1r7 < t2w1r6 && t2w1r7 < t2w1l6 && t2w1r7 < t2h1u6 && t2w1r7 < t2h1d6 && t2w1r7 < t2w1rwt6 && t2w1r7 < t2w1lwt6 && t2w1r7 < t2h1uwt6 && t2w1r7 < t2h1dwt6
     && t2w1r7 < t2w1l7 && t2w1r7 < t2h1u7 && t2w1r7 < t2h1d7 && t2w1r7 < t2w1rwt7 && t2w1r7 < t2w1lwt7 && t2w1r7 < t2h1uwt7 && t2w1r7 < t2h1dwt7
     && t2w1r7 < t2w1r8 && t2w1r7 < t2w1l8 && t2w1r7 < t2h1u8 && t2w1r7 < t2h1d8 && t2w1r7 < t2w1rwt8 && t2w1r7 < t2w1lwt8 && t2w1r7 < t2h1uwt8 && t2w1r7 < t2h1dwt8
     && t2w1r7 < t2w1r9 && t2w1r7 < t2w1l9 && t2w1r7 < t2h1u9 && t2w1r7 < t2h1d9 && t2w1r7 < t2w1rwt9 && t2w1r7 < t2w1lwt9 && t2w1r7 < t2h1uwt9 && t2w1r7 < t2h1dwt9
     && t2w1r7 < t2w1r10 && t2w1r7 < t2w1l10 && t2w1r7 < t2h1u10 && t2w1r7 < t2h1d10 && t2w1r7 < t2w1rwt10 && t2w1r7 < t2w1lwt10 && t2w1r7 < t2h1uwt10 && t2w1r7 < t2h1dwt10
     && (loutwr7==0 && linwr7==0)){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1r7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1r7+z))*(z0hd7+(vz*t2w1r7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1r7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1r7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1r7+z))*(z0hu7+(vz*t2w1r7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1r7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1r7+y;
  xtest=vx*t2w1r7+x;
  xlimitr=-(w2r7+w1r7)*(vz*t2w1r7+z)/l-w1r7;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr7>0){
  i=284;
  }else{
  i=298;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl7!=-1 && t2w1l7 > 0 && t2w1l7 < t1 
      && t2w1l7 < t2w1r && t2w1l7 < t2w1l && t2w1l7 < t2h1u && t2w1l7 < t2h1d && t2w1l7 < t2w1rwt && t2w1l7 < t2w1lwt && t2w1l7 < t2h1uwt && t2w1l7 < t2h1dwt
      && t2w1l7 < t2w1r1 && t2w1l7 < t2w1l1 && t2w1l7 < t2h1u1 && t2w1l7 < t2h1d1 && t2w1l7 < t2w1rwt1 && t2w1l7 < t2w1lwt1 && t2w1l7 < t2h1uwt1 && t2w1l7 < t2h1dwt1
      && t2w1l7 < t2w1r2 && t2w1l7 < t2w1l2 && t2w1l7 < t2h1u2 && t2w1l7 < t2h1d2 && t2w1l7 < t2w1rwt2 && t2w1l7 < t2w1lwt2 && t2w1l7 < t2h1uwt2 && t2w1l7 < t2h1dwt2
      && t2w1l7 < t2w1r3 && t2w1l7 < t2w1l3 && t2w1l7 < t2h1u3 && t2w1l7 < t2h1d3 && t2w1l7 < t2w1rwt3 && t2w1l7 < t2w1lwt3 && t2w1l7 < t2h1uwt3 && t2w1l7 < t2h1dwt3
      && t2w1l7 < t2w1r4 && t2w1l7 < t2w1l4 && t2w1l7 < t2h1u4 && t2w1l7 < t2h1d4 && t2w1l7 < t2w1rwt4 && t2w1l7 < t2w1lwt4 && t2w1l7 < t2h1uwt4 && t2w1l7 < t2h1dwt4
      && t2w1l7 < t2w1r5 && t2w1l7 < t2w1l5 && t2w1l7 < t2h1u5 && t2w1l7 < t2h1d5 && t2w1l7 < t2w1rwt5 && t2w1l7 < t2w1lwt5 && t2w1l7 < t2h1uwt5 && t2w1l7 < t2h1dwt5
      && t2w1l7 < t2w1r6 && t2w1l7 < t2w1l6 && t2w1l7 < t2h1u6 && t2w1l7 < t2h1d6 && t2w1l7 < t2w1rwt6 && t2w1l7 < t2w1lwt6 && t2w1l7 < t2h1uwt6 && t2w1l7 < t2h1dwt6
      && t2w1l7 < t2w1r7 && t2w1l7 < t2h1u7 && t2w1l7 < t2h1d7 && t2w1l7 < t2w1rwt7 && t2w1l7 < t2w1lwt7 && t2w1l7 < t2h1uwt7 && t2w1l7 < t2h1dwt7
      && t2w1l7 < t2w1r8 && t2w1l7 < t2w1l8 && t2w1l7 < t2h1u8 && t2w1l7 < t2h1d8 && t2w1l7 < t2w1rwt8 && t2w1l7 < t2w1lwt8 && t2w1l7 < t2h1uwt8 && t2w1l7 < t2h1dwt8
      && t2w1l7 < t2w1r9 && t2w1l7 < t2w1l9 && t2w1l7 < t2h1u9 && t2w1l7 < t2h1d9 && t2w1l7 < t2w1rwt9 && t2w1l7 < t2w1lwt9 && t2w1l7 < t2h1uwt9 && t2w1l7 < t2h1dwt9
      && t2w1l7 < t2w1r10 && t2w1l7 < t2w1l10 && t2w1l7 < t2h1u10 && t2w1l7 < t2h1d10 && t2w1l7 < t2w1rwt10 && t2w1l7 < t2w1lwt10 && t2w1l7 < t2h1uwt10 && t2w1l7 < t2h1dwt10
      && ((linwl7!=0) && (loutwl7!=0) )){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1l7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1l7+z))*(z0hd7+(vz*t2w1l7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1l7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1l7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1l7+z))*(z0hu7+(vz*t2w1l7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1l7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1l7+y;
  xlimitl=bwl7*sqrt(1-((vz*t2w1l7+z)+z0wl7)*((vz*t2w1l7+z)+z0wl7)/a2wl7);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl7>0){
  i=285;
  }else{
  i=299;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl7!=-1 && t2w1l7 > 0 && t2w1l7 < t1 
      && t2w1l7 < t2w1r && t2w1l7 < t2w1l && t2w1l7 < t2h1u && t2w1l7 < t2h1d && t2w1l7 < t2w1rwt && t2w1l7 < t2w1lwt && t2w1l7 < t2h1uwt && t2w1l7 < t2h1dwt
      && t2w1l7 < t2w1r1 && t2w1l7 < t2w1l1 && t2w1l7 < t2h1u1 && t2w1l7 < t2h1d1 && t2w1l7 < t2w1rwt1 && t2w1l7 < t2w1lwt1 && t2w1l7 < t2h1uwt1 && t2w1l7 < t2h1dwt1
      && t2w1l7 < t2w1r2 && t2w1l7 < t2w1l2 && t2w1l7 < t2h1u2 && t2w1l7 < t2h1d2 && t2w1l7 < t2w1rwt2 && t2w1l7 < t2w1lwt2 && t2w1l7 < t2h1uwt2 && t2w1l7 < t2h1dwt2
      && t2w1l7 < t2w1r3 && t2w1l7 < t2w1l3 && t2w1l7 < t2h1u3 && t2w1l7 < t2h1d3 && t2w1l7 < t2w1rwt3 && t2w1l7 < t2w1lwt3 && t2w1l7 < t2h1uwt3 && t2w1l7 < t2h1dwt3
      && t2w1l7 < t2w1r4 && t2w1l7 < t2w1l4 && t2w1l7 < t2h1u4 && t2w1l7 < t2h1d4 && t2w1l7 < t2w1rwt4 && t2w1l7 < t2w1lwt4 && t2w1l7 < t2h1uwt4 && t2w1l7 < t2h1dwt4
      && t2w1l7 < t2w1r5 && t2w1l7 < t2w1l5 && t2w1l7 < t2h1u5 && t2w1l7 < t2h1d5 && t2w1l7 < t2w1rwt5 && t2w1l7 < t2w1lwt5 && t2w1l7 < t2h1uwt5 && t2w1l7 < t2h1dwt5
      && t2w1l7 < t2w1r6 && t2w1l7 < t2w1l6 && t2w1l7 < t2h1u6 && t2w1l7 < t2h1d6 && t2w1l7 < t2w1rwt6 && t2w1l7 < t2w1lwt6 && t2w1l7 < t2h1uwt6 && t2w1l7 < t2h1dwt6
      && t2w1l7 < t2w1r7 && t2w1l7 < t2h1u7 && t2w1l7 < t2h1d7 && t2w1l7 < t2w1rwt7 && t2w1l7 < t2w1lwt7 && t2w1l7 < t2h1uwt7 && t2w1l7 < t2h1dwt7
      && t2w1l7 < t2w1r8 && t2w1l7 < t2w1l8 && t2w1l7 < t2h1u8 && t2w1l7 < t2h1d8 && t2w1l7 < t2w1rwt8 && t2w1l7 < t2w1lwt8 && t2w1l7 < t2h1uwt8 && t2w1l7 < t2h1dwt8
      && t2w1l7 < t2w1r9 && t2w1l7 < t2w1l9 && t2w1l7 < t2h1u9 && t2w1l7 < t2h1d9 && t2w1l7 < t2w1rwt9 && t2w1l7 < t2w1lwt9 && t2w1l7 < t2h1uwt9 && t2w1l7 < t2h1dwt9
      && t2w1l7 < t2w1r10 && t2w1l7 < t2w1l10 && t2w1l7 < t2h1u10 && t2w1l7 < t2h1d10 && t2w1l7 < t2w1rwt10 && t2w1l7 < t2w1lwt10 && t2w1l7 < t2h1uwt10 && t2w1l7 < t2h1dwt10
      && ((loutwl7!=0 && linwl7==0) || (loutwl7==0 && linwl7!=0))){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1l7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1l7+z))*(z0hd7+(vz*t2w1l7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1l7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1l7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1l7+z))*(z0hu7+(vz*t2w1l7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1l7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1l7+y;
  xlimitl=sqrt(pbwl7-(vz*t2w1l7+z)/pawl7);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl7>0){
  i=286;
  }else{
  i=299;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl7!=-1 && t2w1l7 > 0 && t2w1l7 < t1 
      && t2w1l7 < t2w1r && t2w1l7 < t2w1l && t2w1l7 < t2h1u && t2w1l7 < t2h1d && t2w1l7 < t2w1rwt && t2w1l7 < t2w1lwt && t2w1l7 < t2h1uwt && t2w1l7 < t2h1dwt
      && t2w1l7 < t2w1r1 && t2w1l7 < t2w1l1 && t2w1l7 < t2h1u1 && t2w1l7 < t2h1d1 && t2w1l7 < t2w1rwt1 && t2w1l7 < t2w1lwt1 && t2w1l7 < t2h1uwt1 && t2w1l7 < t2h1dwt1
      && t2w1l7 < t2w1r2 && t2w1l7 < t2w1l2 && t2w1l7 < t2h1u2 && t2w1l7 < t2h1d2 && t2w1l7 < t2w1rwt2 && t2w1l7 < t2w1lwt2 && t2w1l7 < t2h1uwt2 && t2w1l7 < t2h1dwt2
      && t2w1l7 < t2w1r3 && t2w1l7 < t2w1l3 && t2w1l7 < t2h1u3 && t2w1l7 < t2h1d3 && t2w1l7 < t2w1rwt3 && t2w1l7 < t2w1lwt3 && t2w1l7 < t2h1uwt3 && t2w1l7 < t2h1dwt3
      && t2w1l7 < t2w1r4 && t2w1l7 < t2w1l4 && t2w1l7 < t2h1u4 && t2w1l7 < t2h1d4 && t2w1l7 < t2w1rwt4 && t2w1l7 < t2w1lwt4 && t2w1l7 < t2h1uwt4 && t2w1l7 < t2h1dwt4
      && t2w1l7 < t2w1r5 && t2w1l7 < t2w1l5 && t2w1l7 < t2h1u5 && t2w1l7 < t2h1d5 && t2w1l7 < t2w1rwt5 && t2w1l7 < t2w1lwt5 && t2w1l7 < t2h1uwt5 && t2w1l7 < t2h1dwt5
      && t2w1l7 < t2w1r6 && t2w1l7 < t2w1l6 && t2w1l7 < t2h1u6 && t2w1l7 < t2h1d6 && t2w1l7 < t2w1rwt6 && t2w1l7 < t2w1lwt6 && t2w1l7 < t2h1uwt6 && t2w1l7 < t2h1dwt6
      && t2w1l7 < t2w1r7 && t2w1l7 < t2h1u7 && t2w1l7 < t2h1d7 && t2w1l7 < t2w1rwt7 && t2w1l7 < t2w1lwt7 && t2w1l7 < t2h1uwt7 && t2w1l7 < t2h1dwt7
      && t2w1l7 < t2w1r8 && t2w1l7 < t2w1l8 && t2w1l7 < t2h1u8 && t2w1l7 < t2h1d8 && t2w1l7 < t2w1rwt8 && t2w1l7 < t2w1lwt8 && t2w1l7 < t2h1uwt8 && t2w1l7 < t2h1dwt8
      && t2w1l7 < t2w1r9 && t2w1l7 < t2w1l9 && t2w1l7 < t2h1u9 && t2w1l7 < t2h1d9 && t2w1l7 < t2w1rwt9 && t2w1l7 < t2w1lwt9 && t2w1l7 < t2h1uwt9 && t2w1l7 < t2h1dwt9
      && t2w1l7 < t2w1r10 && t2w1l7 < t2w1l10 && t2w1l7 < t2h1u10 && t2w1l7 < t2h1d10 && t2w1l7 < t2w1rwt10 && t2w1l7 < t2w1lwt10 && t2w1l7 < t2h1uwt10 && t2w1l7 < t2h1dwt10
      && (loutwl7==0 && linwl7==0)){
 if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1l7+z)-h1d7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhd7*sqrt(1-((z0hd7+(vz*t2w1l7+z))*(z0hd7+(vz*t2w1l7+z)))/a2hd7);
      }else{
      ylimitd=-sqrt(((vz*t2w1l7+z)-pbhd7)/-pahd7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1l7+z)+h1u7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhu7*sqrt(1-((z0hu7+(vz*t2w1l7+z))*(z0hu7+(vz*t2w1l7+z)))/a2hu7);
     }else{
     ylimitu=sqrt(((vz*t2w1l7+z)-pbhu7)/-pahu7);
    }
    }
  ytest=vy*t2w1l7+y;
  xlimitl=(w2l7-w1l7)*(vz*t2w1l7+z)/l+w1l7;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl7>0){
  i=287;
  }else{
  i=299;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu7!=-1 && t2h1u7 > 0 && t2h1u7 < t1 
  && t2h1u7 < t2w1r && t2h1u7 < t2w1l && t2h1u7 < t2h1u && t2h1u7 < t2h1d && t2h1u7 < t2w1rwt && t2h1u7 < t2w1lwt && t2h1u7 < t2h1uwt && t2h1u7 < t2h1dwt
  && t2h1u7 < t2w1r1 && t2h1u7 < t2w1l1 && t2h1u7 < t2h1u1 && t2h1u7 < t2h1d1 && t2h1u7 < t2w1rwt1 && t2h1u7 < t2w1lwt1 && t2h1u7 < t2h1uwt1 && t2h1u7 < t2h1dwt1
  && t2h1u7 < t2w1r2 && t2h1u7 < t2w1l2 && t2h1u7 < t2h1u2 && t2h1u7 < t2h1d2 && t2h1u7 < t2w1rwt2 && t2h1u7 < t2w1lwt2 && t2h1u7 < t2h1uwt2 && t2h1u7 < t2h1dwt2
  && t2h1u7 < t2w1r3 && t2h1u7 < t2w1l3 && t2h1u7 < t2h1u3 && t2h1u7 < t2h1d3 && t2h1u7 < t2w1rwt3 && t2h1u7 < t2w1lwt3 && t2h1u7 < t2h1uwt3 && t2h1u7 < t2h1dwt3
  && t2h1u7 < t2w1r4 && t2h1u7 < t2w1l4 && t2h1u7 < t2h1u4 && t2h1u7 < t2h1d4 && t2h1u7 < t2w1rwt4 && t2h1u7 < t2w1lwt4 && t2h1u7 < t2h1uwt4 && t2h1u7 < t2h1dwt4
  && t2h1u7 < t2w1r5 && t2h1u7 < t2w1l5 && t2h1u7 < t2h1u5 && t2h1u7 < t2h1d5 && t2h1u7 < t2w1rwt5 && t2h1u7 < t2w1lwt5 && t2h1u7 < t2h1uwt5 && t2h1u7 < t2h1dwt5
  && t2h1u7 < t2w1r6 && t2h1u7 < t2w1l6 && t2h1u7 < t2h1u6 && t2h1u7 < t2h1d6 && t2h1u7 < t2w1rwt6 && t2h1u7 < t2w1lwt6 && t2h1u7 < t2h1uwt6 && t2h1u7 < t2h1dwt6
  && t2h1u7 < t2w1r7 && t2h1u7 < t2w1l7 && t2h1u7 < t2h1d7 && t2h1u7 < t2w1rwt7 && t2h1u7 < t2w1lwt7 && t2h1u7 < t2h1uwt7 && t2h1u7 < t2h1dwt7
  && t2h1u7 < t2w1r8 && t2h1u7 < t2w1l8 && t2h1u7 < t2h1u8 && t2h1u7 < t2h1d8 && t2h1u7 < t2w1rwt8 && t2h1u7 < t2w1lwt8 && t2h1u7 < t2h1uwt8 && t2h1u7 < t2h1dwt8
  && t2h1u7 < t2w1r9 && t2h1u7 < t2w1l9 && t2h1u7 < t2h1u9 && t2h1u7 < t2h1d9 && t2h1u7 < t2w1rwt9 && t2h1u7 < t2w1lwt9 && t2h1u7 < t2h1uwt9 && t2h1u7 < t2h1dwt9
  && t2h1u7 < t2w1r10 && t2h1u7 < t2w1l10 && t2h1u7 < t2h1u10 && t2h1u7 < t2h1d10 && t2h1u7 < t2w1rwt10 && t2h1u7 < t2w1lwt10 && t2h1u7 < t2h1uwt10 && t2h1u7 < t2h1dwt10
  && (louthu7 !=0 && linhu7!=0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1u7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1u7+z))*(z0wr7+(vz*t2h1u7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1u7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1u7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1u7+z))*(z0wl7+(vz*t2h1u7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1u7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1u7+x;
  ylimitu=bhu7*sqrt(1-((vz*t2h1u7+z)+z0hu7)*((vz*t2h1u7+z)+z0hu7)/a2hu7);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu7>0 ){
  i=288;
  }else{
  i=300;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu7!=-1 && t2h1u7 > 0 && t2h1u7 < t1
  && t2h1u7 < t2w1r && t2h1u7 < t2w1l && t2h1u7 < t2h1u && t2h1u7 < t2h1d && t2h1u7 < t2w1rwt && t2h1u7 < t2w1lwt && t2h1u7 < t2h1uwt && t2h1u7 < t2h1dwt
  && t2h1u7 < t2w1r1 && t2h1u7 < t2w1l1 && t2h1u7 < t2h1u1 && t2h1u7 < t2h1d1 && t2h1u7 < t2w1rwt1 && t2h1u7 < t2w1lwt1 && t2h1u7 < t2h1uwt1 && t2h1u7 < t2h1dwt1
  && t2h1u7 < t2w1r2 && t2h1u7 < t2w1l2 && t2h1u7 < t2h1u2 && t2h1u7 < t2h1d2 && t2h1u7 < t2w1rwt2 && t2h1u7 < t2w1lwt2 && t2h1u7 < t2h1uwt2 && t2h1u7 < t2h1dwt2
  && t2h1u7 < t2w1r3 && t2h1u7 < t2w1l3 && t2h1u7 < t2h1u3 && t2h1u7 < t2h1d3 && t2h1u7 < t2w1rwt3 && t2h1u7 < t2w1lwt3 && t2h1u7 < t2h1uwt3 && t2h1u7 < t2h1dwt3
  && t2h1u7 < t2w1r4 && t2h1u7 < t2w1l4 && t2h1u7 < t2h1u4 && t2h1u7 < t2h1d4 && t2h1u7 < t2w1rwt4 && t2h1u7 < t2w1lwt4 && t2h1u7 < t2h1uwt4 && t2h1u7 < t2h1dwt4
  && t2h1u7 < t2w1r5 && t2h1u7 < t2w1l5 && t2h1u7 < t2h1u5 && t2h1u7 < t2h1d5 && t2h1u7 < t2w1rwt5 && t2h1u7 < t2w1lwt5 && t2h1u7 < t2h1uwt5 && t2h1u7 < t2h1dwt5
  && t2h1u7 < t2w1r6 && t2h1u7 < t2w1l6 && t2h1u7 < t2h1u6 && t2h1u7 < t2h1d6 && t2h1u7 < t2w1rwt6 && t2h1u7 < t2w1lwt6 && t2h1u7 < t2h1uwt6 && t2h1u7 < t2h1dwt6
  && t2h1u7 < t2w1r7 && t2h1u7 < t2w1l7 && t2h1u7 < t2h1d7 && t2h1u7 < t2w1rwt7 && t2h1u7 < t2w1lwt7 && t2h1u7 < t2h1uwt7 && t2h1u7 < t2h1dwt7
  && t2h1u7 < t2w1r8 && t2h1u7 < t2w1l8 && t2h1u7 < t2h1u8 && t2h1u7 < t2h1d8 && t2h1u7 < t2w1rwt8 && t2h1u7 < t2w1lwt8 && t2h1u7 < t2h1uwt8 && t2h1u7 < t2h1dwt8
  && t2h1u7 < t2w1r9 && t2h1u7 < t2w1l9 && t2h1u7 < t2h1u9 && t2h1u7 < t2h1d9 && t2h1u7 < t2w1rwt9 && t2h1u7 < t2w1lwt9 && t2h1u7 < t2h1uwt9 && t2h1u7 < t2h1dwt9
  && t2h1u7 < t2w1r10 && t2h1u7 < t2w1l10 && t2h1u7 < t2h1u10 && t2h1u7 < t2h1d10 && t2h1u7 < t2w1rwt10 && t2h1u7 < t2w1lwt10 && t2h1u7 < t2h1uwt10 && t2h1u7 < t2h1dwt10 
  && ((louthu7!=0 && linhu7==0) || (louthu7==0 && linhu7!=0))){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1u7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1u7+z))*(z0wr7+(vz*t2h1u7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1u7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1u7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1u7+z))*(z0wl7+(vz*t2h1u7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1u7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1u7+x;
  ylimitu=sqrt(pbhu7-(vz*t2h1u7+z)/pahu7);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu7>0){
  i=289;
  }else{
  i=300;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu7!=-1 && t2h1u7 > 0 && t2h1u7 < t1
  && t2h1u7 < t2w1r && t2h1u7 < t2w1l && t2h1u7 < t2h1u && t2h1u7 < t2h1d && t2h1u7 < t2w1rwt && t2h1u7 < t2w1lwt && t2h1u7 < t2h1uwt && t2h1u7 < t2h1dwt
  && t2h1u7 < t2w1r1 && t2h1u7 < t2w1l1 && t2h1u7 < t2h1u1 && t2h1u7 < t2h1d1 && t2h1u7 < t2w1rwt1 && t2h1u7 < t2w1lwt1 && t2h1u7 < t2h1uwt1 && t2h1u7 < t2h1dwt1
  && t2h1u7 < t2w1r2 && t2h1u7 < t2w1l2 && t2h1u7 < t2h1u2 && t2h1u7 < t2h1d2 && t2h1u7 < t2w1rwt2 && t2h1u7 < t2w1lwt2 && t2h1u7 < t2h1uwt2 && t2h1u7 < t2h1dwt2
  && t2h1u7 < t2w1r3 && t2h1u7 < t2w1l3 && t2h1u7 < t2h1u3 && t2h1u7 < t2h1d3 && t2h1u7 < t2w1rwt3 && t2h1u7 < t2w1lwt3 && t2h1u7 < t2h1uwt3 && t2h1u7 < t2h1dwt3
  && t2h1u7 < t2w1r4 && t2h1u7 < t2w1l4 && t2h1u7 < t2h1u4 && t2h1u7 < t2h1d4 && t2h1u7 < t2w1rwt4 && t2h1u7 < t2w1lwt4 && t2h1u7 < t2h1uwt4 && t2h1u7 < t2h1dwt4
  && t2h1u7 < t2w1r5 && t2h1u7 < t2w1l5 && t2h1u7 < t2h1u5 && t2h1u7 < t2h1d5 && t2h1u7 < t2w1rwt5 && t2h1u7 < t2w1lwt5 && t2h1u7 < t2h1uwt5 && t2h1u7 < t2h1dwt5
  && t2h1u7 < t2w1r6 && t2h1u7 < t2w1l6 && t2h1u7 < t2h1u6 && t2h1u7 < t2h1d6 && t2h1u7 < t2w1rwt6 && t2h1u7 < t2w1lwt6 && t2h1u7 < t2h1uwt6 && t2h1u7 < t2h1dwt6
  && t2h1u7 < t2w1r7 && t2h1u7 < t2w1l7 && t2h1u7 < t2h1d7 && t2h1u7 < t2w1rwt7 && t2h1u7 < t2w1lwt7 && t2h1u7 < t2h1uwt7 && t2h1u7 < t2h1dwt7
  && t2h1u7 < t2w1r8 && t2h1u7 < t2w1l8 && t2h1u7 < t2h1u8 && t2h1u7 < t2h1d8 && t2h1u7 < t2w1rwt8 && t2h1u7 < t2w1lwt8 && t2h1u7 < t2h1uwt8 && t2h1u7 < t2h1dwt8
  && t2h1u7 < t2w1r9 && t2h1u7 < t2w1l9 && t2h1u7 < t2h1u9 && t2h1u7 < t2h1d9 && t2h1u7 < t2w1rwt9 && t2h1u7 < t2w1lwt9 && t2h1u7 < t2h1uwt9 && t2h1u7 < t2h1dwt9
  && t2h1u7 < t2w1r10 && t2h1u7 < t2w1l10 && t2h1u7 < t2h1u10 && t2h1u7 < t2h1d10 && t2h1u7 < t2w1rwt10 && t2h1u7 < t2w1lwt10 && t2h1u7 < t2h1uwt10 && t2h1u7 < t2h1dwt10
  && (louthu7 == 0 && linhu7 == 0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1u7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1u7+z))*(z0wr7+(vz*t2h1u7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1u7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1u7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1u7+z))*(z0wl7+(vz*t2h1u7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1u7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1u7+x;
  ylimitu=(h2u7-h1u7)*(vz*t2h1u7+z)/l+h1u7;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu7>0 ){
  i=290;
  }else{
  i=300;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd7!=-1 && t2h1d7 > 0 && t2h1d7 < t1 
  && t2h1d7 < t2w1r && t2h1d7 < t2w1l && t2h1d7 < t2h1u && t2h1d7 < t2h1d && t2h1d7 < t2w1rwt && t2h1d7 < t2w1lwt && t2h1d7 < t2h1uwt && t2h1d7 < t2h1dwt
  && t2h1d7 < t2w1r1 && t2h1d7 < t2w1l1 && t2h1d7 < t2h1u1 && t2h1d7 < t2h1d1 && t2h1d7 < t2w1rwt1 && t2h1d7 < t2w1lwt1 && t2h1d7 < t2h1uwt1 && t2h1d7 < t2h1dwt1
  && t2h1d7 < t2w1r2 && t2h1d7 < t2w1l2 && t2h1d7 < t2h1u2 && t2h1d7 < t2h1d2 && t2h1d7 < t2w1rwt2 && t2h1d7 < t2w1lwt2 && t2h1d7 < t2h1uwt2 && t2h1d7 < t2h1dwt2
  && t2h1d7 < t2w1r3 && t2h1d7 < t2w1l3 && t2h1d7 < t2h1u3 && t2h1d7 < t2h1d3 && t2h1d7 < t2w1rwt3 && t2h1d7 < t2w1lwt3 && t2h1d7 < t2h1uwt3 && t2h1d7 < t2h1dwt3
  && t2h1d7 < t2w1r4 && t2h1d7 < t2w1l4 && t2h1d7 < t2h1u4 && t2h1d7 < t2h1d4 && t2h1d7 < t2w1rwt4 && t2h1d7 < t2w1lwt4 && t2h1d7 < t2h1uwt4 && t2h1d7 < t2h1dwt4
  && t2h1d7 < t2w1r5 && t2h1d7 < t2w1l5 && t2h1d7 < t2h1u5 && t2h1d7 < t2h1d5 && t2h1d7 < t2w1rwt5 && t2h1d7 < t2w1lwt5 && t2h1d7 < t2h1uwt5 && t2h1d7 < t2h1dwt5
  && t2h1d7 < t2w1r6 && t2h1d7 < t2w1l6 && t2h1d7 < t2h1u6 && t2h1d7 < t2h1d6 && t2h1d7 < t2w1rwt6 && t2h1d7 < t2w1lwt6 && t2h1d7 < t2h1uwt6 && t2h1d7 < t2h1dwt6
  && t2h1d7 < t2w1r7 && t2h1d7 < t2w1l7 && t2h1d7 < t2h1u7 && t2h1d7 < t2w1rwt7 && t2h1d7 < t2w1lwt7 && t2h1d7 < t2h1uwt7 && t2h1d7 < t2h1dwt7
  && t2h1d7 < t2w1r8 && t2h1d7 < t2w1l8 && t2h1d7 < t2h1u8 && t2h1d7 < t2h1d8 && t2h1d7 < t2w1rwt8 && t2h1d7 < t2w1lwt8 && t2h1d7 < t2h1uwt8 && t2h1d7 < t2h1dwt8
  && t2h1d7 < t2w1r9 && t2h1d7 < t2w1l9 && t2h1d7 < t2h1u9 && t2h1d7 < t2h1d9 && t2h1d7 < t2w1rwt9 && t2h1d7 < t2w1lwt9 && t2h1d7 < t2h1uwt9 && t2h1d7 < t2h1dwt9
  && t2h1d7 < t2w1r10 && t2h1d7 < t2w1l10 && t2h1d7 < t2h1u10 && t2h1d7 < t2h1d10 && t2h1d7 < t2w1rwt10 && t2h1d7 < t2w1lwt10 && t2h1d7 < t2h1uwt10 && t2h1d7 < t2h1dwt10
  && (louthd7 !=0 && linhd7!=0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1d7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1d7+z))*(z0wr7+(vz*t2h1d7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1d7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1d7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1d7+z))*(z0wl7+(vz*t2h1d7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1d7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1d7+x;
  ylimitd=-bhd7*sqrt(1-((vz*t2h1d7+z)+z0hd7)*((vz*t2h1d7+z)+z0hd7)/a2hd7);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd7>0){
  i=291;
  }else{
  i=301;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd7!=-1 && t2h1d7 > 0 && t2h1d7 < t1 
  && t2h1d7 < t2w1r && t2h1d7 < t2w1l && t2h1d7 < t2h1u && t2h1d7 < t2h1d && t2h1d7 < t2w1rwt && t2h1d7 < t2w1lwt && t2h1d7 < t2h1uwt && t2h1d7 < t2h1dwt
  && t2h1d7 < t2w1r1 && t2h1d7 < t2w1l1 && t2h1d7 < t2h1u1 && t2h1d7 < t2h1d1 && t2h1d7 < t2w1rwt1 && t2h1d7 < t2w1lwt1 && t2h1d7 < t2h1uwt1 && t2h1d7 < t2h1dwt1
  && t2h1d7 < t2w1r2 && t2h1d7 < t2w1l2 && t2h1d7 < t2h1u2 && t2h1d7 < t2h1d2 && t2h1d7 < t2w1rwt2 && t2h1d7 < t2w1lwt2 && t2h1d7 < t2h1uwt2 && t2h1d7 < t2h1dwt2
  && t2h1d7 < t2w1r3 && t2h1d7 < t2w1l3 && t2h1d7 < t2h1u3 && t2h1d7 < t2h1d3 && t2h1d7 < t2w1rwt3 && t2h1d7 < t2w1lwt3 && t2h1d7 < t2h1uwt3 && t2h1d7 < t2h1dwt3
  && t2h1d7 < t2w1r4 && t2h1d7 < t2w1l4 && t2h1d7 < t2h1u4 && t2h1d7 < t2h1d4 && t2h1d7 < t2w1rwt4 && t2h1d7 < t2w1lwt4 && t2h1d7 < t2h1uwt4 && t2h1d7 < t2h1dwt4
  && t2h1d7 < t2w1r5 && t2h1d7 < t2w1l5 && t2h1d7 < t2h1u5 && t2h1d7 < t2h1d5 && t2h1d7 < t2w1rwt5 && t2h1d7 < t2w1lwt5 && t2h1d7 < t2h1uwt5 && t2h1d7 < t2h1dwt5
  && t2h1d7 < t2w1r6 && t2h1d7 < t2w1l6 && t2h1d7 < t2h1u6 && t2h1d7 < t2h1d6 && t2h1d7 < t2w1rwt6 && t2h1d7 < t2w1lwt6 && t2h1d7 < t2h1uwt6 && t2h1d7 < t2h1dwt6
  && t2h1d7 < t2w1r7 && t2h1d7 < t2w1l7 && t2h1d7 < t2h1u7 && t2h1d7 < t2w1rwt7 && t2h1d7 < t2w1lwt7 && t2h1d7 < t2h1uwt7 && t2h1d7 < t2h1dwt7
  && t2h1d7 < t2w1r8 && t2h1d7 < t2w1l8 && t2h1d7 < t2h1u8 && t2h1d7 < t2h1d8 && t2h1d7 < t2w1rwt8 && t2h1d7 < t2w1lwt8 && t2h1d7 < t2h1uwt8 && t2h1d7 < t2h1dwt8
  && t2h1d7 < t2w1r9 && t2h1d7 < t2w1l9 && t2h1d7 < t2h1u9 && t2h1d7 < t2h1d9 && t2h1d7 < t2w1rwt9 && t2h1d7 < t2w1lwt9 && t2h1d7 < t2h1uwt9 && t2h1d7 < t2h1dwt9
  && t2h1d7 < t2w1r10 && t2h1d7 < t2w1l10 && t2h1d7 < t2h1u10 && t2h1d7 < t2h1d10 && t2h1d7 < t2w1rwt10 && t2h1d7 < t2w1lwt10 && t2h1d7 < t2h1uwt10 && t2h1d7 < t2h1dwt10
  && ((louthd7 !=0 && linhd7==0) || (louthd7 ==0 && linhd7!=0))){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1d7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1d7+z))*(z0wr7+(vz*t2h1d7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1d7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1d7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1d7+z))*(z0wl7+(vz*t2h1d7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1d7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1d7+x;
  ylimitd=-sqrt(pbhd7-(vz*t2h1d7+z)/pahd7);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd7>0 ){
  i=292;
  }else{
  i=301;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd7!=-1 && t2h1d7 > 0 && t2h1d7 < t1 
  && t2h1d7 < t2w1r && t2h1d7 < t2w1l && t2h1d7 < t2h1u && t2h1d7 < t2h1d && t2h1d7 < t2w1rwt && t2h1d7 < t2w1lwt && t2h1d7 < t2h1uwt && t2h1d7 < t2h1dwt
  && t2h1d7 < t2w1r1 && t2h1d7 < t2w1l1 && t2h1d7 < t2h1u1 && t2h1d7 < t2h1d1 && t2h1d7 < t2w1rwt1 && t2h1d7 < t2w1lwt1 && t2h1d7 < t2h1uwt1 && t2h1d7 < t2h1dwt1
  && t2h1d7 < t2w1r2 && t2h1d7 < t2w1l2 && t2h1d7 < t2h1u2 && t2h1d7 < t2h1d2 && t2h1d7 < t2w1rwt2 && t2h1d7 < t2w1lwt2 && t2h1d7 < t2h1uwt2 && t2h1d7 < t2h1dwt2
  && t2h1d7 < t2w1r3 && t2h1d7 < t2w1l3 && t2h1d7 < t2h1u3 && t2h1d7 < t2h1d3 && t2h1d7 < t2w1rwt3 && t2h1d7 < t2w1lwt3 && t2h1d7 < t2h1uwt3 && t2h1d7 < t2h1dwt3
  && t2h1d7 < t2w1r4 && t2h1d7 < t2w1l4 && t2h1d7 < t2h1u4 && t2h1d7 < t2h1d4 && t2h1d7 < t2w1rwt4 && t2h1d7 < t2w1lwt4 && t2h1d7 < t2h1uwt4 && t2h1d7 < t2h1dwt4
  && t2h1d7 < t2w1r5 && t2h1d7 < t2w1l5 && t2h1d7 < t2h1u5 && t2h1d7 < t2h1d5 && t2h1d7 < t2w1rwt5 && t2h1d7 < t2w1lwt5 && t2h1d7 < t2h1uwt5 && t2h1d7 < t2h1dwt5
  && t2h1d7 < t2w1r6 && t2h1d7 < t2w1l6 && t2h1d7 < t2h1u6 && t2h1d7 < t2h1d6 && t2h1d7 < t2w1rwt6 && t2h1d7 < t2w1lwt6 && t2h1d7 < t2h1uwt6 && t2h1d7 < t2h1dwt6
  && t2h1d7 < t2w1r7 && t2h1d7 < t2w1l7 && t2h1d7 < t2h1u7 && t2h1d7 < t2w1rwt7 && t2h1d7 < t2w1lwt7 && t2h1d7 < t2h1uwt7 && t2h1d7 < t2h1dwt7
  && t2h1d7 < t2w1r8 && t2h1d7 < t2w1l8 && t2h1d7 < t2h1u8 && t2h1d7 < t2h1d8 && t2h1d7 < t2w1rwt8 && t2h1d7 < t2w1lwt8 && t2h1d7 < t2h1uwt8 && t2h1d7 < t2h1dwt8
  && t2h1d7 < t2w1r9 && t2h1d7 < t2w1l9 && t2h1d7 < t2h1u9 && t2h1d7 < t2h1d9 && t2h1d7 < t2w1rwt9 && t2h1d7 < t2w1lwt9 && t2h1d7 < t2h1uwt9 && t2h1d7 < t2h1dwt9
  && t2h1d7 < t2w1r10 && t2h1d7 < t2w1l10 && t2h1d7 < t2h1u10 && t2h1d7 < t2h1d10 && t2h1d7 < t2w1rwt10 && t2h1d7 < t2w1lwt10 && t2h1d7 < t2h1uwt10 && t2h1d7 < t2h1dwt10
  && (louthd7 == 0 && linhd7 == 0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1d7+z)-w1r7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwr7*sqrt(1-((z0wr7+(vz*t2h1d7+z))*(z0wr7+(vz*t2h1d7+z)))/a2wr7);
    }else{
    xlimitr=-sqrt(((vz*t2h1d7+z)-pbwr7)/-pawr7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1d7+z)+w1l7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwl7*sqrt(1-((z0wl7+(vz*t2h1d7+z))*(z0wl7+(vz*t2h1d7+z)))/a2wl7);
      }else{
      xlimitl=sqrt(((vz*t2h1d7+z)-pbwl7)/-pawl7);
      }
   }
  xtest=vx*t2h1d7+x;
  ylimitd=(-h2d7+h1d7)*(vz*t2h1d7+z)/l-h1d7;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd7>0 ){
  i=293;
  }else{
  i=301;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr7==-1 && t2w1r7 > 0 && t2w1r7 < t1 
     && t2w1r7 < t2w1r && t2w1r7 < t2w1l && t2w1r7 < t2h1u && t2w1r7 < t2h1d && t2w1r7 < t2w1rwt && t2w1r7 < t2w1lwt && t2w1r7 < t2h1uwt && t2w1r7 < t2h1dwt
     && t2w1r7 < t2w1r1 && t2w1r7 < t2w1l1 && t2w1r7 < t2h1u1 && t2w1r7 < t2h1d1 && t2w1r7 < t2w1rwt1 && t2w1r7 < t2w1lwt1 && t2w1r7 < t2h1uwt1 && t2w1r7 < t2h1dwt1
     && t2w1r7 < t2w1r2 && t2w1r7 < t2w1l2 && t2w1r7 < t2h1u2 && t2w1r7 < t2h1d2 && t2w1r7 < t2w1rwt2 && t2w1r7 < t2w1lwt2 && t2w1r7 < t2h1uwt2 && t2w1r7 < t2h1dwt2 
     && t2w1r7 < t2w1r3 && t2w1r7 < t2w1l3 && t2w1r7 < t2h1u3 && t2w1r7 < t2h1d3 && t2w1r7 < t2w1rwt3 && t2w1r7 < t2w1lwt3 && t2w1r7 < t2h1uwt3 && t2w1r7 < t2h1dwt3
     && t2w1r7 < t2w1r4 && t2w1r7 < t2w1l4 && t2w1r7 < t2h1u4 && t2w1r7 < t2h1d4 && t2w1r7 < t2w1rwt4 && t2w1r7 < t2w1lwt4 && t2w1r7 < t2h1uwt4 && t2w1r7 < t2h1dwt4
     && t2w1r7 < t2w1r5 && t2w1r7 < t2w1l5 && t2w1r7 < t2h1u5 && t2w1r7 < t2h1d5 && t2w1r7 < t2w1rwt5 && t2w1r7 < t2w1lwt5 && t2w1r7 < t2h1uwt5 && t2w1r7 < t2h1dwt5
     && t2w1r7 < t2w1r6 && t2w1r7 < t2w1l6 && t2w1r7 < t2h1u6 && t2w1r7 < t2h1d6 && t2w1r7 < t2w1rwt6 && t2w1r7 < t2w1lwt6 && t2w1r7 < t2h1uwt6 && t2w1r7 < t2h1dwt6
     && t2w1r7 < t2w1l7 && t2w1r7 < t2h1u7 && t2w1r7 < t2h1d7 && t2w1r7 < t2w1rwt7 && t2w1r7 < t2w1lwt7 && t2w1r7 < t2h1uwt7 && t2w1r7 < t2h1dwt7
     && t2w1r7 < t2w1r8 && t2w1r7 < t2w1l8 && t2w1r7 < t2h1u8 && t2w1r7 < t2h1d8 && t2w1r7 < t2w1rwt8 && t2w1r7 < t2w1lwt8 && t2w1r7 < t2h1uwt8 && t2w1r7 < t2h1dwt8
     && t2w1r7 < t2w1r9 && t2w1r7 < t2w1l9 && t2w1r7 < t2h1u9 && t2w1r7 < t2h1d9 && t2w1r7 < t2w1rwt9 && t2w1r7 < t2w1lwt9 && t2w1r7 < t2h1uwt9 && t2w1r7 < t2h1dwt9
     && t2w1r7 < t2w1r10 && t2w1r7 < t2w1l10 && t2w1r7 < t2h1u10 && t2w1r7 < t2h1d10 && t2w1r7 < t2w1rwt10 && t2w1r7 < t2w1lwt10 && t2w1r7 < t2h1uwt10 && t2w1r7 < t2h1dwt10
     && ((linwr7!=0) && (loutwr7!=0) )) {
  i=294;
  }

  if (mxr7==-1 && t2w1r7 > 0 && t2w1r7 < t1 
     && t2w1r7 < t2w1r && t2w1r7 < t2w1l && t2w1r7 < t2h1u && t2w1r7 < t2h1d && t2w1r7 < t2w1rwt && t2w1r7 < t2w1lwt && t2w1r7 < t2h1uwt && t2w1r7 < t2h1dwt
     && t2w1r7 < t2w1r1 && t2w1r7 < t2w1l1 && t2w1r7 < t2h1u1 && t2w1r7 < t2h1d1 && t2w1r7 < t2w1rwt1 && t2w1r7 < t2w1lwt1 && t2w1r7 < t2h1uwt1 && t2w1r7 < t2h1dwt1
     && t2w1r7 < t2w1r2 && t2w1r7 < t2w1l2 && t2w1r7 < t2h1u2 && t2w1r7 < t2h1d2 && t2w1r7 < t2w1rwt2 && t2w1r7 < t2w1lwt2 && t2w1r7 < t2h1uwt2 && t2w1r7 < t2h1dwt2 
     && t2w1r7 < t2w1r3 && t2w1r7 < t2w1l3 && t2w1r7 < t2h1u3 && t2w1r7 < t2h1d3 && t2w1r7 < t2w1rwt3 && t2w1r7 < t2w1lwt3 && t2w1r7 < t2h1uwt3 && t2w1r7 < t2h1dwt3
     && t2w1r7 < t2w1r4 && t2w1r7 < t2w1l4 && t2w1r7 < t2h1u4 && t2w1r7 < t2h1d4 && t2w1r7 < t2w1rwt4 && t2w1r7 < t2w1lwt4 && t2w1r7 < t2h1uwt4 && t2w1r7 < t2h1dwt4
     && t2w1r7 < t2w1r5 && t2w1r7 < t2w1l5 && t2w1r7 < t2h1u5 && t2w1r7 < t2h1d5 && t2w1r7 < t2w1rwt5 && t2w1r7 < t2w1lwt5 && t2w1r7 < t2h1uwt5 && t2w1r7 < t2h1dwt5
     && t2w1r7 < t2w1r6 && t2w1r7 < t2w1l6 && t2w1r7 < t2h1u6 && t2w1r7 < t2h1d6 && t2w1r7 < t2w1rwt6 && t2w1r7 < t2w1lwt6 && t2w1r7 < t2h1uwt6 && t2w1r7 < t2h1dwt6
     && t2w1r7 < t2w1l7 && t2w1r7 < t2h1u7 && t2w1r7 < t2h1d7 && t2w1r7 < t2w1rwt7 && t2w1r7 < t2w1lwt7 && t2w1r7 < t2h1uwt7 && t2w1r7 < t2h1dwt7
     && t2w1r7 < t2w1r8 && t2w1r7 < t2w1l8 && t2w1r7 < t2h1u8 && t2w1r7 < t2h1d8 && t2w1r7 < t2w1rwt8 && t2w1r7 < t2w1lwt8 && t2w1r7 < t2h1uwt8 && t2w1r7 < t2h1dwt8
     && t2w1r7 < t2w1r9 && t2w1r7 < t2w1l9 && t2w1r7 < t2h1u9 && t2w1r7 < t2h1d9 && t2w1r7 < t2w1rwt9 && t2w1r7 < t2w1lwt9 && t2w1r7 < t2h1uwt9 && t2w1r7 < t2h1dwt9
     && t2w1r7 < t2w1r10 && t2w1r7 < t2w1l10 && t2w1r7 < t2h1u10 && t2w1r7 < t2h1d10 && t2w1r7 < t2w1rwt10 && t2w1r7 < t2w1lwt10 && t2w1r7 < t2h1uwt10 && t2w1r7 < t2h1dwt10
     && ((loutwr7!=0 && linwr7==0) || (loutwr7==0 && linwr7!=0))){
  i=294;
  }

  if (mxr7==-1 && t2w1r7 > 0 && t2w1r7 < t1 
     && t2w1r7 < t2w1r && t2w1r7 < t2w1l && t2w1r7 < t2h1u && t2w1r7 < t2h1d && t2w1r7 < t2w1rwt && t2w1r7 < t2w1lwt && t2w1r7 < t2h1uwt && t2w1r7 < t2h1dwt
     && t2w1r7 < t2w1r1 && t2w1r7 < t2w1l1 && t2w1r7 < t2h1u1 && t2w1r7 < t2h1d1 && t2w1r7 < t2w1rwt1 && t2w1r7 < t2w1lwt1 && t2w1r7 < t2h1uwt1 && t2w1r7 < t2h1dwt1
     && t2w1r7 < t2w1r2 && t2w1r7 < t2w1l2 && t2w1r7 < t2h1u2 && t2w1r7 < t2h1d2 && t2w1r7 < t2w1rwt2 && t2w1r7 < t2w1lwt2 && t2w1r7 < t2h1uwt2 && t2w1r7 < t2h1dwt2 
     && t2w1r7 < t2w1r3 && t2w1r7 < t2w1l3 && t2w1r7 < t2h1u3 && t2w1r7 < t2h1d3 && t2w1r7 < t2w1rwt3 && t2w1r7 < t2w1lwt3 && t2w1r7 < t2h1uwt3 && t2w1r7 < t2h1dwt3
     && t2w1r7 < t2w1r4 && t2w1r7 < t2w1l4 && t2w1r7 < t2h1u4 && t2w1r7 < t2h1d4 && t2w1r7 < t2w1rwt4 && t2w1r7 < t2w1lwt4 && t2w1r7 < t2h1uwt4 && t2w1r7 < t2h1dwt4
     && t2w1r7 < t2w1r5 && t2w1r7 < t2w1l5 && t2w1r7 < t2h1u5 && t2w1r7 < t2h1d5 && t2w1r7 < t2w1rwt5 && t2w1r7 < t2w1lwt5 && t2w1r7 < t2h1uwt5 && t2w1r7 < t2h1dwt5
     && t2w1r7 < t2w1r6 && t2w1r7 < t2w1l6 && t2w1r7 < t2h1u6 && t2w1r7 < t2h1d6 && t2w1r7 < t2w1rwt6 && t2w1r7 < t2w1lwt6 && t2w1r7 < t2h1uwt6 && t2w1r7 < t2h1dwt6
     && t2w1r7 < t2w1l7 && t2w1r7 < t2h1u7 && t2w1r7 < t2h1d7 && t2w1r7 < t2w1rwt7 && t2w1r7 < t2w1lwt7 && t2w1r7 < t2h1uwt7 && t2w1r7 < t2h1dwt7
     && t2w1r7 < t2w1r8 && t2w1r7 < t2w1l8 && t2w1r7 < t2h1u8 && t2w1r7 < t2h1d8 && t2w1r7 < t2w1rwt8 && t2w1r7 < t2w1lwt8 && t2w1r7 < t2h1uwt8 && t2w1r7 < t2h1dwt8
     && t2w1r7 < t2w1r9 && t2w1r7 < t2w1l9 && t2w1r7 < t2h1u9 && t2w1r7 < t2h1d9 && t2w1r7 < t2w1rwt9 && t2w1r7 < t2w1lwt9 && t2w1r7 < t2h1uwt9 && t2w1r7 < t2h1dwt9
     && t2w1r7 < t2w1r10 && t2w1r7 < t2w1l10 && t2w1r7 < t2h1u10 && t2w1r7 < t2h1d10 && t2w1r7 < t2w1rwt10 && t2w1r7 < t2w1lwt10 && t2w1r7 < t2h1uwt10 && t2w1r7 < t2h1dwt10
     && (loutwr7==0 && linwr7==0)){
  i=294;
  }

  if (mxl7==-1 && t2w1l7 > 0 && t2w1l7 < t1 
      && t2w1l7 < t2w1r && t2w1l7 < t2w1l && t2w1l7 < t2h1u && t2w1l7 < t2h1d && t2w1l7 < t2w1rwt && t2w1l7 < t2w1lwt && t2w1l7 < t2h1uwt && t2w1l7 < t2h1dwt
      && t2w1l7 < t2w1r1 && t2w1l7 < t2w1l1 && t2w1l7 < t2h1u1 && t2w1l7 < t2h1d1 && t2w1l7 < t2w1rwt1 && t2w1l7 < t2w1lwt1 && t2w1l7 < t2h1uwt1 && t2w1l7 < t2h1dwt1
      && t2w1l7 < t2w1r2 && t2w1l7 < t2w1l2 && t2w1l7 < t2h1u2 && t2w1l7 < t2h1d2 && t2w1l7 < t2w1rwt2 && t2w1l7 < t2w1lwt2 && t2w1l7 < t2h1uwt2 && t2w1l7 < t2h1dwt2
      && t2w1l7 < t2w1r3 && t2w1l7 < t2w1l3 && t2w1l7 < t2h1u3 && t2w1l7 < t2h1d3 && t2w1l7 < t2w1rwt3 && t2w1l7 < t2w1lwt3 && t2w1l7 < t2h1uwt3 && t2w1l7 < t2h1dwt3
      && t2w1l7 < t2w1r4 && t2w1l7 < t2w1l4 && t2w1l7 < t2h1u4 && t2w1l7 < t2h1d4 && t2w1l7 < t2w1rwt4 && t2w1l7 < t2w1lwt4 && t2w1l7 < t2h1uwt4 && t2w1l7 < t2h1dwt4
      && t2w1l7 < t2w1r5 && t2w1l7 < t2w1l5 && t2w1l7 < t2h1u5 && t2w1l7 < t2h1d5 && t2w1l7 < t2w1rwt5 && t2w1l7 < t2w1lwt5 && t2w1l7 < t2h1uwt5 && t2w1l7 < t2h1dwt5
      && t2w1l7 < t2w1r6 && t2w1l7 < t2w1l6 && t2w1l7 < t2h1u6 && t2w1l7 < t2h1d6 && t2w1l7 < t2w1rwt6 && t2w1l7 < t2w1lwt6 && t2w1l7 < t2h1uwt6 && t2w1l7 < t2h1dwt6
      && t2w1l7 < t2w1r7 && t2w1l7 < t2h1u7 && t2w1l7 < t2h1d7 && t2w1l7 < t2w1rwt7 && t2w1l7 < t2w1lwt7 && t2w1l7 < t2h1uwt7 && t2w1l7 < t2h1dwt7
      && t2w1l7 < t2w1r8 && t2w1l7 < t2w1l8 && t2w1l7 < t2h1u8 && t2w1l7 < t2h1d8 && t2w1l7 < t2w1rwt8 && t2w1l7 < t2w1lwt8 && t2w1l7 < t2h1uwt8 && t2w1l7 < t2h1dwt8
      && t2w1l7 < t2w1r9 && t2w1l7 < t2w1l9 && t2w1l7 < t2h1u9 && t2w1l7 < t2h1d9 && t2w1l7 < t2w1rwt9 && t2w1l7 < t2w1lwt9 && t2w1l7 < t2h1uwt9 && t2w1l7 < t2h1dwt9
      && t2w1l7 < t2w1r10 && t2w1l7 < t2w1l10 && t2w1l7 < t2h1u10 && t2w1l7 < t2h1d10 && t2w1l7 < t2w1rwt10 && t2w1l7 < t2w1lwt10 && t2w1l7 < t2h1uwt10 && t2w1l7 < t2h1dwt10
      && ((linwl7!=0) && (loutwl7!=0) )){
  i=295;
  }

  if (mxl7==-1 && t2w1l7 > 0 && t2w1l7 < t1 
      && t2w1l7 < t2w1r && t2w1l7 < t2w1l && t2w1l7 < t2h1u && t2w1l7 < t2h1d && t2w1l7 < t2w1rwt && t2w1l7 < t2w1lwt && t2w1l7 < t2h1uwt && t2w1l7 < t2h1dwt
      && t2w1l7 < t2w1r1 && t2w1l7 < t2w1l1 && t2w1l7 < t2h1u1 && t2w1l7 < t2h1d1 && t2w1l7 < t2w1rwt1 && t2w1l7 < t2w1lwt1 && t2w1l7 < t2h1uwt1 && t2w1l7 < t2h1dwt1
      && t2w1l7 < t2w1r2 && t2w1l7 < t2w1l2 && t2w1l7 < t2h1u2 && t2w1l7 < t2h1d2 && t2w1l7 < t2w1rwt2 && t2w1l7 < t2w1lwt2 && t2w1l7 < t2h1uwt2 && t2w1l7 < t2h1dwt2
      && t2w1l7 < t2w1r3 && t2w1l7 < t2w1l3 && t2w1l7 < t2h1u3 && t2w1l7 < t2h1d3 && t2w1l7 < t2w1rwt3 && t2w1l7 < t2w1lwt3 && t2w1l7 < t2h1uwt3 && t2w1l7 < t2h1dwt3
      && t2w1l7 < t2w1r4 && t2w1l7 < t2w1l4 && t2w1l7 < t2h1u4 && t2w1l7 < t2h1d4 && t2w1l7 < t2w1rwt4 && t2w1l7 < t2w1lwt4 && t2w1l7 < t2h1uwt4 && t2w1l7 < t2h1dwt4
      && t2w1l7 < t2w1r5 && t2w1l7 < t2w1l5 && t2w1l7 < t2h1u5 && t2w1l7 < t2h1d5 && t2w1l7 < t2w1rwt5 && t2w1l7 < t2w1lwt5 && t2w1l7 < t2h1uwt5 && t2w1l7 < t2h1dwt5
      && t2w1l7 < t2w1r6 && t2w1l7 < t2w1l6 && t2w1l7 < t2h1u6 && t2w1l7 < t2h1d6 && t2w1l7 < t2w1rwt6 && t2w1l7 < t2w1lwt6 && t2w1l7 < t2h1uwt6 && t2w1l7 < t2h1dwt6
      && t2w1l7 < t2w1r7 && t2w1l7 < t2h1u7 && t2w1l7 < t2h1d7 && t2w1l7 < t2w1rwt7 && t2w1l7 < t2w1lwt7 && t2w1l7 < t2h1uwt7 && t2w1l7 < t2h1dwt7
      && t2w1l7 < t2w1r8 && t2w1l7 < t2w1l8 && t2w1l7 < t2h1u8 && t2w1l7 < t2h1d8 && t2w1l7 < t2w1rwt8 && t2w1l7 < t2w1lwt8 && t2w1l7 < t2h1uwt8 && t2w1l7 < t2h1dwt8
      && t2w1l7 < t2w1r9 && t2w1l7 < t2w1l9 && t2w1l7 < t2h1u9 && t2w1l7 < t2h1d9 && t2w1l7 < t2w1rwt9 && t2w1l7 < t2w1lwt9 && t2w1l7 < t2h1uwt9 && t2w1l7 < t2h1dwt9
      && t2w1l7 < t2w1r10 && t2w1l7 < t2w1l10 && t2w1l7 < t2h1u10 && t2w1l7 < t2h1d10 && t2w1l7 < t2w1rwt10 && t2w1l7 < t2w1lwt10 && t2w1l7 < t2h1uwt10 && t2w1l7 < t2h1dwt10
      &&  ((loutwl7!=0 && linwl7==0) || (loutwl7==0 && linwl7!=0))){
  i=295;
  }

  if (mxl7==-1 && t2w1l7 > 0 && t2w1l7 < t1 
      && t2w1l7 < t2w1r && t2w1l7 < t2w1l && t2w1l7 < t2h1u && t2w1l7 < t2h1d && t2w1l7 < t2w1rwt && t2w1l7 < t2w1lwt && t2w1l7 < t2h1uwt && t2w1l7 < t2h1dwt
      && t2w1l7 < t2w1r1 && t2w1l7 < t2w1l1 && t2w1l7 < t2h1u1 && t2w1l7 < t2h1d1 && t2w1l7 < t2w1rwt1 && t2w1l7 < t2w1lwt1 && t2w1l7 < t2h1uwt1 && t2w1l7 < t2h1dwt1
      && t2w1l7 < t2w1r2 && t2w1l7 < t2w1l2 && t2w1l7 < t2h1u2 && t2w1l7 < t2h1d2 && t2w1l7 < t2w1rwt2 && t2w1l7 < t2w1lwt2 && t2w1l7 < t2h1uwt2 && t2w1l7 < t2h1dwt2
      && t2w1l7 < t2w1r3 && t2w1l7 < t2w1l3 && t2w1l7 < t2h1u3 && t2w1l7 < t2h1d3 && t2w1l7 < t2w1rwt3 && t2w1l7 < t2w1lwt3 && t2w1l7 < t2h1uwt3 && t2w1l7 < t2h1dwt3
      && t2w1l7 < t2w1r4 && t2w1l7 < t2w1l4 && t2w1l7 < t2h1u4 && t2w1l7 < t2h1d4 && t2w1l7 < t2w1rwt4 && t2w1l7 < t2w1lwt4 && t2w1l7 < t2h1uwt4 && t2w1l7 < t2h1dwt4
      && t2w1l7 < t2w1r5 && t2w1l7 < t2w1l5 && t2w1l7 < t2h1u5 && t2w1l7 < t2h1d5 && t2w1l7 < t2w1rwt5 && t2w1l7 < t2w1lwt5 && t2w1l7 < t2h1uwt5 && t2w1l7 < t2h1dwt5
      && t2w1l7 < t2w1r6 && t2w1l7 < t2w1l6 && t2w1l7 < t2h1u6 && t2w1l7 < t2h1d6 && t2w1l7 < t2w1rwt6 && t2w1l7 < t2w1lwt6 && t2w1l7 < t2h1uwt6 && t2w1l7 < t2h1dwt6
      && t2w1l7 < t2w1r7 && t2w1l7 < t2h1u7 && t2w1l7 < t2h1d7 && t2w1l7 < t2w1rwt7 && t2w1l7 < t2w1lwt7 && t2w1l7 < t2h1uwt7 && t2w1l7 < t2h1dwt7
      && t2w1l7 < t2w1r8 && t2w1l7 < t2w1l8 && t2w1l7 < t2h1u8 && t2w1l7 < t2h1d8 && t2w1l7 < t2w1rwt8 && t2w1l7 < t2w1lwt8 && t2w1l7 < t2h1uwt8 && t2w1l7 < t2h1dwt8
      && t2w1l7 < t2w1r9 && t2w1l7 < t2w1l9 && t2w1l7 < t2h1u9 && t2w1l7 < t2h1d9 && t2w1l7 < t2w1rwt9 && t2w1l7 < t2w1lwt9 && t2w1l7 < t2h1uwt9 && t2w1l7 < t2h1dwt9
      && t2w1l7 < t2w1r10 && t2w1l7 < t2w1l10 && t2w1l7 < t2h1u10 && t2w1l7 < t2h1d10 && t2w1l7 < t2w1rwt10 && t2w1l7 < t2w1lwt10 && t2w1l7 < t2h1uwt10 && t2w1l7 < t2h1dwt10
      && (loutwl7==0 && linwl7==0)){
  i=295;
  }

  if (myu7==-1 && t2h1u7 > 0 && t2h1u7 < t1 
  && t2h1u7 < t2w1r && t2h1u7 < t2w1l && t2h1u7 < t2h1u && t2h1u7 < t2h1d && t2h1u7 < t2w1rwt && t2h1u7 < t2w1lwt && t2h1u7 < t2h1uwt && t2h1u7 < t2h1dwt
  && t2h1u7 < t2w1r1 && t2h1u7 < t2w1l1 && t2h1u7 < t2h1u1 && t2h1u7 < t2h1d1 && t2h1u7 < t2w1rwt1 && t2h1u7 < t2w1lwt1 && t2h1u7 < t2h1uwt1 && t2h1u7 < t2h1dwt1
  && t2h1u7 < t2w1r2 && t2h1u7 < t2w1l2 && t2h1u7 < t2h1u2 && t2h1u7 < t2h1d2 && t2h1u7 < t2w1rwt2 && t2h1u7 < t2w1lwt2 && t2h1u7 < t2h1uwt2 && t2h1u7 < t2h1dwt2
  && t2h1u7 < t2w1r3 && t2h1u7 < t2w1l3 && t2h1u7 < t2h1u3 && t2h1u7 < t2h1d3 && t2h1u7 < t2w1rwt3 && t2h1u7 < t2w1lwt3 && t2h1u7 < t2h1uwt3 && t2h1u7 < t2h1dwt3
  && t2h1u7 < t2w1r4 && t2h1u7 < t2w1l4 && t2h1u7 < t2h1u4 && t2h1u7 < t2h1d4 && t2h1u7 < t2w1rwt4 && t2h1u7 < t2w1lwt4 && t2h1u7 < t2h1uwt4 && t2h1u7 < t2h1dwt4
  && t2h1u7 < t2w1r5 && t2h1u7 < t2w1l5 && t2h1u7 < t2h1u5 && t2h1u7 < t2h1d5 && t2h1u7 < t2w1rwt5 && t2h1u7 < t2w1lwt5 && t2h1u7 < t2h1uwt5 && t2h1u7 < t2h1dwt5
  && t2h1u7 < t2w1r6 && t2h1u7 < t2w1l6 && t2h1u7 < t2h1u6 && t2h1u7 < t2h1d6 && t2h1u7 < t2w1rwt6 && t2h1u7 < t2w1lwt6 && t2h1u7 < t2h1uwt6 && t2h1u7 < t2h1dwt6
  && t2h1u7 < t2w1r7 && t2h1u7 < t2w1l7 && t2h1u7 < t2h1d7 && t2h1u7 < t2w1rwt7 && t2h1u7 < t2w1lwt7 && t2h1u7 < t2h1uwt7 && t2h1u7 < t2h1dwt7
  && t2h1u7 < t2w1r8 && t2h1u7 < t2w1l8 && t2h1u7 < t2h1u8 && t2h1u7 < t2h1d8 && t2h1u7 < t2w1rwt8 && t2h1u7 < t2w1lwt8 && t2h1u7 < t2h1uwt8 && t2h1u7 < t2h1dwt8
  && t2h1u7 < t2w1r9 && t2h1u7 < t2w1l9 && t2h1u7 < t2h1u9 && t2h1u7 < t2h1d9 && t2h1u7 < t2w1rwt9 && t2h1u7 < t2w1lwt9 && t2h1u7 < t2h1uwt9 && t2h1u7 < t2h1dwt9
  && t2h1u7 < t2w1r10 && t2h1u7 < t2w1l10 && t2h1u7 < t2h1u10 && t2h1u7 < t2h1d10 && t2h1u7 < t2w1rwt10 && t2h1u7 < t2w1lwt10 && t2h1u7 < t2h1uwt10 && t2h1u7 < t2h1dwt10
  && (louthu7 !=0 && linhu7!=0)){
  i=296;
  }

  if (myu7==-1 && t2h1u7 > 0 && t2h1u7 < t1 
  && t2h1u7 < t2w1r && t2h1u7 < t2w1l && t2h1u7 < t2h1u && t2h1u7 < t2h1d && t2h1u7 < t2w1rwt && t2h1u7 < t2w1lwt && t2h1u7 < t2h1uwt && t2h1u7 < t2h1dwt
  && t2h1u7 < t2w1r1 && t2h1u7 < t2w1l1 && t2h1u7 < t2h1u1 && t2h1u7 < t2h1d1 && t2h1u7 < t2w1rwt1 && t2h1u7 < t2w1lwt1 && t2h1u7 < t2h1uwt1 && t2h1u7 < t2h1dwt1
  && t2h1u7 < t2w1r2 && t2h1u7 < t2w1l2 && t2h1u7 < t2h1u2 && t2h1u7 < t2h1d2 && t2h1u7 < t2w1rwt2 && t2h1u7 < t2w1lwt2 && t2h1u7 < t2h1uwt2 && t2h1u7 < t2h1dwt2
  && t2h1u7 < t2w1r3 && t2h1u7 < t2w1l3 && t2h1u7 < t2h1u3 && t2h1u7 < t2h1d3 && t2h1u7 < t2w1rwt3 && t2h1u7 < t2w1lwt3 && t2h1u7 < t2h1uwt3 && t2h1u7 < t2h1dwt3
  && t2h1u7 < t2w1r4 && t2h1u7 < t2w1l4 && t2h1u7 < t2h1u4 && t2h1u7 < t2h1d4 && t2h1u7 < t2w1rwt4 && t2h1u7 < t2w1lwt4 && t2h1u7 < t2h1uwt4 && t2h1u7 < t2h1dwt4
  && t2h1u7 < t2w1r5 && t2h1u7 < t2w1l5 && t2h1u7 < t2h1u5 && t2h1u7 < t2h1d5 && t2h1u7 < t2w1rwt5 && t2h1u7 < t2w1lwt5 && t2h1u7 < t2h1uwt5 && t2h1u7 < t2h1dwt5
  && t2h1u7 < t2w1r6 && t2h1u7 < t2w1l6 && t2h1u7 < t2h1u6 && t2h1u7 < t2h1d6 && t2h1u7 < t2w1rwt6 && t2h1u7 < t2w1lwt6 && t2h1u7 < t2h1uwt6 && t2h1u7 < t2h1dwt6
  && t2h1u7 < t2w1r7 && t2h1u7 < t2w1l7 && t2h1u7 < t2h1d7 && t2h1u7 < t2w1rwt7 && t2h1u7 < t2w1lwt7 && t2h1u7 < t2h1uwt7 && t2h1u7 < t2h1dwt7
  && t2h1u7 < t2w1r8 && t2h1u7 < t2w1l8 && t2h1u7 < t2h1u8 && t2h1u7 < t2h1d8 && t2h1u7 < t2w1rwt8 && t2h1u7 < t2w1lwt8 && t2h1u7 < t2h1uwt8 && t2h1u7 < t2h1dwt8
  && t2h1u7 < t2w1r9 && t2h1u7 < t2w1l9 && t2h1u7 < t2h1u9 && t2h1u7 < t2h1d9 && t2h1u7 < t2w1rwt9 && t2h1u7 < t2w1lwt9 && t2h1u7 < t2h1uwt9 && t2h1u7 < t2h1dwt9
  && t2h1u7 < t2w1r10 && t2h1u7 < t2w1l10 && t2h1u7 < t2h1u10 && t2h1u7 < t2h1d10 && t2h1u7 < t2w1rwt10 && t2h1u7 < t2w1lwt10 && t2h1u7 < t2h1uwt10 && t2h1u7 < t2h1dwt10
  && ((louthu7!=0 && linhu7==0) || (louthu7==0 && linhu7!=0))){
  i=296;
  }

  if (myu7==-1 && t2h1u7 > 0 && t2h1u7 < t1 
  && t2h1u7 < t2w1r && t2h1u7 < t2w1l && t2h1u7 < t2h1u && t2h1u7 < t2h1d && t2h1u7 < t2w1rwt && t2h1u7 < t2w1lwt && t2h1u7 < t2h1uwt && t2h1u7 < t2h1dwt
  && t2h1u7 < t2w1r1 && t2h1u7 < t2w1l1 && t2h1u7 < t2h1u1 && t2h1u7 < t2h1d1 && t2h1u7 < t2w1rwt1 && t2h1u7 < t2w1lwt1 && t2h1u7 < t2h1uwt1 && t2h1u7 < t2h1dwt1
  && t2h1u7 < t2w1r2 && t2h1u7 < t2w1l2 && t2h1u7 < t2h1u2 && t2h1u7 < t2h1d2 && t2h1u7 < t2w1rwt2 && t2h1u7 < t2w1lwt2 && t2h1u7 < t2h1uwt2 && t2h1u7 < t2h1dwt2
  && t2h1u7 < t2w1r3 && t2h1u7 < t2w1l3 && t2h1u7 < t2h1u3 && t2h1u7 < t2h1d3 && t2h1u7 < t2w1rwt3 && t2h1u7 < t2w1lwt3 && t2h1u7 < t2h1uwt3 && t2h1u7 < t2h1dwt3
  && t2h1u7 < t2w1r4 && t2h1u7 < t2w1l4 && t2h1u7 < t2h1u4 && t2h1u7 < t2h1d4 && t2h1u7 < t2w1rwt4 && t2h1u7 < t2w1lwt4 && t2h1u7 < t2h1uwt4 && t2h1u7 < t2h1dwt4
  && t2h1u7 < t2w1r5 && t2h1u7 < t2w1l5 && t2h1u7 < t2h1u5 && t2h1u7 < t2h1d5 && t2h1u7 < t2w1rwt5 && t2h1u7 < t2w1lwt5 && t2h1u7 < t2h1uwt5 && t2h1u7 < t2h1dwt5
  && t2h1u7 < t2w1r6 && t2h1u7 < t2w1l6 && t2h1u7 < t2h1u6 && t2h1u7 < t2h1d6 && t2h1u7 < t2w1rwt6 && t2h1u7 < t2w1lwt6 && t2h1u7 < t2h1uwt6 && t2h1u7 < t2h1dwt6
  && t2h1u7 < t2w1r7 && t2h1u7 < t2w1l7 && t2h1u7 < t2h1d7 && t2h1u7 < t2w1rwt7 && t2h1u7 < t2w1lwt7 && t2h1u7 < t2h1uwt7 && t2h1u7 < t2h1dwt7
  && t2h1u7 < t2w1r8 && t2h1u7 < t2w1l8 && t2h1u7 < t2h1u8 && t2h1u7 < t2h1d8 && t2h1u7 < t2w1rwt8 && t2h1u7 < t2w1lwt8 && t2h1u7 < t2h1uwt8 && t2h1u7 < t2h1dwt8
  && t2h1u7 < t2w1r9 && t2h1u7 < t2w1l9 && t2h1u7 < t2h1u9 && t2h1u7 < t2h1d9 && t2h1u7 < t2w1rwt9 && t2h1u7 < t2w1lwt9 && t2h1u7 < t2h1uwt9 && t2h1u7 < t2h1dwt9
  && t2h1u7 < t2w1r10 && t2h1u7 < t2w1l10 && t2h1u7 < t2h1u10 && t2h1u7 < t2h1d10 && t2h1u7 < t2w1rwt10 && t2h1u7 < t2w1lwt10 && t2h1u7 < t2h1uwt10 && t2h1u7 < t2h1dwt10
  && (louthu7 == 0 && linhu7 == 0)){
  i=296;
  }

  if (myd7==-1 && t2h1d7 > 0 && t2h1d7 < t1 
  && t2h1d7 < t2w1r && t2h1d7 < t2w1l && t2h1d7 < t2h1u && t2h1d7 < t2h1d && t2h1d7 < t2w1rwt && t2h1d7 < t2w1lwt && t2h1d7 < t2h1uwt && t2h1d7 < t2h1dwt
  && t2h1d7 < t2w1r1 && t2h1d7 < t2w1l1 && t2h1d7 < t2h1u1 && t2h1d7 < t2h1d1 && t2h1d7 < t2w1rwt1 && t2h1d7 < t2w1lwt1 && t2h1d7 < t2h1uwt1 && t2h1d7 < t2h1dwt1
  && t2h1d7 < t2w1r2 && t2h1d7 < t2w1l2 && t2h1d7 < t2h1u2 && t2h1d7 < t2h1d2 && t2h1d7 < t2w1rwt2 && t2h1d7 < t2w1lwt2 && t2h1d7 < t2h1uwt2 && t2h1d7 < t2h1dwt2
  && t2h1d7 < t2w1r3 && t2h1d7 < t2w1l3 && t2h1d7 < t2h1u3 && t2h1d7 < t2h1d3 && t2h1d7 < t2w1rwt3 && t2h1d7 < t2w1lwt3 && t2h1d7 < t2h1uwt3 && t2h1d7 < t2h1dwt3
  && t2h1d7 < t2w1r4 && t2h1d7 < t2w1l4 && t2h1d7 < t2h1u4 && t2h1d7 < t2h1d4 && t2h1d7 < t2w1rwt4 && t2h1d7 < t2w1lwt4 && t2h1d7 < t2h1uwt4 && t2h1d7 < t2h1dwt4
  && t2h1d7 < t2w1r5 && t2h1d7 < t2w1l5 && t2h1d7 < t2h1u5 && t2h1d7 < t2h1d5 && t2h1d7 < t2w1rwt5 && t2h1d7 < t2w1lwt5 && t2h1d7 < t2h1uwt5 && t2h1d7 < t2h1dwt5
  && t2h1d7 < t2w1r6 && t2h1d7 < t2w1l6 && t2h1d7 < t2h1u6 && t2h1d7 < t2h1d6 && t2h1d7 < t2w1rwt6 && t2h1d7 < t2w1lwt6 && t2h1d7 < t2h1uwt6 && t2h1d7 < t2h1dwt6
  && t2h1d7 < t2w1r7 && t2h1d7 < t2w1l7 && t2h1d7 < t2h1u7 && t2h1d7 < t2w1rwt7 && t2h1d7 < t2w1lwt7 && t2h1d7 < t2h1uwt7 && t2h1d7 < t2h1dwt7
  && t2h1d7 < t2w1r8 && t2h1d7 < t2w1l8 && t2h1d7 < t2h1u8 && t2h1d7 < t2h1d8 && t2h1d7 < t2w1rwt8 && t2h1d7 < t2w1lwt8 && t2h1d7 < t2h1uwt8 && t2h1d7 < t2h1dwt8
  && t2h1d7 < t2w1r9 && t2h1d7 < t2w1l9 && t2h1d7 < t2h1u9 && t2h1d7 < t2h1d9 && t2h1d7 < t2w1rwt9 && t2h1d7 < t2w1lwt9 && t2h1d7 < t2h1uwt9 && t2h1d7 < t2h1dwt9
  && t2h1d7 < t2w1r10 && t2h1d7 < t2w1l10 && t2h1d7 < t2h1u10 && t2h1d7 < t2h1d10 && t2h1d7 < t2w1rwt10 && t2h1d7 < t2w1lwt10 && t2h1d7 < t2h1uwt10 && t2h1d7 < t2h1dwt10
  && (louthd7 !=0 && linhd7!=0)){
  i=297;
  }

  if (myd7==-1 && t2h1d7 > 0 && t2h1d7 < t1 
  && t2h1d7 < t2w1r && t2h1d7 < t2w1l && t2h1d7 < t2h1u && t2h1d7 < t2h1d && t2h1d7 < t2w1rwt && t2h1d7 < t2w1lwt && t2h1d7 < t2h1uwt && t2h1d7 < t2h1dwt
  && t2h1d7 < t2w1r1 && t2h1d7 < t2w1l1 && t2h1d7 < t2h1u1 && t2h1d7 < t2h1d1 && t2h1d7 < t2w1rwt1 && t2h1d7 < t2w1lwt1 && t2h1d7 < t2h1uwt1 && t2h1d7 < t2h1dwt1
  && t2h1d7 < t2w1r2 && t2h1d7 < t2w1l2 && t2h1d7 < t2h1u2 && t2h1d7 < t2h1d2 && t2h1d7 < t2w1rwt2 && t2h1d7 < t2w1lwt2 && t2h1d7 < t2h1uwt2 && t2h1d7 < t2h1dwt2
  && t2h1d7 < t2w1r3 && t2h1d7 < t2w1l3 && t2h1d7 < t2h1u3 && t2h1d7 < t2h1d3 && t2h1d7 < t2w1rwt3 && t2h1d7 < t2w1lwt3 && t2h1d7 < t2h1uwt3 && t2h1d7 < t2h1dwt3
  && t2h1d7 < t2w1r4 && t2h1d7 < t2w1l4 && t2h1d7 < t2h1u4 && t2h1d7 < t2h1d4 && t2h1d7 < t2w1rwt4 && t2h1d7 < t2w1lwt4 && t2h1d7 < t2h1uwt4 && t2h1d7 < t2h1dwt4
  && t2h1d7 < t2w1r5 && t2h1d7 < t2w1l5 && t2h1d7 < t2h1u5 && t2h1d7 < t2h1d5 && t2h1d7 < t2w1rwt5 && t2h1d7 < t2w1lwt5 && t2h1d7 < t2h1uwt5 && t2h1d7 < t2h1dwt5
  && t2h1d7 < t2w1r6 && t2h1d7 < t2w1l6 && t2h1d7 < t2h1u6 && t2h1d7 < t2h1d6 && t2h1d7 < t2w1rwt6 && t2h1d7 < t2w1lwt6 && t2h1d7 < t2h1uwt6 && t2h1d7 < t2h1dwt6
  && t2h1d7 < t2w1r7 && t2h1d7 < t2w1l7 && t2h1d7 < t2h1u7 && t2h1d7 < t2w1rwt7 && t2h1d7 < t2w1lwt7 && t2h1d7 < t2h1uwt7 && t2h1d7 < t2h1dwt7
  && t2h1d7 < t2w1r8 && t2h1d7 < t2w1l8 && t2h1d7 < t2h1u8 && t2h1d7 < t2h1d8 && t2h1d7 < t2w1rwt8 && t2h1d7 < t2w1lwt8 && t2h1d7 < t2h1uwt8 && t2h1d7 < t2h1dwt8
  && t2h1d7 < t2w1r9 && t2h1d7 < t2w1l9 && t2h1d7 < t2h1u9 && t2h1d7 < t2h1d9 && t2h1d7 < t2w1rwt9 && t2h1d7 < t2w1lwt9 && t2h1d7 < t2h1uwt9 && t2h1d7 < t2h1dwt9
  && t2h1d7 < t2w1r10 && t2h1d7 < t2w1l10 && t2h1d7 < t2h1u10 && t2h1d7 < t2h1d10 && t2h1d7 < t2w1rwt10 && t2h1d7 < t2w1lwt10 && t2h1d7 < t2h1uwt10 && t2h1d7 < t2h1dwt10
  && ((louthd7 !=0 && linhd7==0) || (louthd7 ==0 && linhd7!=0))){
  i=297;
  }

  if (myd7==-1 && t2h1d7 > 0 && t2h1d7 < t1 
  && t2h1d7 < t2w1r && t2h1d7 < t2w1l && t2h1d7 < t2h1u && t2h1d7 < t2h1d && t2h1d7 < t2w1rwt && t2h1d7 < t2w1lwt && t2h1d7 < t2h1uwt && t2h1d7 < t2h1dwt
  && t2h1d7 < t2w1r1 && t2h1d7 < t2w1l1 && t2h1d7 < t2h1u1 && t2h1d7 < t2h1d1 && t2h1d7 < t2w1rwt1 && t2h1d7 < t2w1lwt1 && t2h1d7 < t2h1uwt1 && t2h1d7 < t2h1dwt1
  && t2h1d7 < t2w1r2 && t2h1d7 < t2w1l2 && t2h1d7 < t2h1u2 && t2h1d7 < t2h1d2 && t2h1d7 < t2w1rwt2 && t2h1d7 < t2w1lwt2 && t2h1d7 < t2h1uwt2 && t2h1d7 < t2h1dwt2
  && t2h1d7 < t2w1r3 && t2h1d7 < t2w1l3 && t2h1d7 < t2h1u3 && t2h1d7 < t2h1d3 && t2h1d7 < t2w1rwt3 && t2h1d7 < t2w1lwt3 && t2h1d7 < t2h1uwt3 && t2h1d7 < t2h1dwt3
  && t2h1d7 < t2w1r4 && t2h1d7 < t2w1l4 && t2h1d7 < t2h1u4 && t2h1d7 < t2h1d4 && t2h1d7 < t2w1rwt4 && t2h1d7 < t2w1lwt4 && t2h1d7 < t2h1uwt4 && t2h1d7 < t2h1dwt4
  && t2h1d7 < t2w1r5 && t2h1d7 < t2w1l5 && t2h1d7 < t2h1u5 && t2h1d7 < t2h1d5 && t2h1d7 < t2w1rwt5 && t2h1d7 < t2w1lwt5 && t2h1d7 < t2h1uwt5 && t2h1d7 < t2h1dwt5
  && t2h1d7 < t2w1r6 && t2h1d7 < t2w1l6 && t2h1d7 < t2h1u6 && t2h1d7 < t2h1d6 && t2h1d7 < t2w1rwt6 && t2h1d7 < t2w1lwt6 && t2h1d7 < t2h1uwt6 && t2h1d7 < t2h1dwt6
  && t2h1d7 < t2w1r7 && t2h1d7 < t2w1l7 && t2h1d7 < t2h1u7 && t2h1d7 < t2w1rwt7 && t2h1d7 < t2w1lwt7 && t2h1d7 < t2h1uwt7 && t2h1d7 < t2h1dwt7
  && t2h1d7 < t2w1r8 && t2h1d7 < t2w1l8 && t2h1d7 < t2h1u8 && t2h1d7 < t2h1d8 && t2h1d7 < t2w1rwt8 && t2h1d7 < t2w1lwt8 && t2h1d7 < t2h1uwt8 && t2h1d7 < t2h1dwt8
  && t2h1d7 < t2w1r9 && t2h1d7 < t2w1l9 && t2h1d7 < t2h1u9 && t2h1d7 < t2h1d9 && t2h1d7 < t2w1rwt9 && t2h1d7 < t2w1lwt9 && t2h1d7 < t2h1uwt9 && t2h1d7 < t2h1dwt9
  && t2h1d7 < t2w1r10 && t2h1d7 < t2w1l10 && t2h1d7 < t2h1u10 && t2h1d7 < t2h1d10 && t2h1d7 < t2w1rwt10 && t2h1d7 < t2w1lwt10 && t2h1d7 < t2h1uwt10 && t2h1d7 < t2h1dwt10
  && (louthd7 == 0 && linhd7 == 0)){
  i=297;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW7!=-1 && t2w1rwt7 > 0 && t2w1rwt7 < t1 
  && t2w1rwt7 < t2w1r && t2w1rwt7 < t2w1l && t2w1rwt7 < t2h1u && t2w1rwt7 < t2h1d && t2w1rwt7 <t2w1rwt && t2w1rwt7 <t2w1lwt && t2w1rwt7 < t2h1uwt && t2w1rwt7 < t2h1dwt
  && t2w1rwt7 < t2w1r1 && t2w1rwt7 < t2w1l1 && t2w1rwt7 < t2h1u1 && t2w1rwt7 < t2h1d1 && t2w1rwt7 <t2w1rwt1 && t2w1rwt7 <t2w1lwt1 && t2w1rwt7 < t2h1uwt1 && t2w1rwt7 < t2h1dwt1
  && t2w1rwt7 < t2w1r2 && t2w1rwt7 < t2w1l2 && t2w1rwt7 < t2h1u2 && t2w1rwt7 < t2h1d2 && t2w1rwt7 <t2w1rwt2 && t2w1rwt7 <t2w1lwt2 && t2w1rwt7 < t2h1uwt2 && t2w1rwt7 < t2h1dwt2
  && t2w1rwt7 < t2w1r3 && t2w1rwt7 < t2w1l3 && t2w1rwt7 < t2h1u3 && t2w1rwt7 < t2h1d3 && t2w1rwt7 <t2w1rwt3 && t2w1rwt7 <t2w1lwt3 && t2w1rwt7 < t2h1uwt3 && t2w1rwt7 < t2h1dwt3
  && t2w1rwt7 < t2w1r4 && t2w1rwt7 < t2w1l4 && t2w1rwt7 < t2h1u4 && t2w1rwt7 < t2h1d4 && t2w1rwt7 <t2w1rwt4 && t2w1rwt7 <t2w1lwt4 && t2w1rwt7 < t2h1uwt4 && t2w1rwt7 < t2h1dwt4
  && t2w1rwt7 < t2w1r5 && t2w1rwt7 < t2w1l5 && t2w1rwt7 < t2h1u5 && t2w1rwt7 < t2h1d5 && t2w1rwt7 <t2w1rwt5 && t2w1rwt7 <t2w1lwt5 && t2w1rwt7 < t2h1uwt5 && t2w1rwt7 < t2h1dwt5
  && t2w1rwt7 < t2w1r6 && t2w1rwt7 < t2w1l6 && t2w1rwt7 < t2h1u6 && t2w1rwt7 < t2h1d6 && t2w1rwt7 <t2w1rwt6 && t2w1rwt7 <t2w1lwt6 && t2w1rwt7 < t2h1uwt6 && t2w1rwt7 < t2h1dwt6
  && t2w1rwt7 < t2w1r7 && t2w1rwt7 < t2w1l7 && t2w1rwt7 < t2h1u7 && t2w1rwt7 < t2h1d7 && t2w1rwt7 <t2w1lwt7 && t2w1rwt7 < t2h1uwt7 && t2w1rwt7 < t2h1dwt7
  && t2w1rwt7 < t2w1r8 && t2w1rwt7 < t2w1l8 && t2w1rwt7 < t2h1u8 && t2w1rwt7 < t2h1d8 && t2w1rwt7 <t2w1rwt8 && t2w1rwt7 <t2w1lwt8 && t2w1rwt7 < t2h1uwt8 && t2w1rwt7 < t2h1dwt8
  && t2w1rwt7 < t2w1r9 && t2w1rwt7 < t2w1l9 && t2w1rwt7 < t2h1u9 && t2w1rwt7 < t2h1d9 && t2w1rwt7 <t2w1rwt9 && t2w1rwt7 <t2w1lwt9 && t2w1rwt7 < t2h1uwt9 && t2w1rwt7 < t2h1dwt9
  && t2w1rwt7 < t2w1r10 && t2w1rwt7 < t2w1l10 && t2w1rwt7 < t2h1u10 && t2w1rwt7 < t2h1d10 && t2w1rwt7 <t2w1rwt10 && t2w1rwt7 <t2w1lwt10 && t2w1rwt7 < t2h1uwt10 && t2w1rwt7 < t2h1dwt10
  && ((linwr7!=0) && (loutwr7!=0) )){	
   if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1rwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1rwt7+z))*(z0hd7+(vz*t2w1rwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1rwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1rwt7+z))*(z0hu7+(vz*t2w1rwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1rwt7+y;
  xtest=vx*t2w1rwt7+x;
  xlimitrwt=-bwrwt7*sqrt(1-((vz*t2w1rwt7+z)+z0wr7)*((vz*t2w1rwt7+z)+z0wr7)/a2wrwt7);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW7 > 0){
  i=302;
  }
  else{
  i=314;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW7!=-1 && t2w1rwt7 > 0 && t2w1rwt7 < t1 
  && t2w1rwt7 < t2w1r && t2w1rwt7 < t2w1l && t2w1rwt7 < t2h1u && t2w1rwt7 < t2h1d && t2w1rwt7 <t2w1rwt && t2w1rwt7 <t2w1lwt && t2w1rwt7 < t2h1uwt && t2w1rwt7 < t2h1dwt
  && t2w1rwt7 < t2w1r1 && t2w1rwt7 < t2w1l1 && t2w1rwt7 < t2h1u1 && t2w1rwt7 < t2h1d1 && t2w1rwt7 <t2w1rwt1 && t2w1rwt7 <t2w1lwt1 && t2w1rwt7 < t2h1uwt1 && t2w1rwt7 < t2h1dwt1
  && t2w1rwt7 < t2w1r2 && t2w1rwt7 < t2w1l2 && t2w1rwt7 < t2h1u2 && t2w1rwt7 < t2h1d2 && t2w1rwt7 <t2w1rwt2 && t2w1rwt7 <t2w1lwt2 && t2w1rwt7 < t2h1uwt2 && t2w1rwt7 < t2h1dwt2
  && t2w1rwt7 < t2w1r3 && t2w1rwt7 < t2w1l3 && t2w1rwt7 < t2h1u3 && t2w1rwt7 < t2h1d3 && t2w1rwt7 <t2w1rwt3 && t2w1rwt7 <t2w1lwt3 && t2w1rwt7 < t2h1uwt3 && t2w1rwt7 < t2h1dwt3
  && t2w1rwt7 < t2w1r4 && t2w1rwt7 < t2w1l4 && t2w1rwt7 < t2h1u4 && t2w1rwt7 < t2h1d4 && t2w1rwt7 <t2w1rwt4 && t2w1rwt7 <t2w1lwt4 && t2w1rwt7 < t2h1uwt4 && t2w1rwt7 < t2h1dwt4
  && t2w1rwt7 < t2w1r5 && t2w1rwt7 < t2w1l5 && t2w1rwt7 < t2h1u5 && t2w1rwt7 < t2h1d5 && t2w1rwt7 <t2w1rwt5 && t2w1rwt7 <t2w1lwt5 && t2w1rwt7 < t2h1uwt5 && t2w1rwt7 < t2h1dwt5
  && t2w1rwt7 < t2w1r6 && t2w1rwt7 < t2w1l6 && t2w1rwt7 < t2h1u6 && t2w1rwt7 < t2h1d6 && t2w1rwt7 <t2w1rwt6 && t2w1rwt7 <t2w1lwt6 && t2w1rwt7 < t2h1uwt6 && t2w1rwt7 < t2h1dwt6
  && t2w1rwt7 < t2w1r7 && t2w1rwt7 < t2w1l7 && t2w1rwt7 < t2h1u7 && t2w1rwt7 < t2h1d7 && t2w1rwt7 <t2w1lwt7 && t2w1rwt7 < t2h1uwt7 && t2w1rwt7 < t2h1dwt7
  && t2w1rwt7 < t2w1r8 && t2w1rwt7 < t2w1l8 && t2w1rwt7 < t2h1u8 && t2w1rwt7 < t2h1d8 && t2w1rwt7 <t2w1rwt8 && t2w1rwt7 <t2w1lwt8 && t2w1rwt7 < t2h1uwt8 && t2w1rwt7 < t2h1dwt8
  && t2w1rwt7 < t2w1r9 && t2w1rwt7 < t2w1l9 && t2w1rwt7 < t2h1u9 && t2w1rwt7 < t2h1d9 && t2w1rwt7 <t2w1rwt9 && t2w1rwt7 <t2w1lwt9 && t2w1rwt7 < t2h1uwt9 && t2w1rwt7 < t2h1dwt9
  && t2w1rwt7 < t2w1r10 && t2w1rwt7 < t2w1l10 && t2w1rwt7 < t2h1u10 && t2w1rwt7 < t2h1d10 && t2w1rwt7 <t2w1rwt10 && t2w1rwt7 <t2w1lwt10 && t2w1rwt7 < t2h1uwt10 && t2w1rwt7 < t2h1dwt10
  && ((loutwr7!=0 && linwr7==0) || (loutwr7==0 && linwr7!=0))){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1rwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1rwt7+z))*(z0hd7+(vz*t2w1rwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1rwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1rwt7+z))*(z0hu7+(vz*t2w1rwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1rwt7+y;
  xtest=vx*t2w1rwt7+x;
  xlimitr=-sqrt((pbwrwt7-(vz*t2w1rwt7+z))/pawrwt7);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW7 > 0){
  i=303; 
  }else{
  i=314;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW7!=-1 && t2w1rwt7 > 0 && t2w1rwt7 < t1 
  && t2w1rwt7 < t2w1r && t2w1rwt7 < t2w1l && t2w1rwt7 < t2h1u && t2w1rwt7 < t2h1d && t2w1rwt7 <t2w1rwt && t2w1rwt7 <t2w1lwt && t2w1rwt7 < t2h1uwt && t2w1rwt7 < t2h1dwt
  && t2w1rwt7 < t2w1r1 && t2w1rwt7 < t2w1l1 && t2w1rwt7 < t2h1u1 && t2w1rwt7 < t2h1d1 && t2w1rwt7 <t2w1rwt1 && t2w1rwt7 <t2w1lwt1 && t2w1rwt7 < t2h1uwt1 && t2w1rwt7 < t2h1dwt1
  && t2w1rwt7 < t2w1r2 && t2w1rwt7 < t2w1l2 && t2w1rwt7 < t2h1u2 && t2w1rwt7 < t2h1d2 && t2w1rwt7 <t2w1rwt2 && t2w1rwt7 <t2w1lwt2 && t2w1rwt7 < t2h1uwt2 && t2w1rwt7 < t2h1dwt2
  && t2w1rwt7 < t2w1r3 && t2w1rwt7 < t2w1l3 && t2w1rwt7 < t2h1u3 && t2w1rwt7 < t2h1d3 && t2w1rwt7 <t2w1rwt3 && t2w1rwt7 <t2w1lwt3 && t2w1rwt7 < t2h1uwt3 && t2w1rwt7 < t2h1dwt3
  && t2w1rwt7 < t2w1r4 && t2w1rwt7 < t2w1l4 && t2w1rwt7 < t2h1u4 && t2w1rwt7 < t2h1d4 && t2w1rwt7 <t2w1rwt4 && t2w1rwt7 <t2w1lwt4 && t2w1rwt7 < t2h1uwt4 && t2w1rwt7 < t2h1dwt4
  && t2w1rwt7 < t2w1r5 && t2w1rwt7 < t2w1l5 && t2w1rwt7 < t2h1u5 && t2w1rwt7 < t2h1d5 && t2w1rwt7 <t2w1rwt5 && t2w1rwt7 <t2w1lwt5 && t2w1rwt7 < t2h1uwt5 && t2w1rwt7 < t2h1dwt5
  && t2w1rwt7 < t2w1r6 && t2w1rwt7 < t2w1l6 && t2w1rwt7 < t2h1u6 && t2w1rwt7 < t2h1d6 && t2w1rwt7 <t2w1rwt6 && t2w1rwt7 <t2w1lwt6 && t2w1rwt7 < t2h1uwt6 && t2w1rwt7 < t2h1dwt6
  && t2w1rwt7 < t2w1r7 && t2w1rwt7 < t2w1l7 && t2w1rwt7 < t2h1u7 && t2w1rwt7 < t2h1d7 && t2w1rwt7 <t2w1lwt7 && t2w1rwt7 < t2h1uwt7 && t2w1rwt7 < t2h1dwt7
  && t2w1rwt7 < t2w1r8 && t2w1rwt7 < t2w1l8 && t2w1rwt7 < t2h1u8 && t2w1rwt7 < t2h1d8 && t2w1rwt7 <t2w1rwt8 && t2w1rwt7 <t2w1lwt8 && t2w1rwt7 < t2h1uwt8 && t2w1rwt7 < t2h1dwt8
  && t2w1rwt7 < t2w1r9 && t2w1rwt7 < t2w1l9 && t2w1rwt7 < t2h1u9 && t2w1rwt7 < t2h1d9 && t2w1rwt7 <t2w1rwt9 && t2w1rwt7 <t2w1lwt9 && t2w1rwt7 < t2h1uwt9 && t2w1rwt7 < t2h1dwt9
  && t2w1rwt7 < t2w1r10 && t2w1rwt7 < t2w1l10 && t2w1rwt7 < t2h1u10 && t2w1rwt7 < t2h1d10 && t2w1rwt7 <t2w1rwt10 && t2w1rwt7 <t2w1lwt10 && t2w1rwt7 < t2h1uwt10 && t2w1rwt7 < t2h1dwt10
  && (loutwr7==0 && linwr7==0)){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1rwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1rwt7+z))*(z0hd7+(vz*t2w1rwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1rwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1rwt7+z))*(z0hu7+(vz*t2w1rwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1rwt7+y; 
  xtest=vx*t2w1rwt7+x;
  xlimitr=-(-w2r7+w1r7)*(vz*t2w1rwt7+z)/l-w1rwt7;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW7>0){
  i=304;
  }else{
  i=314;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW7!=-1 && t2w1lwt7 > 0 && t2w1lwt7 < t1 
  && t2w1lwt7 < t2w1r && t2w1lwt7 < t2w1l && t2w1lwt7 < t2h1u && t2w1lwt7 < t2h1d && t2w1lwt7 <t2w1rwt && t2w1lwt7 <t2w1lwt && t2w1lwt7 < t2h1uwt && t2w1lwt7 < t2h1dwt
  && t2w1lwt7 < t2w1r1 && t2w1lwt7 < t2w1l1 && t2w1lwt7 < t2h1u1 && t2w1lwt7 < t2h1d1 && t2w1lwt7 <t2w1rwt1 && t2w1lwt7 <t2w1lwt1 && t2w1lwt7 < t2h1uwt1 && t2w1lwt7 < t2h1dwt1
  && t2w1lwt7 < t2w1r2 && t2w1lwt7 < t2w1l2 && t2w1lwt7 < t2h1u2 && t2w1lwt7 < t2h1d2 && t2w1lwt7 <t2w1rwt2 && t2w1lwt7 <t2w1lwt2 && t2w1lwt7 < t2h1uwt2 && t2w1lwt7 < t2h1dwt2
  && t2w1lwt7 < t2w1r3 && t2w1lwt7 < t2w1l3 && t2w1lwt7 < t2h1u3 && t2w1lwt7 < t2h1d3 && t2w1lwt7 <t2w1rwt3 && t2w1lwt7 <t2w1lwt3 && t2w1lwt7 < t2h1uwt3 && t2w1lwt7 < t2h1dwt3
  && t2w1lwt7 < t2w1r4 && t2w1lwt7 < t2w1l4 && t2w1lwt7 < t2h1u4 && t2w1lwt7 < t2h1d4 && t2w1lwt7 <t2w1rwt4 && t2w1lwt7 <t2w1lwt4 && t2w1lwt7 < t2h1uwt4 && t2w1lwt7 < t2h1dwt4
  && t2w1lwt7 < t2w1r5 && t2w1lwt7 < t2w1l5 && t2w1lwt7 < t2h1u5 && t2w1lwt7 < t2h1d5 && t2w1lwt7 <t2w1rwt5 && t2w1lwt7 <t2w1lwt5 && t2w1lwt7 < t2h1uwt5 && t2w1lwt7 < t2h1dwt5
  && t2w1lwt7 < t2w1r6 && t2w1lwt7 < t2w1l6 && t2w1lwt7 < t2h1u6 && t2w1lwt7 < t2h1d6 && t2w1lwt7 <t2w1rwt6 && t2w1lwt7 <t2w1lwt6 && t2w1lwt7 < t2h1uwt6 && t2w1lwt7 < t2h1dwt6
  && t2w1lwt7 < t2w1r7 && t2w1lwt7 < t2w1l7 && t2w1lwt7 < t2h1u7 && t2w1lwt7 < t2h1d7 && t2w1lwt7 <t2w1rwt7 && t2w1lwt7 < t2h1uwt7 && t2w1lwt7 < t2h1dwt7
  && t2w1lwt7 < t2w1r8 && t2w1lwt7 < t2w1l8 && t2w1lwt7 < t2h1u8 && t2w1lwt7 < t2h1d8 && t2w1lwt7 <t2w1rwt8 && t2w1lwt7 <t2w1lwt8 && t2w1lwt7 < t2h1uwt8 && t2w1lwt7 < t2h1dwt8
  && t2w1lwt7 < t2w1r9 && t2w1lwt7 < t2w1l9 && t2w1lwt7 < t2h1u9 && t2w1lwt7 < t2h1d9 && t2w1lwt7 <t2w1rwt9 && t2w1lwt7 <t2w1lwt9 && t2w1lwt7 < t2h1uwt9 && t2w1lwt7 < t2h1dwt9
  && t2w1lwt7 < t2w1r10 && t2w1lwt7 < t2w1l10 && t2w1lwt7 < t2h1u10 && t2w1lwt7 < t2h1d10 && t2w1lwt7 <t2w1rwt10 && t2w1lwt7 <t2w1lwt10 && t2w1lwt7 < t2h1uwt10 && t2w1lwt7 < t2h1dwt10
  && ((linwl7!=0) && (loutwl7!=0) )){
  if(linhd7==0 && louthd7==0)
   if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1lwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1lwt7+z))*(z0hd7+(vz*t2w1lwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1lwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1lwt7+z))*(z0hu7+(vz*t2w1lwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1lwt7+y;
  xtest=vx*t2w1lwt7+x;
  xlimitlwt=-bwlwt7*sqrt(1-((vz*t2w1lwt7+z)+z0wl7)*((vz*t2w1lwt7+z)+z0wl7)/a2wlwt7);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW7>0){
  i=305;
  }else{
  i=315;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW7!=-1 && t2w1lwt7 > 0 && t2w1lwt7 < t1 
  && t2w1lwt7 < t2w1r && t2w1lwt7 < t2w1l && t2w1lwt7 < t2h1u && t2w1lwt7 < t2h1d && t2w1lwt7 <t2w1rwt && t2w1lwt7 <t2w1lwt && t2w1lwt7 < t2h1uwt && t2w1lwt7 < t2h1dwt
  && t2w1lwt7 < t2w1r1 && t2w1lwt7 < t2w1l1 && t2w1lwt7 < t2h1u1 && t2w1lwt7 < t2h1d1 && t2w1lwt7 <t2w1rwt1 && t2w1lwt7 <t2w1lwt1 && t2w1lwt7 < t2h1uwt1 && t2w1lwt7 < t2h1dwt1
  && t2w1lwt7 < t2w1r2 && t2w1lwt7 < t2w1l2 && t2w1lwt7 < t2h1u2 && t2w1lwt7 < t2h1d2 && t2w1lwt7 <t2w1rwt2 && t2w1lwt7 <t2w1lwt2 && t2w1lwt7 < t2h1uwt2 && t2w1lwt7 < t2h1dwt2
  && t2w1lwt7 < t2w1r3 && t2w1lwt7 < t2w1l3 && t2w1lwt7 < t2h1u3 && t2w1lwt7 < t2h1d3 && t2w1lwt7 <t2w1rwt3 && t2w1lwt7 <t2w1lwt3 && t2w1lwt7 < t2h1uwt3 && t2w1lwt7 < t2h1dwt3
  && t2w1lwt7 < t2w1r4 && t2w1lwt7 < t2w1l4 && t2w1lwt7 < t2h1u4 && t2w1lwt7 < t2h1d4 && t2w1lwt7 <t2w1rwt4 && t2w1lwt7 <t2w1lwt4 && t2w1lwt7 < t2h1uwt4 && t2w1lwt7 < t2h1dwt4
  && t2w1lwt7 < t2w1r5 && t2w1lwt7 < t2w1l5 && t2w1lwt7 < t2h1u5 && t2w1lwt7 < t2h1d5 && t2w1lwt7 <t2w1rwt5 && t2w1lwt7 <t2w1lwt5 && t2w1lwt7 < t2h1uwt5 && t2w1lwt7 < t2h1dwt5
  && t2w1lwt7 < t2w1r6 && t2w1lwt7 < t2w1l6 && t2w1lwt7 < t2h1u6 && t2w1lwt7 < t2h1d6 && t2w1lwt7 <t2w1rwt6 && t2w1lwt7 <t2w1lwt6 && t2w1lwt7 < t2h1uwt6 && t2w1lwt7 < t2h1dwt6
  && t2w1lwt7 < t2w1r7 && t2w1lwt7 < t2w1l7 && t2w1lwt7 < t2h1u7 && t2w1lwt7 < t2h1d7 && t2w1lwt7 <t2w1rwt7 && t2w1lwt7 < t2h1uwt7 && t2w1lwt7 < t2h1dwt7
  && t2w1lwt7 < t2w1r8 && t2w1lwt7 < t2w1l8 && t2w1lwt7 < t2h1u8 && t2w1lwt7 < t2h1d8 && t2w1lwt7 <t2w1rwt8 && t2w1lwt7 <t2w1lwt8 && t2w1lwt7 < t2h1uwt8 && t2w1lwt7 < t2h1dwt8
  && t2w1lwt7 < t2w1r9 && t2w1lwt7 < t2w1l9 && t2w1lwt7 < t2h1u9 && t2w1lwt7 < t2h1d9 && t2w1lwt7 <t2w1rwt9 && t2w1lwt7 <t2w1lwt9 && t2w1lwt7 < t2h1uwt9 && t2w1lwt7 < t2h1dwt9
  && t2w1lwt7 < t2w1r10 && t2w1lwt7 < t2w1l10 && t2w1lwt7 < t2h1u10 && t2w1lwt7 < t2h1d10 && t2w1lwt7 <t2w1rwt10 && t2w1lwt7 <t2w1lwt10 && t2w1lwt7 < t2h1uwt10 && t2w1lwt7 < t2h1dwt10
  && ((loutwl7!=0 && linwl7==0) || (loutwl7==0 && linwl7!=0))){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1lwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1lwt7+z))*(z0hd7+(vz*t2w1lwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1lwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1lwt7+z))*(z0hu7+(vz*t2w1lwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1lwt7+y;
  xtest=vx*t2w1lwt7+x;
  xlimitl=-sqrt((pbwlwt7-(vz*t2w1lwt7+z))/pawlwt7);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW7>0){
  i=306;
  }else{
  i=315;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW7!=-1 && t2w1lwt7 > 0 && t2w1lwt7 < t1 
  && t2w1lwt7 < t2w1r && t2w1lwt7 < t2w1l && t2w1lwt7 < t2h1u && t2w1lwt7 < t2h1d && t2w1lwt7 <t2w1rwt && t2w1lwt7 <t2w1lwt && t2w1lwt7 < t2h1uwt && t2w1lwt7 < t2h1dwt
  && t2w1lwt7 < t2w1r1 && t2w1lwt7 < t2w1l1 && t2w1lwt7 < t2h1u1 && t2w1lwt7 < t2h1d1 && t2w1lwt7 <t2w1rwt1 && t2w1lwt7 <t2w1lwt1 && t2w1lwt7 < t2h1uwt1 && t2w1lwt7 < t2h1dwt1
  && t2w1lwt7 < t2w1r2 && t2w1lwt7 < t2w1l2 && t2w1lwt7 < t2h1u2 && t2w1lwt7 < t2h1d2 && t2w1lwt7 <t2w1rwt2 && t2w1lwt7 <t2w1lwt2 && t2w1lwt7 < t2h1uwt2 && t2w1lwt7 < t2h1dwt2
  && t2w1lwt7 < t2w1r3 && t2w1lwt7 < t2w1l3 && t2w1lwt7 < t2h1u3 && t2w1lwt7 < t2h1d3 && t2w1lwt7 <t2w1rwt3 && t2w1lwt7 <t2w1lwt3 && t2w1lwt7 < t2h1uwt3 && t2w1lwt7 < t2h1dwt3
  && t2w1lwt7 < t2w1r4 && t2w1lwt7 < t2w1l4 && t2w1lwt7 < t2h1u4 && t2w1lwt7 < t2h1d4 && t2w1lwt7 <t2w1rwt4 && t2w1lwt7 <t2w1lwt4 && t2w1lwt7 < t2h1uwt4 && t2w1lwt7 < t2h1dwt4
  && t2w1lwt7 < t2w1r5 && t2w1lwt7 < t2w1l5 && t2w1lwt7 < t2h1u5 && t2w1lwt7 < t2h1d5 && t2w1lwt7 <t2w1rwt5 && t2w1lwt7 <t2w1lwt5 && t2w1lwt7 < t2h1uwt5 && t2w1lwt7 < t2h1dwt5
  && t2w1lwt7 < t2w1r6 && t2w1lwt7 < t2w1l6 && t2w1lwt7 < t2h1u6 && t2w1lwt7 < t2h1d6 && t2w1lwt7 <t2w1rwt6 && t2w1lwt7 <t2w1lwt6 && t2w1lwt7 < t2h1uwt6 && t2w1lwt7 < t2h1dwt6
  && t2w1lwt7 < t2w1r7 && t2w1lwt7 < t2w1l7 && t2w1lwt7 < t2h1u7 && t2w1lwt7 < t2h1d7 && t2w1lwt7 <t2w1rwt7 && t2w1lwt7 < t2h1uwt7 && t2w1lwt7 < t2h1dwt7
  && t2w1lwt7 < t2w1r8 && t2w1lwt7 < t2w1l8 && t2w1lwt7 < t2h1u8 && t2w1lwt7 < t2h1d8 && t2w1lwt7 <t2w1rwt8 && t2w1lwt7 <t2w1lwt8 && t2w1lwt7 < t2h1uwt8 && t2w1lwt7 < t2h1dwt8
  && t2w1lwt7 < t2w1r9 && t2w1lwt7 < t2w1l9 && t2w1lwt7 < t2h1u9 && t2w1lwt7 < t2h1d9 && t2w1lwt7 <t2w1rwt9 && t2w1lwt7 <t2w1lwt9 && t2w1lwt7 < t2h1uwt9 && t2w1lwt7 < t2h1dwt9
  && t2w1lwt7 < t2w1r10 && t2w1lwt7 < t2w1l10 && t2w1lwt7 < t2h1u10 && t2w1lwt7 < t2h1d10 && t2w1lwt7 <t2w1rwt10 && t2w1lwt7 <t2w1lwt10 && t2w1lwt7 < t2h1uwt10 && t2w1lwt7 < t2h1dwt10
  && (loutwl7==0 && linwl7==0)){
  if(linhd7==0 && louthd7==0)
   {
      ylimitd=(-h2d7+h1d7)/l*(vz*t2w1lwt7+z)-h1dwt7;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ylimitd=-bhdwt7*sqrt(1-((z0hd7+(vz*t2w1lwt7+z))*(z0hd7+(vz*t2w1lwt7+z)))/a2hdwt7);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt7+z)-pbhdwt7)/-pahdwt7);
      }
   }
   if(linhu7==0 && louthu7==0)
    {
     ylimitu=(h2u7-h1u7)/l*(vz*t2w1lwt7+z)+h1uwt7;
    }else{
     if(linhu7!=0 && louthu7!=0)
     {
     ylimitu=bhuwt7*sqrt(1-((z0hu7+(vz*t2w1lwt7+z))*(z0hu7+(vz*t2w1lwt7+z)))/a2huwt7);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt7+z)-pbhuwt7)/-pahuwt7);
    }
    }
  ytest=vy*t2w1lwt7+y; 
  xtest=vx*t2w1lwt7+x;
  xlimitl=(w2l7-w1l7)*(vz*t2w1lwt7+z)/l+w1lwt7;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW7>0){
  i=307;
  }else{
  i=315;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW7!=-1 && t2h1uwt7 > 0 && t2h1uwt7 < t1 
  && t2h1uwt7 < t2w1r && t2h1uwt7 < t2w1l && t2h1uwt7 < t2h1u && t2h1uwt7 < t2h1d && t2h1uwt7 < t2w1rwt && t2h1uwt7 < t2w1lwt && t2h1uwt7 < t2h1uwt && t2h1uwt7 < t2h1dwt 
  && t2h1uwt7 < t2w1r1 && t2h1uwt7 < t2w1l1 && t2h1uwt7 < t2h1u1 && t2h1uwt7 < t2h1d1 && t2h1uwt7 < t2w1rwt1 && t2h1uwt7 < t2w1lwt1 && t2h1uwt7 < t2h1uwt1 && t2h1uwt7 < t2h1dwt1
  && t2h1uwt7 < t2w1r2 && t2h1uwt7 < t2w1l2 && t2h1uwt7 < t2h1u2 && t2h1uwt7 < t2h1d2 && t2h1uwt7 < t2w1rwt2 && t2h1uwt7 < t2w1lwt2 && t2h1uwt7 < t2h1uwt2 && t2h1uwt7 < t2h1dwt2
  && t2h1uwt7 < t2w1r3 && t2h1uwt7 < t2w1l3 && t2h1uwt7 < t2h1u3 && t2h1uwt7 < t2h1d3 && t2h1uwt7 < t2w1rwt3 && t2h1uwt7 < t2w1lwt3 && t2h1uwt7 < t2h1uwt3 && t2h1uwt7 < t2h1dwt3
  && t2h1uwt7 < t2w1r4 && t2h1uwt7 < t2w1l4 && t2h1uwt7 < t2h1u4 && t2h1uwt7 < t2h1d4 && t2h1uwt7 < t2w1rwt4 && t2h1uwt7 < t2w1lwt4 && t2h1uwt7 < t2h1uwt4 && t2h1uwt7 < t2h1dwt4
  && t2h1uwt7 < t2w1r5 && t2h1uwt7 < t2w1l5 && t2h1uwt7 < t2h1u5 && t2h1uwt7 < t2h1d5 && t2h1uwt7 < t2w1rwt5 && t2h1uwt7 < t2w1lwt5 && t2h1uwt7 < t2h1uwt5 && t2h1uwt7 < t2h1dwt5
  && t2h1uwt7 < t2w1r6 && t2h1uwt7 < t2w1l6 && t2h1uwt7 < t2h1u6 && t2h1uwt7 < t2h1d6 && t2h1uwt7 < t2w1rwt6 && t2h1uwt7 < t2w1lwt6 && t2h1uwt7 < t2h1uwt6 && t2h1uwt7 < t2h1dwt6
  && t2h1uwt7 < t2w1r7 && t2h1uwt7 < t2w1l7 && t2h1uwt7 < t2h1u7 && t2h1uwt7 < t2h1d7 && t2h1uwt7 < t2w1rwt7 && t2h1uwt7 < t2w1lwt7 && t2h1uwt7 < t2h1dwt7
  && t2h1uwt7 < t2w1r8 && t2h1uwt7 < t2w1l8 && t2h1uwt7 < t2h1u8 && t2h1uwt7 < t2h1d8 && t2h1uwt7 < t2w1rwt8 && t2h1uwt7 < t2w1lwt8 && t2h1uwt7 < t2h1uwt8 && t2h1uwt7 < t2h1dwt8
  && t2h1uwt7 < t2w1r9 && t2h1uwt7 < t2w1l9 && t2h1uwt7 < t2h1u9 && t2h1uwt7 < t2h1d9 && t2h1uwt7 < t2w1rwt9 && t2h1uwt7 < t2w1lwt9 && t2h1uwt7 < t2h1uwt9 && t2h1uwt7 < t2h1dwt9
  && t2h1uwt7 < t2w1r10 && t2h1uwt7 < t2w1l10 && t2h1uwt7 < t2h1u10 && t2h1uwt7 < t2h1d10 && t2h1uwt7 < t2w1rwt10 && t2h1uwt7 < t2w1lwt10 && t2h1uwt7 < t2h1uwt10 && t2h1uwt7 < t2h1dwt10
  && (louthu7 !=0 && linhu7!=0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1uwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1uwt7+z))*(z0wr7+(vz*t2h1uwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1uwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1uwt7+z))*(z0wl7+(vz*t2h1uwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1uwt7+x;
  ytest=vy*t2w1lwt7+y;
  ylimitu=bhuwt7*sqrt(1-((vz*t2h1uwt7+z)+z0hu7)*((vz*t2h1uwt7+z)+z0hu7)/a2huwt7);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW7>0 ){
  i=308;
  }else{
  i=316;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW7!=-1 && t2h1uwt7 > 0 && t2h1uwt7 < t1 
  && t2h1uwt7 < t2w1r && t2h1uwt7 < t2w1l && t2h1uwt7 < t2h1u && t2h1uwt7 < t2h1d && t2h1uwt7 < t2w1rwt && t2h1uwt7 < t2w1lwt && t2h1uwt7 < t2h1uwt && t2h1uwt7 < t2h1dwt 
  && t2h1uwt7 < t2w1r1 && t2h1uwt7 < t2w1l1 && t2h1uwt7 < t2h1u1 && t2h1uwt7 < t2h1d1 && t2h1uwt7 < t2w1rwt1 && t2h1uwt7 < t2w1lwt1 && t2h1uwt7 < t2h1uwt1 && t2h1uwt7 < t2h1dwt1
  && t2h1uwt7 < t2w1r2 && t2h1uwt7 < t2w1l2 && t2h1uwt7 < t2h1u2 && t2h1uwt7 < t2h1d2 && t2h1uwt7 < t2w1rwt2 && t2h1uwt7 < t2w1lwt2 && t2h1uwt7 < t2h1uwt2 && t2h1uwt7 < t2h1dwt2
  && t2h1uwt7 < t2w1r3 && t2h1uwt7 < t2w1l3 && t2h1uwt7 < t2h1u3 && t2h1uwt7 < t2h1d3 && t2h1uwt7 < t2w1rwt3 && t2h1uwt7 < t2w1lwt3 && t2h1uwt7 < t2h1uwt3 && t2h1uwt7 < t2h1dwt3
  && t2h1uwt7 < t2w1r4 && t2h1uwt7 < t2w1l4 && t2h1uwt7 < t2h1u4 && t2h1uwt7 < t2h1d4 && t2h1uwt7 < t2w1rwt4 && t2h1uwt7 < t2w1lwt4 && t2h1uwt7 < t2h1uwt4 && t2h1uwt7 < t2h1dwt4
  && t2h1uwt7 < t2w1r5 && t2h1uwt7 < t2w1l5 && t2h1uwt7 < t2h1u5 && t2h1uwt7 < t2h1d5 && t2h1uwt7 < t2w1rwt5 && t2h1uwt7 < t2w1lwt5 && t2h1uwt7 < t2h1uwt5 && t2h1uwt7 < t2h1dwt5
  && t2h1uwt7 < t2w1r6 && t2h1uwt7 < t2w1l6 && t2h1uwt7 < t2h1u6 && t2h1uwt7 < t2h1d6 && t2h1uwt7 < t2w1rwt6 && t2h1uwt7 < t2w1lwt6 && t2h1uwt7 < t2h1uwt6 && t2h1uwt7 < t2h1dwt6
  && t2h1uwt7 < t2w1r7 && t2h1uwt7 < t2w1l7 && t2h1uwt7 < t2h1u7 && t2h1uwt7 < t2h1d7 && t2h1uwt7 < t2w1rwt7 && t2h1uwt7 < t2w1lwt7 && t2h1uwt7 < t2h1dwt7
  && t2h1uwt7 < t2w1r8 && t2h1uwt7 < t2w1l8 && t2h1uwt7 < t2h1u8 && t2h1uwt7 < t2h1d8 && t2h1uwt7 < t2w1rwt8 && t2h1uwt7 < t2w1lwt8 && t2h1uwt7 < t2h1uwt8 && t2h1uwt7 < t2h1dwt8
  && t2h1uwt7 < t2w1r9 && t2h1uwt7 < t2w1l9 && t2h1uwt7 < t2h1u9 && t2h1uwt7 < t2h1d9 && t2h1uwt7 < t2w1rwt9 && t2h1uwt7 < t2w1lwt9 && t2h1uwt7 < t2h1uwt9 && t2h1uwt7 < t2h1dwt9
  && t2h1uwt7 < t2w1r10 && t2h1uwt7 < t2w1l10 && t2h1uwt7 < t2h1u10 && t2h1uwt7 < t2h1d10 && t2h1uwt7 < t2w1rwt10 && t2h1uwt7 < t2w1lwt10 && t2h1uwt7 < t2h1uwt10 && t2h1uwt7 < t2h1dwt10
  && ((louthu7!=0 && linhu7==0) || (louthu7==0 && linhu7!=0))){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1uwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1uwt7+z))*(z0wr7+(vz*t2h1uwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1uwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1uwt7+z))*(z0wl7+(vz*t2h1uwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1uwt7+x;
  ytest=vy*t2w1lwt7+y;
  ylimitu=sqrt((pbhuwt7-(vz*t2h1uwt7+z))/pahuwt7);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW7>0){
  i=309;
  }else{
  i=316;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW7!=-1 && t2h1uwt7 > 0 && t2h1uwt7 < t1 
  && t2h1uwt7 < t2w1r && t2h1uwt7 < t2w1l && t2h1uwt7 < t2h1u && t2h1uwt7 < t2h1d && t2h1uwt7 < t2w1rwt && t2h1uwt7 < t2w1lwt && t2h1uwt7 < t2h1uwt && t2h1uwt7 < t2h1dwt 
  && t2h1uwt7 < t2w1r1 && t2h1uwt7 < t2w1l1 && t2h1uwt7 < t2h1u1 && t2h1uwt7 < t2h1d1 && t2h1uwt7 < t2w1rwt1 && t2h1uwt7 < t2w1lwt1 && t2h1uwt7 < t2h1uwt1 && t2h1uwt7 < t2h1dwt1
  && t2h1uwt7 < t2w1r2 && t2h1uwt7 < t2w1l2 && t2h1uwt7 < t2h1u2 && t2h1uwt7 < t2h1d2 && t2h1uwt7 < t2w1rwt2 && t2h1uwt7 < t2w1lwt2 && t2h1uwt7 < t2h1uwt2 && t2h1uwt7 < t2h1dwt2
  && t2h1uwt7 < t2w1r3 && t2h1uwt7 < t2w1l3 && t2h1uwt7 < t2h1u3 && t2h1uwt7 < t2h1d3 && t2h1uwt7 < t2w1rwt3 && t2h1uwt7 < t2w1lwt3 && t2h1uwt7 < t2h1uwt3 && t2h1uwt7 < t2h1dwt3
  && t2h1uwt7 < t2w1r4 && t2h1uwt7 < t2w1l4 && t2h1uwt7 < t2h1u4 && t2h1uwt7 < t2h1d4 && t2h1uwt7 < t2w1rwt4 && t2h1uwt7 < t2w1lwt4 && t2h1uwt7 < t2h1uwt4 && t2h1uwt7 < t2h1dwt4
  && t2h1uwt7 < t2w1r5 && t2h1uwt7 < t2w1l5 && t2h1uwt7 < t2h1u5 && t2h1uwt7 < t2h1d5 && t2h1uwt7 < t2w1rwt5 && t2h1uwt7 < t2w1lwt5 && t2h1uwt7 < t2h1uwt5 && t2h1uwt7 < t2h1dwt5
  && t2h1uwt7 < t2w1r6 && t2h1uwt7 < t2w1l6 && t2h1uwt7 < t2h1u6 && t2h1uwt7 < t2h1d6 && t2h1uwt7 < t2w1rwt6 && t2h1uwt7 < t2w1lwt6 && t2h1uwt7 < t2h1uwt6 && t2h1uwt7 < t2h1dwt6
  && t2h1uwt7 < t2w1r7 && t2h1uwt7 < t2w1l7 && t2h1uwt7 < t2h1u7 && t2h1uwt7 < t2h1d7 && t2h1uwt7 < t2w1rwt7 && t2h1uwt7 < t2w1lwt7 && t2h1uwt7 < t2h1dwt7
  && t2h1uwt7 < t2w1r8 && t2h1uwt7 < t2w1l8 && t2h1uwt7 < t2h1u8 && t2h1uwt7 < t2h1d8 && t2h1uwt7 < t2w1rwt8 && t2h1uwt7 < t2w1lwt8 && t2h1uwt7 < t2h1uwt8 && t2h1uwt7 < t2h1dwt8
  && t2h1uwt7 < t2w1r9 && t2h1uwt7 < t2w1l9 && t2h1uwt7 < t2h1u9 && t2h1uwt7 < t2h1d9 && t2h1uwt7 < t2w1rwt9 && t2h1uwt7 < t2w1lwt9 && t2h1uwt7 < t2h1uwt9 && t2h1uwt7 < t2h1dwt9
  && t2h1uwt7 < t2w1r10 && t2h1uwt7 < t2w1l10 && t2h1uwt7 < t2h1u10 && t2h1uwt7 < t2h1d10 && t2h1uwt7 < t2w1rwt10 && t2h1uwt7 < t2w1lwt10 && t2h1uwt7 < t2h1uwt10 && t2h1uwt7 < t2h1dwt10
  && (louthu7 == 0 && linhu7 == 0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1uwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1uwt7+z))*(z0wr7+(vz*t2h1uwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1uwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1uwt7+z))*(z0wl7+(vz*t2h1uwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1uwt7+x;
  ytest=vy*t2w1lwt7+y;
  ylimitu=(h2u7-h1u7)*(vz*t2h1uwt7+z)/l+h1uwt7;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW7>0 ){
  i=310;
  }else{
  i=316;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW7!=-1 && t2h1dwt7 > 0 && t2h1dwt7 < t1 
  && t2h1dwt7 < t2w1r && t2h1dwt7 < t2w1l && t2h1dwt7 < t2h1u && t2h1dwt7 < t2h1d && t2h1dwt7 < t2w1rwt && t2h1dwt7 < t2w1lwt && t2h1dwt7 < t2h1uwt && t2h1dwt7 < t2h1dwt 
  && t2h1dwt7 < t2w1r1 && t2h1dwt7 < t2w1l1 && t2h1dwt7 < t2h1u1 && t2h1dwt7 < t2h1d1 && t2h1dwt7 < t2w1rwt1 && t2h1dwt7 < t2w1lwt1 && t2h1dwt7 < t2h1uwt1 && t2h1dwt7 < t2h1dwt1
  && t2h1dwt7 < t2w1r2 && t2h1dwt7 < t2w1l2 && t2h1dwt7 < t2h1u2 && t2h1dwt7 < t2h1d2 && t2h1dwt7 < t2w1rwt2 && t2h1dwt7 < t2w1lwt2 && t2h1dwt7 < t2h1uwt2 && t2h1dwt7 < t2h1dwt2 
  && t2h1dwt7 < t2w1r3 && t2h1dwt7 < t2w1l3 && t2h1dwt7 < t2h1u3 && t2h1dwt7 < t2h1d3 && t2h1dwt7 < t2w1rwt3 && t2h1dwt7 < t2w1lwt3 && t2h1dwt7 < t2h1uwt3 && t2h1dwt7 < t2h1dwt3
  && t2h1dwt7 < t2w1r4 && t2h1dwt7 < t2w1l4 && t2h1dwt7 < t2h1u4 && t2h1dwt7 < t2h1d4 && t2h1dwt7 < t2w1rwt4 && t2h1dwt7 < t2w1lwt4 && t2h1dwt7 < t2h1uwt4 && t2h1dwt7 < t2h1dwt4
  && t2h1dwt7 < t2w1r5 && t2h1dwt7 < t2w1l5 && t2h1dwt7 < t2h1u5 && t2h1dwt7 < t2h1d5 && t2h1dwt7 < t2w1rwt5 && t2h1dwt7 < t2w1lwt5 && t2h1dwt7 < t2h1uwt5 && t2h1dwt7 < t2h1dwt5
  && t2h1dwt7 < t2w1r6 && t2h1dwt7 < t2w1l6 && t2h1dwt7 < t2h1u6 && t2h1dwt7 < t2h1d6 && t2h1dwt7 < t2w1rwt6 && t2h1dwt7 < t2w1lwt6 && t2h1dwt7 < t2h1uwt6 && t2h1dwt7 < t2h1dwt6
  && t2h1dwt7 < t2w1r7 && t2h1dwt7 < t2w1l7 && t2h1dwt7 < t2h1u7 && t2h1dwt7 < t2h1d7 && t2h1dwt7 < t2w1rwt7 && t2h1dwt7 < t2w1lwt7 && t2h1dwt7 < t2h1uwt7 
  && t2h1dwt7 < t2w1r8 && t2h1dwt7 < t2w1l8 && t2h1dwt7 < t2h1u8 && t2h1dwt7 < t2h1d8 && t2h1dwt7 < t2w1rwt8 && t2h1dwt7 < t2w1lwt8 && t2h1dwt7 < t2h1uwt8 && t2h1dwt7 < t2h1dwt8
  && t2h1dwt7 < t2w1r9 && t2h1dwt7 < t2w1l9 && t2h1dwt7 < t2h1u9 && t2h1dwt7 < t2h1d9 && t2h1dwt7 < t2w1rwt9 && t2h1dwt7 < t2w1lwt9 && t2h1dwt7 < t2h1uwt9 && t2h1dwt7 < t2h1dwt9 
  && t2h1dwt7 < t2w1r10 && t2h1dwt7 < t2w1l10 && t2h1dwt7 < t2h1u10 && t2h1dwt7 < t2h1d10 && t2h1dwt7 < t2w1rwt10 && t2h1dwt7 < t2w1lwt10 && t2h1dwt7 < t2h1uwt10 && t2h1dwt7 < t2h1dwt10  
  && (louthd7 !=0 && linhd7!=0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1dwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1dwt7+z))*(z0wr7+(vz*t2h1dwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1dwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1dwt7+z))*(z0wl7+(vz*t2h1dwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1dwt7+x;
  ytest=vy*t2w1lwt7+y;
  ylimitd=-bhdwt7*sqrt(1-((vz*t2h1dwt7+z)+z0hd7)*((vz*t2h1dwt7+z)+z0hd7)/a2hdwt7);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW7>0){
  i=311;
  }else{
  i=317;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW7!=-1 && t2h1dwt7 > 0 && t2h1dwt7 < t1 
  && t2h1dwt7 < t2w1r && t2h1dwt7 < t2w1l && t2h1dwt7 < t2h1u && t2h1dwt7 < t2h1d && t2h1dwt7 < t2w1rwt && t2h1dwt7 < t2w1lwt && t2h1dwt7 < t2h1uwt && t2h1dwt7 < t2h1dwt 
  && t2h1dwt7 < t2w1r1 && t2h1dwt7 < t2w1l1 && t2h1dwt7 < t2h1u1 && t2h1dwt7 < t2h1d1 && t2h1dwt7 < t2w1rwt1 && t2h1dwt7 < t2w1lwt1 && t2h1dwt7 < t2h1uwt1 && t2h1dwt7 < t2h1dwt1
  && t2h1dwt7 < t2w1r2 && t2h1dwt7 < t2w1l2 && t2h1dwt7 < t2h1u2 && t2h1dwt7 < t2h1d2 && t2h1dwt7 < t2w1rwt2 && t2h1dwt7 < t2w1lwt2 && t2h1dwt7 < t2h1uwt2 && t2h1dwt7 < t2h1dwt2 
  && t2h1dwt7 < t2w1r3 && t2h1dwt7 < t2w1l3 && t2h1dwt7 < t2h1u3 && t2h1dwt7 < t2h1d3 && t2h1dwt7 < t2w1rwt3 && t2h1dwt7 < t2w1lwt3 && t2h1dwt7 < t2h1uwt3 && t2h1dwt7 < t2h1dwt3
  && t2h1dwt7 < t2w1r4 && t2h1dwt7 < t2w1l4 && t2h1dwt7 < t2h1u4 && t2h1dwt7 < t2h1d4 && t2h1dwt7 < t2w1rwt4 && t2h1dwt7 < t2w1lwt4 && t2h1dwt7 < t2h1uwt4 && t2h1dwt7 < t2h1dwt4
  && t2h1dwt7 < t2w1r5 && t2h1dwt7 < t2w1l5 && t2h1dwt7 < t2h1u5 && t2h1dwt7 < t2h1d5 && t2h1dwt7 < t2w1rwt5 && t2h1dwt7 < t2w1lwt5 && t2h1dwt7 < t2h1uwt5 && t2h1dwt7 < t2h1dwt5
  && t2h1dwt7 < t2w1r6 && t2h1dwt7 < t2w1l6 && t2h1dwt7 < t2h1u6 && t2h1dwt7 < t2h1d6 && t2h1dwt7 < t2w1rwt6 && t2h1dwt7 < t2w1lwt6 && t2h1dwt7 < t2h1uwt6 && t2h1dwt7 < t2h1dwt6
  && t2h1dwt7 < t2w1r7 && t2h1dwt7 < t2w1l7 && t2h1dwt7 < t2h1u7 && t2h1dwt7 < t2h1d7 && t2h1dwt7 < t2w1rwt7 && t2h1dwt7 < t2w1lwt7 && t2h1dwt7 < t2h1uwt7 
  && t2h1dwt7 < t2w1r8 && t2h1dwt7 < t2w1l8 && t2h1dwt7 < t2h1u8 && t2h1dwt7 < t2h1d8 && t2h1dwt7 < t2w1rwt8 && t2h1dwt7 < t2w1lwt8 && t2h1dwt7 < t2h1uwt8 && t2h1dwt7 < t2h1dwt8
  && t2h1dwt7 < t2w1r9 && t2h1dwt7 < t2w1l9 && t2h1dwt7 < t2h1u9 && t2h1dwt7 < t2h1d9 && t2h1dwt7 < t2w1rwt9 && t2h1dwt7 < t2w1lwt9 && t2h1dwt7 < t2h1uwt9 && t2h1dwt7 < t2h1dwt9 
  && t2h1dwt7 < t2w1r10 && t2h1dwt7 < t2w1l10 && t2h1dwt7 < t2h1u10 && t2h1dwt7 < t2h1d10 && t2h1dwt7 < t2w1rwt10 && t2h1dwt7 < t2w1lwt10 && t2h1dwt7 < t2h1uwt10 && t2h1dwt7 < t2h1dwt10
  && ((louthd7 !=0 && linhd7==0) || (louthd7 ==0 && linhd7!=0))){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1dwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1dwt7+z))*(z0wr7+(vz*t2h1dwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
     xlimitl=(w2l7-w1l7)/l*(vz*t2h1dwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1dwt7+z))*(z0wl7+(vz*t2h1dwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1dwt7+x;
  ytest=vy*t2w1lwt7+y;
  ylimitd=-sqrt((pbhdwt7-(vz*t2h1dwt7+z))/pahdwt7);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW7>0 ){
  i=312;
  }else{
  i=317;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW7!=-1 && t2h1dwt7 > 0 && t2h1dwt7 < t1 
  && t2h1dwt7 < t2w1r && t2h1dwt7 < t2w1l && t2h1dwt7 < t2h1u && t2h1dwt7 < t2h1d && t2h1dwt7 < t2w1rwt && t2h1dwt7 < t2w1lwt && t2h1dwt7 < t2h1uwt && t2h1dwt7 < t2h1dwt 
  && t2h1dwt7 < t2w1r1 && t2h1dwt7 < t2w1l1 && t2h1dwt7 < t2h1u1 && t2h1dwt7 < t2h1d1 && t2h1dwt7 < t2w1rwt1 && t2h1dwt7 < t2w1lwt1 && t2h1dwt7 < t2h1uwt1 && t2h1dwt7 < t2h1dwt1
  && t2h1dwt7 < t2w1r2 && t2h1dwt7 < t2w1l2 && t2h1dwt7 < t2h1u2 && t2h1dwt7 < t2h1d2 && t2h1dwt7 < t2w1rwt2 && t2h1dwt7 < t2w1lwt2 && t2h1dwt7 < t2h1uwt2 && t2h1dwt7 < t2h1dwt2 
  && t2h1dwt7 < t2w1r3 && t2h1dwt7 < t2w1l3 && t2h1dwt7 < t2h1u3 && t2h1dwt7 < t2h1d3 && t2h1dwt7 < t2w1rwt3 && t2h1dwt7 < t2w1lwt3 && t2h1dwt7 < t2h1uwt3 && t2h1dwt7 < t2h1dwt3
  && t2h1dwt7 < t2w1r4 && t2h1dwt7 < t2w1l4 && t2h1dwt7 < t2h1u4 && t2h1dwt7 < t2h1d4 && t2h1dwt7 < t2w1rwt4 && t2h1dwt7 < t2w1lwt4 && t2h1dwt7 < t2h1uwt4 && t2h1dwt7 < t2h1dwt4
  && t2h1dwt7 < t2w1r5 && t2h1dwt7 < t2w1l5 && t2h1dwt7 < t2h1u5 && t2h1dwt7 < t2h1d5 && t2h1dwt7 < t2w1rwt5 && t2h1dwt7 < t2w1lwt5 && t2h1dwt7 < t2h1uwt5 && t2h1dwt7 < t2h1dwt5
  && t2h1dwt7 < t2w1r6 && t2h1dwt7 < t2w1l6 && t2h1dwt7 < t2h1u6 && t2h1dwt7 < t2h1d6 && t2h1dwt7 < t2w1rwt6 && t2h1dwt7 < t2w1lwt6 && t2h1dwt7 < t2h1uwt6 && t2h1dwt7 < t2h1dwt6
  && t2h1dwt7 < t2w1r7 && t2h1dwt7 < t2w1l7 && t2h1dwt7 < t2h1u7 && t2h1dwt7 < t2h1d7 && t2h1dwt7 < t2w1rwt7 && t2h1dwt7 < t2w1lwt7 && t2h1dwt7 < t2h1uwt7 
  && t2h1dwt7 < t2w1r8 && t2h1dwt7 < t2w1l8 && t2h1dwt7 < t2h1u8 && t2h1dwt7 < t2h1d8 && t2h1dwt7 < t2w1rwt8 && t2h1dwt7 < t2w1lwt8 && t2h1dwt7 < t2h1uwt8 && t2h1dwt7 < t2h1dwt8
  && t2h1dwt7 < t2w1r9 && t2h1dwt7 < t2w1l9 && t2h1dwt7 < t2h1u9 && t2h1dwt7 < t2h1d9 && t2h1dwt7 < t2w1rwt9 && t2h1dwt7 < t2w1lwt9 && t2h1dwt7 < t2h1uwt9 && t2h1dwt7 < t2h1dwt9 
  && t2h1dwt7 < t2w1r10 && t2h1dwt7 < t2w1l10 && t2h1dwt7 < t2h1u10 && t2h1dwt7 < t2h1d10 && t2h1dwt7 < t2w1rwt10 && t2h1dwt7 < t2w1lwt10 && t2h1dwt7 < t2h1uwt10 && t2h1dwt7 < t2h1dwt10
  && (louthd7 == 0 && linhd7 == 0)){
  if(linwr7==0 && loutwr7==0)
  {
    xlimitr=(-w2r7+w1r7)/l*(vz*t2h1dwt7+z)-w1rwt7;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xlimitr=-bwrwt7*sqrt(1-((z0wr7+(vz*t2h1dwt7+z))*(z0wr7+(vz*t2h1dwt7+z)))/a2wrwt7);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt7+z)-pbwrwt7)/-pawrwt7);
    }
  }
  if(linwl7==0 && loutwl7 == 0)
   {
      xlimitl=(w2l7-w1l7)/l*(vz*t2h1dwt7+z)+w1lwt7;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xlimitl=bwlwt7*sqrt(1-((z0wl7+(vz*t2h1dwt7+z))*(z0wl7+(vz*t2h1dwt7+z)))/a2wlwt7);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt7+z)-pbwlwt7)/-pawlwt7);
      }
   }
  xtest=vx*t2h1dwt7+x;
  ytest=vy*t2w1lwt7+y;
  ylimitd=(-h2d7+h1d7)*(vz*t2h1dwt7+z)/l-h1dwt7;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW7>0 ){
  i=313;
  }else{
  i=317;
  }
  }


  if (mxrOW7==-1 && t2w1rwt7 > 0 && t2w1rwt7 < t1 
  && t2w1rwt7 < t2w1r && t2w1rwt7 < t2w1l && t2w1rwt7 < t2h1u && t2w1rwt7 < t2h1d && t2w1rwt7 <t2w1rwt && t2w1rwt7 <t2w1lwt && t2w1rwt7 < t2h1uwt && t2w1rwt7 < t2h1dwt
  && t2w1rwt7 < t2w1r1 && t2w1rwt7 < t2w1l1 && t2w1rwt7 < t2h1u1 && t2w1rwt7 < t2h1d1 && t2w1rwt7 <t2w1rwt1 && t2w1rwt7 <t2w1lwt1 && t2w1rwt7 < t2h1uwt1 && t2w1rwt7 < t2h1dwt1
  && t2w1rwt7 < t2w1r2 && t2w1rwt7 < t2w1l2 && t2w1rwt7 < t2h1u2 && t2w1rwt7 < t2h1d2 && t2w1rwt7 <t2w1rwt2 && t2w1rwt7 <t2w1lwt2 && t2w1rwt7 < t2h1uwt2 && t2w1rwt7 < t2h1dwt2
  && t2w1rwt7 < t2w1r3 && t2w1rwt7 < t2w1l3 && t2w1rwt7 < t2h1u3 && t2w1rwt7 < t2h1d3 && t2w1rwt7 <t2w1rwt3 && t2w1rwt7 <t2w1lwt3 && t2w1rwt7 < t2h1uwt3 && t2w1rwt7 < t2h1dwt3
  && t2w1rwt7 < t2w1r4 && t2w1rwt7 < t2w1l4 && t2w1rwt7 < t2h1u4 && t2w1rwt7 < t2h1d4 && t2w1rwt7 <t2w1rwt4 && t2w1rwt7 <t2w1lwt4 && t2w1rwt7 < t2h1uwt4 && t2w1rwt7 < t2h1dwt4
  && t2w1rwt7 < t2w1r5 && t2w1rwt7 < t2w1l5 && t2w1rwt7 < t2h1u5 && t2w1rwt7 < t2h1d5 && t2w1rwt7 <t2w1rwt5 && t2w1rwt7 <t2w1lwt5 && t2w1rwt7 < t2h1uwt5 && t2w1rwt7 < t2h1dwt5
  && t2w1rwt7 < t2w1r6 && t2w1rwt7 < t2w1l6 && t2w1rwt7 < t2h1u6 && t2w1rwt7 < t2h1d6 && t2w1rwt7 <t2w1rwt6 && t2w1rwt7 <t2w1lwt6 && t2w1rwt7 < t2h1uwt6 && t2w1rwt7 < t2h1dwt6
  && t2w1rwt7 < t2w1r7 && t2w1rwt7 < t2w1l7 && t2w1rwt7 < t2h1u7 && t2w1rwt7 < t2h1d7 && t2w1rwt7 <t2w1lwt7 && t2w1rwt7 < t2h1uwt7 && t2w1rwt7 < t2h1dwt7
  && t2w1rwt7 < t2w1r8 && t2w1rwt7 < t2w1l8 && t2w1rwt7 < t2h1u8 && t2w1rwt7 < t2h1d8 && t2w1rwt7 <t2w1rwt8 && t2w1rwt7 <t2w1lwt8 && t2w1rwt7 < t2h1uwt8 && t2w1rwt7 < t2h1dwt8
  && t2w1rwt7 < t2w1r9 && t2w1rwt7 < t2w1l9 && t2w1rwt7 < t2h1u9 && t2w1rwt7 < t2h1d9 && t2w1rwt7 <t2w1rwt9 && t2w1rwt7 <t2w1lwt9 && t2w1rwt7 < t2h1uwt9 && t2w1rwt7 < t2h1dwt9
  && t2w1rwt7 < t2w1r10 && t2w1rwt7 < t2w1l10 && t2w1rwt7 < t2h1u10 && t2w1rwt7 < t2h1d10 && t2w1rwt7 <t2w1rwt10 && t2w1rwt7 <t2w1lwt10 && t2w1rwt7 < t2h1uwt10 && t2w1rwt7 < t2h1dwt10
  && ((linwr7!=0) && (loutwr7!=0) )){
  i=318;
  }

  if (mxrOW7==-1 && t2w1rwt7 > 0 && t2w1rwt7 < t1 
  && t2w1rwt7 < t2w1r && t2w1rwt7 < t2w1l && t2w1rwt7 < t2h1u && t2w1rwt7 < t2h1d && t2w1rwt7 <t2w1rwt && t2w1rwt7 <t2w1lwt && t2w1rwt7 < t2h1uwt && t2w1rwt7 < t2h1dwt
  && t2w1rwt7 < t2w1r1 && t2w1rwt7 < t2w1l1 && t2w1rwt7 < t2h1u1 && t2w1rwt7 < t2h1d1 && t2w1rwt7 <t2w1rwt1 && t2w1rwt7 <t2w1lwt1 && t2w1rwt7 < t2h1uwt1 && t2w1rwt7 < t2h1dwt1
  && t2w1rwt7 < t2w1r2 && t2w1rwt7 < t2w1l2 && t2w1rwt7 < t2h1u2 && t2w1rwt7 < t2h1d2 && t2w1rwt7 <t2w1rwt2 && t2w1rwt7 <t2w1lwt2 && t2w1rwt7 < t2h1uwt2 && t2w1rwt7 < t2h1dwt2
  && t2w1rwt7 < t2w1r3 && t2w1rwt7 < t2w1l3 && t2w1rwt7 < t2h1u3 && t2w1rwt7 < t2h1d3 && t2w1rwt7 <t2w1rwt3 && t2w1rwt7 <t2w1lwt3 && t2w1rwt7 < t2h1uwt3 && t2w1rwt7 < t2h1dwt3
  && t2w1rwt7 < t2w1r4 && t2w1rwt7 < t2w1l4 && t2w1rwt7 < t2h1u4 && t2w1rwt7 < t2h1d4 && t2w1rwt7 <t2w1rwt4 && t2w1rwt7 <t2w1lwt4 && t2w1rwt7 < t2h1uwt4 && t2w1rwt7 < t2h1dwt4
  && t2w1rwt7 < t2w1r5 && t2w1rwt7 < t2w1l5 && t2w1rwt7 < t2h1u5 && t2w1rwt7 < t2h1d5 && t2w1rwt7 <t2w1rwt5 && t2w1rwt7 <t2w1lwt5 && t2w1rwt7 < t2h1uwt5 && t2w1rwt7 < t2h1dwt5
  && t2w1rwt7 < t2w1r6 && t2w1rwt7 < t2w1l6 && t2w1rwt7 < t2h1u6 && t2w1rwt7 < t2h1d6 && t2w1rwt7 <t2w1rwt6 && t2w1rwt7 <t2w1lwt6 && t2w1rwt7 < t2h1uwt6 && t2w1rwt7 < t2h1dwt6
  && t2w1rwt7 < t2w1r7 && t2w1rwt7 < t2w1l7 && t2w1rwt7 < t2h1u7 && t2w1rwt7 < t2h1d7 && t2w1rwt7 <t2w1lwt7 && t2w1rwt7 < t2h1uwt7 && t2w1rwt7 < t2h1dwt7
  && t2w1rwt7 < t2w1r8 && t2w1rwt7 < t2w1l8 && t2w1rwt7 < t2h1u8 && t2w1rwt7 < t2h1d8 && t2w1rwt7 <t2w1rwt8 && t2w1rwt7 <t2w1lwt8 && t2w1rwt7 < t2h1uwt8 && t2w1rwt7 < t2h1dwt8
  && t2w1rwt7 < t2w1r9 && t2w1rwt7 < t2w1l9 && t2w1rwt7 < t2h1u9 && t2w1rwt7 < t2h1d9 && t2w1rwt7 <t2w1rwt9 && t2w1rwt7 <t2w1lwt9 && t2w1rwt7 < t2h1uwt9 && t2w1rwt7 < t2h1dwt9
  && t2w1rwt7 < t2w1r10 && t2w1rwt7 < t2w1l10 && t2w1rwt7 < t2h1u10 && t2w1rwt7 < t2h1d10 && t2w1rwt7 <t2w1rwt10 && t2w1rwt7 <t2w1lwt10 && t2w1rwt7 < t2h1uwt10 && t2w1rwt7 < t2h1dwt10
  && ((loutwr7!=0 && linwr7==0) || (loutwr7==0 && linwr7!=0))){
  i=318;
  }

  if (mxrOW7==-1 && t2w1rwt7 > 0 && t2w1rwt7 < t1 
  && t2w1rwt7 < t2w1r && t2w1rwt7 < t2w1l && t2w1rwt7 < t2h1u && t2w1rwt7 < t2h1d && t2w1rwt7 <t2w1rwt && t2w1rwt7 <t2w1lwt && t2w1rwt7 < t2h1uwt && t2w1rwt7 < t2h1dwt
  && t2w1rwt7 < t2w1r1 && t2w1rwt7 < t2w1l1 && t2w1rwt7 < t2h1u1 && t2w1rwt7 < t2h1d1 && t2w1rwt7 <t2w1rwt1 && t2w1rwt7 <t2w1lwt1 && t2w1rwt7 < t2h1uwt1 && t2w1rwt7 < t2h1dwt1
  && t2w1rwt7 < t2w1r2 && t2w1rwt7 < t2w1l2 && t2w1rwt7 < t2h1u2 && t2w1rwt7 < t2h1d2 && t2w1rwt7 <t2w1rwt2 && t2w1rwt7 <t2w1lwt2 && t2w1rwt7 < t2h1uwt2 && t2w1rwt7 < t2h1dwt2
  && t2w1rwt7 < t2w1r3 && t2w1rwt7 < t2w1l3 && t2w1rwt7 < t2h1u3 && t2w1rwt7 < t2h1d3 && t2w1rwt7 <t2w1rwt3 && t2w1rwt7 <t2w1lwt3 && t2w1rwt7 < t2h1uwt3 && t2w1rwt7 < t2h1dwt3
  && t2w1rwt7 < t2w1r4 && t2w1rwt7 < t2w1l4 && t2w1rwt7 < t2h1u4 && t2w1rwt7 < t2h1d4 && t2w1rwt7 <t2w1rwt4 && t2w1rwt7 <t2w1lwt4 && t2w1rwt7 < t2h1uwt4 && t2w1rwt7 < t2h1dwt4
  && t2w1rwt7 < t2w1r5 && t2w1rwt7 < t2w1l5 && t2w1rwt7 < t2h1u5 && t2w1rwt7 < t2h1d5 && t2w1rwt7 <t2w1rwt5 && t2w1rwt7 <t2w1lwt5 && t2w1rwt7 < t2h1uwt5 && t2w1rwt7 < t2h1dwt5
  && t2w1rwt7 < t2w1r6 && t2w1rwt7 < t2w1l6 && t2w1rwt7 < t2h1u6 && t2w1rwt7 < t2h1d6 && t2w1rwt7 <t2w1rwt6 && t2w1rwt7 <t2w1lwt6 && t2w1rwt7 < t2h1uwt6 && t2w1rwt7 < t2h1dwt6
  && t2w1rwt7 < t2w1r7 && t2w1rwt7 < t2w1l7 && t2w1rwt7 < t2h1u7 && t2w1rwt7 < t2h1d7 && t2w1rwt7 <t2w1lwt7 && t2w1rwt7 < t2h1uwt7 && t2w1rwt7 < t2h1dwt7
  && t2w1rwt7 < t2w1r8 && t2w1rwt7 < t2w1l8 && t2w1rwt7 < t2h1u8 && t2w1rwt7 < t2h1d8 && t2w1rwt7 <t2w1rwt8 && t2w1rwt7 <t2w1lwt8 && t2w1rwt7 < t2h1uwt8 && t2w1rwt7 < t2h1dwt8
  && t2w1rwt7 < t2w1r9 && t2w1rwt7 < t2w1l9 && t2w1rwt7 < t2h1u9 && t2w1rwt7 < t2h1d9 && t2w1rwt7 <t2w1rwt9 && t2w1rwt7 <t2w1lwt9 && t2w1rwt7 < t2h1uwt9 && t2w1rwt7 < t2h1dwt9
  && t2w1rwt7 < t2w1r10 && t2w1rwt7 < t2w1l10 && t2w1rwt7 < t2h1u10 && t2w1rwt7 < t2h1d10 && t2w1rwt7 <t2w1rwt10 && t2w1rwt7 <t2w1lwt10 && t2w1rwt7 < t2h1uwt10 && t2w1rwt7 < t2h1dwt10
  && (loutwr7==0 && linwr7==0)){
  i=318;
  }

  if (mxlOW7==-1 && t2w1lwt7 > 0 && t2w1lwt7 < t1 
  && t2w1lwt7 < t2w1r && t2w1lwt7 < t2w1l && t2w1lwt7 < t2h1u && t2w1lwt7 < t2h1d && t2w1lwt7 <t2w1rwt && t2w1lwt7 <t2w1lwt && t2w1lwt7 < t2h1uwt && t2w1lwt7 < t2h1dwt
  && t2w1lwt7 < t2w1r1 && t2w1lwt7 < t2w1l1 && t2w1lwt7 < t2h1u1 && t2w1lwt7 < t2h1d1 && t2w1lwt7 <t2w1rwt1 && t2w1lwt7 <t2w1lwt1 && t2w1lwt7 < t2h1uwt1 && t2w1lwt7 < t2h1dwt1
  && t2w1lwt7 < t2w1r2 && t2w1lwt7 < t2w1l2 && t2w1lwt7 < t2h1u2 && t2w1lwt7 < t2h1d2 && t2w1lwt7 <t2w1rwt2 && t2w1lwt7 <t2w1lwt2 && t2w1lwt7 < t2h1uwt2 && t2w1lwt7 < t2h1dwt2
  && t2w1lwt7 < t2w1r3 && t2w1lwt7 < t2w1l3 && t2w1lwt7 < t2h1u3 && t2w1lwt7 < t2h1d3 && t2w1lwt7 <t2w1rwt3 && t2w1lwt7 <t2w1lwt3 && t2w1lwt7 < t2h1uwt3 && t2w1lwt7 < t2h1dwt3
  && t2w1lwt7 < t2w1r4 && t2w1lwt7 < t2w1l4 && t2w1lwt7 < t2h1u4 && t2w1lwt7 < t2h1d4 && t2w1lwt7 <t2w1rwt4 && t2w1lwt7 <t2w1lwt4 && t2w1lwt7 < t2h1uwt4 && t2w1lwt7 < t2h1dwt4
  && t2w1lwt7 < t2w1r5 && t2w1lwt7 < t2w1l5 && t2w1lwt7 < t2h1u5 && t2w1lwt7 < t2h1d5 && t2w1lwt7 <t2w1rwt5 && t2w1lwt7 <t2w1lwt5 && t2w1lwt7 < t2h1uwt5 && t2w1lwt7 < t2h1dwt5
  && t2w1lwt7 < t2w1r6 && t2w1lwt7 < t2w1l6 && t2w1lwt7 < t2h1u6 && t2w1lwt7 < t2h1d6 && t2w1lwt7 <t2w1rwt6 && t2w1lwt7 <t2w1lwt6 && t2w1lwt7 < t2h1uwt6 && t2w1lwt7 < t2h1dwt6
  && t2w1lwt7 < t2w1r7 && t2w1lwt7 < t2w1l7 && t2w1lwt7 < t2h1u7 && t2w1lwt7 < t2h1d7 && t2w1lwt7 <t2w1rwt7 && t2w1lwt7 < t2h1uwt7 && t2w1lwt7 < t2h1dwt7
  && t2w1lwt7 < t2w1r8 && t2w1lwt7 < t2w1l8 && t2w1lwt7 < t2h1u8 && t2w1lwt7 < t2h1d8 && t2w1lwt7 <t2w1rwt8 && t2w1lwt7 <t2w1lwt8 && t2w1lwt7 < t2h1uwt8 && t2w1lwt7 < t2h1dwt8
  && t2w1lwt7 < t2w1r9 && t2w1lwt7 < t2w1l9 && t2w1lwt7 < t2h1u9 && t2w1lwt7 < t2h1d9 && t2w1lwt7 <t2w1rwt9 && t2w1lwt7 <t2w1lwt9 && t2w1lwt7 < t2h1uwt9 && t2w1lwt7 < t2h1dwt9
  && t2w1lwt7 < t2w1r10 && t2w1lwt7 < t2w1l10 && t2w1lwt7 < t2h1u10 && t2w1lwt7 < t2h1d10 && t2w1lwt7 <t2w1rwt10 && t2w1lwt7 <t2w1lwt10 && t2w1lwt7 < t2h1uwt10 && t2w1lwt7 < t2h1dwt10
  && ((linwl7!=0) && (loutwl7!=0) )){
  i=319;
  }

  if (mxlOW7==-1 && t2w1lwt7 > 0 && t2w1lwt7 < t1 
  && t2w1lwt7 < t2w1r && t2w1lwt7 < t2w1l && t2w1lwt7 < t2h1u && t2w1lwt7 < t2h1d && t2w1lwt7 <t2w1rwt && t2w1lwt7 <t2w1lwt && t2w1lwt7 < t2h1uwt && t2w1lwt7 < t2h1dwt
  && t2w1lwt7 < t2w1r1 && t2w1lwt7 < t2w1l1 && t2w1lwt7 < t2h1u1 && t2w1lwt7 < t2h1d1 && t2w1lwt7 <t2w1rwt1 && t2w1lwt7 <t2w1lwt1 && t2w1lwt7 < t2h1uwt1 && t2w1lwt7 < t2h1dwt1
  && t2w1lwt7 < t2w1r2 && t2w1lwt7 < t2w1l2 && t2w1lwt7 < t2h1u2 && t2w1lwt7 < t2h1d2 && t2w1lwt7 <t2w1rwt2 && t2w1lwt7 <t2w1lwt2 && t2w1lwt7 < t2h1uwt2 && t2w1lwt7 < t2h1dwt2
  && t2w1lwt7 < t2w1r3 && t2w1lwt7 < t2w1l3 && t2w1lwt7 < t2h1u3 && t2w1lwt7 < t2h1d3 && t2w1lwt7 <t2w1rwt3 && t2w1lwt7 <t2w1lwt3 && t2w1lwt7 < t2h1uwt3 && t2w1lwt7 < t2h1dwt3
  && t2w1lwt7 < t2w1r4 && t2w1lwt7 < t2w1l4 && t2w1lwt7 < t2h1u4 && t2w1lwt7 < t2h1d4 && t2w1lwt7 <t2w1rwt4 && t2w1lwt7 <t2w1lwt4 && t2w1lwt7 < t2h1uwt4 && t2w1lwt7 < t2h1dwt4
  && t2w1lwt7 < t2w1r5 && t2w1lwt7 < t2w1l5 && t2w1lwt7 < t2h1u5 && t2w1lwt7 < t2h1d5 && t2w1lwt7 <t2w1rwt5 && t2w1lwt7 <t2w1lwt5 && t2w1lwt7 < t2h1uwt5 && t2w1lwt7 < t2h1dwt5
  && t2w1lwt7 < t2w1r6 && t2w1lwt7 < t2w1l6 && t2w1lwt7 < t2h1u6 && t2w1lwt7 < t2h1d6 && t2w1lwt7 <t2w1rwt6 && t2w1lwt7 <t2w1lwt6 && t2w1lwt7 < t2h1uwt6 && t2w1lwt7 < t2h1dwt6
  && t2w1lwt7 < t2w1r7 && t2w1lwt7 < t2w1l7 && t2w1lwt7 < t2h1u7 && t2w1lwt7 < t2h1d7 && t2w1lwt7 <t2w1rwt7 && t2w1lwt7 < t2h1uwt7 && t2w1lwt7 < t2h1dwt7
  && t2w1lwt7 < t2w1r8 && t2w1lwt7 < t2w1l8 && t2w1lwt7 < t2h1u8 && t2w1lwt7 < t2h1d8 && t2w1lwt7 <t2w1rwt8 && t2w1lwt7 <t2w1lwt8 && t2w1lwt7 < t2h1uwt8 && t2w1lwt7 < t2h1dwt8
  && t2w1lwt7 < t2w1r9 && t2w1lwt7 < t2w1l9 && t2w1lwt7 < t2h1u9 && t2w1lwt7 < t2h1d9 && t2w1lwt7 <t2w1rwt9 && t2w1lwt7 <t2w1lwt9 && t2w1lwt7 < t2h1uwt9 && t2w1lwt7 < t2h1dwt9
  && t2w1lwt7 < t2w1r10 && t2w1lwt7 < t2w1l10 && t2w1lwt7 < t2h1u10 && t2w1lwt7 < t2h1d10 && t2w1lwt7 <t2w1rwt10 && t2w1lwt7 <t2w1lwt10 && t2w1lwt7 < t2h1uwt10 && t2w1lwt7 < t2h1dwt10
  && ((loutwl7!=0 && linwl7==0) || (loutwl7==0 && linwl7!=0))){
  i=319;
  }

  if (mxlOW7==-1 && t2w1lwt7 > 0 && t2w1lwt7 < t1 
  && t2w1lwt7 < t2w1r && t2w1lwt7 < t2w1l && t2w1lwt7 < t2h1u && t2w1lwt7 < t2h1d && t2w1lwt7 <t2w1rwt && t2w1lwt7 <t2w1lwt && t2w1lwt7 < t2h1uwt && t2w1lwt7 < t2h1dwt
  && t2w1lwt7 < t2w1r1 && t2w1lwt7 < t2w1l1 && t2w1lwt7 < t2h1u1 && t2w1lwt7 < t2h1d1 && t2w1lwt7 <t2w1rwt1 && t2w1lwt7 <t2w1lwt1 && t2w1lwt7 < t2h1uwt1 && t2w1lwt7 < t2h1dwt1
  && t2w1lwt7 < t2w1r2 && t2w1lwt7 < t2w1l2 && t2w1lwt7 < t2h1u2 && t2w1lwt7 < t2h1d2 && t2w1lwt7 <t2w1rwt2 && t2w1lwt7 <t2w1lwt2 && t2w1lwt7 < t2h1uwt2 && t2w1lwt7 < t2h1dwt2
  && t2w1lwt7 < t2w1r3 && t2w1lwt7 < t2w1l3 && t2w1lwt7 < t2h1u3 && t2w1lwt7 < t2h1d3 && t2w1lwt7 <t2w1rwt3 && t2w1lwt7 <t2w1lwt3 && t2w1lwt7 < t2h1uwt3 && t2w1lwt7 < t2h1dwt3
  && t2w1lwt7 < t2w1r4 && t2w1lwt7 < t2w1l4 && t2w1lwt7 < t2h1u4 && t2w1lwt7 < t2h1d4 && t2w1lwt7 <t2w1rwt4 && t2w1lwt7 <t2w1lwt4 && t2w1lwt7 < t2h1uwt4 && t2w1lwt7 < t2h1dwt4
  && t2w1lwt7 < t2w1r5 && t2w1lwt7 < t2w1l5 && t2w1lwt7 < t2h1u5 && t2w1lwt7 < t2h1d5 && t2w1lwt7 <t2w1rwt5 && t2w1lwt7 <t2w1lwt5 && t2w1lwt7 < t2h1uwt5 && t2w1lwt7 < t2h1dwt5
  && t2w1lwt7 < t2w1r6 && t2w1lwt7 < t2w1l6 && t2w1lwt7 < t2h1u6 && t2w1lwt7 < t2h1d6 && t2w1lwt7 <t2w1rwt6 && t2w1lwt7 <t2w1lwt6 && t2w1lwt7 < t2h1uwt6 && t2w1lwt7 < t2h1dwt6
  && t2w1lwt7 < t2w1r7 && t2w1lwt7 < t2w1l7 && t2w1lwt7 < t2h1u7 && t2w1lwt7 < t2h1d7 && t2w1lwt7 <t2w1rwt7 && t2w1lwt7 < t2h1uwt7 && t2w1lwt7 < t2h1dwt7
  && t2w1lwt7 < t2w1r8 && t2w1lwt7 < t2w1l8 && t2w1lwt7 < t2h1u8 && t2w1lwt7 < t2h1d8 && t2w1lwt7 <t2w1rwt8 && t2w1lwt7 <t2w1lwt8 && t2w1lwt7 < t2h1uwt8 && t2w1lwt7 < t2h1dwt8
  && t2w1lwt7 < t2w1r9 && t2w1lwt7 < t2w1l9 && t2w1lwt7 < t2h1u9 && t2w1lwt7 < t2h1d9 && t2w1lwt7 <t2w1rwt9 && t2w1lwt7 <t2w1lwt9 && t2w1lwt7 < t2h1uwt9 && t2w1lwt7 < t2h1dwt9
  && t2w1lwt7 < t2w1r10 && t2w1lwt7 < t2w1l10 && t2w1lwt7 < t2h1u10 && t2w1lwt7 < t2h1d10 && t2w1lwt7 <t2w1rwt10 && t2w1lwt7 <t2w1lwt10 && t2w1lwt7 < t2h1uwt10 && t2w1lwt7 < t2h1dwt10
  && (loutwl7==0 && linwl7==0)){
  i=319;}

  if (myuOW7==-1 && t2h1uwt7 > 0 && t2h1uwt7 < t1 
  && t2h1uwt7 < t2w1r && t2h1uwt7 < t2w1l && t2h1uwt7 < t2h1u && t2h1uwt7 < t2h1d && t2h1uwt7 < t2w1rwt && t2h1uwt7 < t2w1lwt && t2h1uwt7 < t2h1uwt && t2h1uwt7 < t2h1dwt 
  && t2h1uwt7 < t2w1r1 && t2h1uwt7 < t2w1l1 && t2h1uwt7 < t2h1u1 && t2h1uwt7 < t2h1d1 && t2h1uwt7 < t2w1rwt1 && t2h1uwt7 < t2w1lwt1 && t2h1uwt7 < t2h1uwt1 && t2h1uwt7 < t2h1dwt1
  && t2h1uwt7 < t2w1r2 && t2h1uwt7 < t2w1l2 && t2h1uwt7 < t2h1u2 && t2h1uwt7 < t2h1d2 && t2h1uwt7 < t2w1rwt2 && t2h1uwt7 < t2w1lwt2 && t2h1uwt7 < t2h1uwt2 && t2h1uwt7 < t2h1dwt2
  && t2h1uwt7 < t2w1r3 && t2h1uwt7 < t2w1l3 && t2h1uwt7 < t2h1u3 && t2h1uwt7 < t2h1d3 && t2h1uwt7 < t2w1rwt3 && t2h1uwt7 < t2w1lwt3 && t2h1uwt7 < t2h1uwt3 && t2h1uwt7 < t2h1dwt3
  && t2h1uwt7 < t2w1r4 && t2h1uwt7 < t2w1l4 && t2h1uwt7 < t2h1u4 && t2h1uwt7 < t2h1d4 && t2h1uwt7 < t2w1rwt4 && t2h1uwt7 < t2w1lwt4 && t2h1uwt7 < t2h1uwt4 && t2h1uwt7 < t2h1dwt4
  && t2h1uwt7 < t2w1r5 && t2h1uwt7 < t2w1l5 && t2h1uwt7 < t2h1u5 && t2h1uwt7 < t2h1d5 && t2h1uwt7 < t2w1rwt5 && t2h1uwt7 < t2w1lwt5 && t2h1uwt7 < t2h1uwt5 && t2h1uwt7 < t2h1dwt5
  && t2h1uwt7 < t2w1r6 && t2h1uwt7 < t2w1l6 && t2h1uwt7 < t2h1u6 && t2h1uwt7 < t2h1d6 && t2h1uwt7 < t2w1rwt6 && t2h1uwt7 < t2w1lwt6 && t2h1uwt7 < t2h1uwt6 && t2h1uwt7 < t2h1dwt6
  && t2h1uwt7 < t2w1r7 && t2h1uwt7 < t2w1l7 && t2h1uwt7 < t2h1u7 && t2h1uwt7 < t2h1d7 && t2h1uwt7 < t2w1rwt7 && t2h1uwt7 < t2w1lwt7 && t2h1uwt7 < t2h1dwt7
  && t2h1uwt7 < t2w1r8 && t2h1uwt7 < t2w1l8 && t2h1uwt7 < t2h1u8 && t2h1uwt7 < t2h1d8 && t2h1uwt7 < t2w1rwt8 && t2h1uwt7 < t2w1lwt8 && t2h1uwt7 < t2h1uwt8 && t2h1uwt7 < t2h1dwt8
  && t2h1uwt7 < t2w1r9 && t2h1uwt7 < t2w1l9 && t2h1uwt7 < t2h1u9 && t2h1uwt7 < t2h1d9 && t2h1uwt7 < t2w1rwt9 && t2h1uwt7 < t2w1lwt9 && t2h1uwt7 < t2h1uwt9 && t2h1uwt7 < t2h1dwt9
  && t2h1uwt7 < t2w1r10 && t2h1uwt7 < t2w1l10 && t2h1uwt7 < t2h1u10 && t2h1uwt7 < t2h1d10 && t2h1uwt7 < t2w1rwt10 && t2h1uwt7 < t2w1lwt10 && t2h1uwt7 < t2h1uwt10 && t2h1uwt7 < t2h1dwt10
  && (louthu7 !=0 && linhu7!=0)){
  i=320;
  }

  if (myuOW7==-1 && t2h1uwt7 > 0 && t2h1uwt7 < t1 
  && t2h1uwt7 < t2w1r && t2h1uwt7 < t2w1l && t2h1uwt7 < t2h1u && t2h1uwt7 < t2h1d && t2h1uwt7 < t2w1rwt && t2h1uwt7 < t2w1lwt && t2h1uwt7 < t2h1uwt && t2h1uwt7 < t2h1dwt 
  && t2h1uwt7 < t2w1r1 && t2h1uwt7 < t2w1l1 && t2h1uwt7 < t2h1u1 && t2h1uwt7 < t2h1d1 && t2h1uwt7 < t2w1rwt1 && t2h1uwt7 < t2w1lwt1 && t2h1uwt7 < t2h1uwt1 && t2h1uwt7 < t2h1dwt1
  && t2h1uwt7 < t2w1r2 && t2h1uwt7 < t2w1l2 && t2h1uwt7 < t2h1u2 && t2h1uwt7 < t2h1d2 && t2h1uwt7 < t2w1rwt2 && t2h1uwt7 < t2w1lwt2 && t2h1uwt7 < t2h1uwt2 && t2h1uwt7 < t2h1dwt2
  && t2h1uwt7 < t2w1r3 && t2h1uwt7 < t2w1l3 && t2h1uwt7 < t2h1u3 && t2h1uwt7 < t2h1d3 && t2h1uwt7 < t2w1rwt3 && t2h1uwt7 < t2w1lwt3 && t2h1uwt7 < t2h1uwt3 && t2h1uwt7 < t2h1dwt3
  && t2h1uwt7 < t2w1r4 && t2h1uwt7 < t2w1l4 && t2h1uwt7 < t2h1u4 && t2h1uwt7 < t2h1d4 && t2h1uwt7 < t2w1rwt4 && t2h1uwt7 < t2w1lwt4 && t2h1uwt7 < t2h1uwt4 && t2h1uwt7 < t2h1dwt4
  && t2h1uwt7 < t2w1r5 && t2h1uwt7 < t2w1l5 && t2h1uwt7 < t2h1u5 && t2h1uwt7 < t2h1d5 && t2h1uwt7 < t2w1rwt5 && t2h1uwt7 < t2w1lwt5 && t2h1uwt7 < t2h1uwt5 && t2h1uwt7 < t2h1dwt5
  && t2h1uwt7 < t2w1r6 && t2h1uwt7 < t2w1l6 && t2h1uwt7 < t2h1u6 && t2h1uwt7 < t2h1d6 && t2h1uwt7 < t2w1rwt6 && t2h1uwt7 < t2w1lwt6 && t2h1uwt7 < t2h1uwt6 && t2h1uwt7 < t2h1dwt6
  && t2h1uwt7 < t2w1r7 && t2h1uwt7 < t2w1l7 && t2h1uwt7 < t2h1u7 && t2h1uwt7 < t2h1d7 && t2h1uwt7 < t2w1rwt7 && t2h1uwt7 < t2w1lwt7 && t2h1uwt7 < t2h1dwt7
  && t2h1uwt7 < t2w1r8 && t2h1uwt7 < t2w1l8 && t2h1uwt7 < t2h1u8 && t2h1uwt7 < t2h1d8 && t2h1uwt7 < t2w1rwt8 && t2h1uwt7 < t2w1lwt8 && t2h1uwt7 < t2h1uwt8 && t2h1uwt7 < t2h1dwt8
  && t2h1uwt7 < t2w1r9 && t2h1uwt7 < t2w1l9 && t2h1uwt7 < t2h1u9 && t2h1uwt7 < t2h1d9 && t2h1uwt7 < t2w1rwt9 && t2h1uwt7 < t2w1lwt9 && t2h1uwt7 < t2h1uwt9 && t2h1uwt7 < t2h1dwt9
  && t2h1uwt7 < t2w1r10 && t2h1uwt7 < t2w1l10 && t2h1uwt7 < t2h1u10 && t2h1uwt7 < t2h1d10 && t2h1uwt7 < t2w1rwt10 && t2h1uwt7 < t2w1lwt10 && t2h1uwt7 < t2h1uwt10 && t2h1uwt7 < t2h1dwt10
  && ((louthu7!=0 && linhu7==0) || (louthu7==0 && linhu7!=0))){
  i=320;
  }

  if (myuOW7==-1 && t2h1uwt7 > 0 && t2h1uwt7 < t1 
  && t2h1uwt7 < t2w1r && t2h1uwt7 < t2w1l && t2h1uwt7 < t2h1u && t2h1uwt7 < t2h1d && t2h1uwt7 < t2w1rwt && t2h1uwt7 < t2w1lwt && t2h1uwt7 < t2h1uwt && t2h1uwt7 < t2h1dwt 
  && t2h1uwt7 < t2w1r1 && t2h1uwt7 < t2w1l1 && t2h1uwt7 < t2h1u1 && t2h1uwt7 < t2h1d1 && t2h1uwt7 < t2w1rwt1 && t2h1uwt7 < t2w1lwt1 && t2h1uwt7 < t2h1uwt1 && t2h1uwt7 < t2h1dwt1
  && t2h1uwt7 < t2w1r2 && t2h1uwt7 < t2w1l2 && t2h1uwt7 < t2h1u2 && t2h1uwt7 < t2h1d2 && t2h1uwt7 < t2w1rwt2 && t2h1uwt7 < t2w1lwt2 && t2h1uwt7 < t2h1uwt2 && t2h1uwt7 < t2h1dwt2
  && t2h1uwt7 < t2w1r3 && t2h1uwt7 < t2w1l3 && t2h1uwt7 < t2h1u3 && t2h1uwt7 < t2h1d3 && t2h1uwt7 < t2w1rwt3 && t2h1uwt7 < t2w1lwt3 && t2h1uwt7 < t2h1uwt3 && t2h1uwt7 < t2h1dwt3
  && t2h1uwt7 < t2w1r4 && t2h1uwt7 < t2w1l4 && t2h1uwt7 < t2h1u4 && t2h1uwt7 < t2h1d4 && t2h1uwt7 < t2w1rwt4 && t2h1uwt7 < t2w1lwt4 && t2h1uwt7 < t2h1uwt4 && t2h1uwt7 < t2h1dwt4
  && t2h1uwt7 < t2w1r5 && t2h1uwt7 < t2w1l5 && t2h1uwt7 < t2h1u5 && t2h1uwt7 < t2h1d5 && t2h1uwt7 < t2w1rwt5 && t2h1uwt7 < t2w1lwt5 && t2h1uwt7 < t2h1uwt5 && t2h1uwt7 < t2h1dwt5
  && t2h1uwt7 < t2w1r6 && t2h1uwt7 < t2w1l6 && t2h1uwt7 < t2h1u6 && t2h1uwt7 < t2h1d6 && t2h1uwt7 < t2w1rwt6 && t2h1uwt7 < t2w1lwt6 && t2h1uwt7 < t2h1uwt6 && t2h1uwt7 < t2h1dwt6
  && t2h1uwt7 < t2w1r7 && t2h1uwt7 < t2w1l7 && t2h1uwt7 < t2h1u7 && t2h1uwt7 < t2h1d7 && t2h1uwt7 < t2w1rwt7 && t2h1uwt7 < t2w1lwt7 && t2h1uwt7 < t2h1dwt7
  && t2h1uwt7 < t2w1r8 && t2h1uwt7 < t2w1l8 && t2h1uwt7 < t2h1u8 && t2h1uwt7 < t2h1d8 && t2h1uwt7 < t2w1rwt8 && t2h1uwt7 < t2w1lwt8 && t2h1uwt7 < t2h1uwt8 && t2h1uwt7 < t2h1dwt8
  && t2h1uwt7 < t2w1r9 && t2h1uwt7 < t2w1l9 && t2h1uwt7 < t2h1u9 && t2h1uwt7 < t2h1d9 && t2h1uwt7 < t2w1rwt9 && t2h1uwt7 < t2w1lwt9 && t2h1uwt7 < t2h1uwt9 && t2h1uwt7 < t2h1dwt9
  && t2h1uwt7 < t2w1r10 && t2h1uwt7 < t2w1l10 && t2h1uwt7 < t2h1u10 && t2h1uwt7 < t2h1d10 && t2h1uwt7 < t2w1rwt10 && t2h1uwt7 < t2w1lwt10 && t2h1uwt7 < t2h1uwt10 && t2h1uwt7 < t2h1dwt10
  && (louthu7 == 0 && linhu7 == 0)){
  i=320;
  }

  if (mydOW7==-1 && t2h1dwt7 > 0 && t2h1dwt7 < t1 
  && t2h1dwt7 < t2w1r && t2h1dwt7 < t2w1l && t2h1dwt7 < t2h1u && t2h1dwt7 < t2h1d && t2h1dwt7 < t2w1rwt && t2h1dwt7 < t2w1lwt && t2h1dwt7 < t2h1uwt && t2h1dwt7 < t2h1dwt 
  && t2h1dwt7 < t2w1r1 && t2h1dwt7 < t2w1l1 && t2h1dwt7 < t2h1u1 && t2h1dwt7 < t2h1d1 && t2h1dwt7 < t2w1rwt1 && t2h1dwt7 < t2w1lwt1 && t2h1dwt7 < t2h1uwt1 && t2h1dwt7 < t2h1dwt1
  && t2h1dwt7 < t2w1r2 && t2h1dwt7 < t2w1l2 && t2h1dwt7 < t2h1u2 && t2h1dwt7 < t2h1d2 && t2h1dwt7 < t2w1rwt2 && t2h1dwt7 < t2w1lwt2 && t2h1dwt7 < t2h1uwt2 && t2h1dwt7 < t2h1dwt2 
  && t2h1dwt7 < t2w1r3 && t2h1dwt7 < t2w1l3 && t2h1dwt7 < t2h1u3 && t2h1dwt7 < t2h1d3 && t2h1dwt7 < t2w1rwt3 && t2h1dwt7 < t2w1lwt3 && t2h1dwt7 < t2h1uwt3 && t2h1dwt7 < t2h1dwt3
  && t2h1dwt7 < t2w1r4 && t2h1dwt7 < t2w1l4 && t2h1dwt7 < t2h1u4 && t2h1dwt7 < t2h1d4 && t2h1dwt7 < t2w1rwt4 && t2h1dwt7 < t2w1lwt4 && t2h1dwt7 < t2h1uwt4 && t2h1dwt7 < t2h1dwt4
  && t2h1dwt7 < t2w1r5 && t2h1dwt7 < t2w1l5 && t2h1dwt7 < t2h1u5 && t2h1dwt7 < t2h1d5 && t2h1dwt7 < t2w1rwt5 && t2h1dwt7 < t2w1lwt5 && t2h1dwt7 < t2h1uwt5 && t2h1dwt7 < t2h1dwt5
  && t2h1dwt7 < t2w1r6 && t2h1dwt7 < t2w1l6 && t2h1dwt7 < t2h1u6 && t2h1dwt7 < t2h1d6 && t2h1dwt7 < t2w1rwt6 && t2h1dwt7 < t2w1lwt6 && t2h1dwt7 < t2h1uwt6 && t2h1dwt7 < t2h1dwt6
  && t2h1dwt7 < t2w1r7 && t2h1dwt7 < t2w1l7 && t2h1dwt7 < t2h1u7 && t2h1dwt7 < t2h1d7 && t2h1dwt7 < t2w1rwt7 && t2h1dwt7 < t2w1lwt7 && t2h1dwt7 < t2h1uwt7 
  && t2h1dwt7 < t2w1r8 && t2h1dwt7 < t2w1l8 && t2h1dwt7 < t2h1u8 && t2h1dwt7 < t2h1d8 && t2h1dwt7 < t2w1rwt8 && t2h1dwt7 < t2w1lwt8 && t2h1dwt7 < t2h1uwt8 && t2h1dwt7 < t2h1dwt8
  && t2h1dwt7 < t2w1r9 && t2h1dwt7 < t2w1l9 && t2h1dwt7 < t2h1u9 && t2h1dwt7 < t2h1d9 && t2h1dwt7 < t2w1rwt9 && t2h1dwt7 < t2w1lwt9 && t2h1dwt7 < t2h1uwt9 && t2h1dwt7 < t2h1dwt9 
  && t2h1dwt7 < t2w1r10 && t2h1dwt7 < t2w1l10 && t2h1dwt7 < t2h1u10 && t2h1dwt7 < t2h1d10 && t2h1dwt7 < t2w1rwt10 && t2h1dwt7 < t2w1lwt10 && t2h1dwt7 < t2h1uwt10 && t2h1dwt7 < t2h1dwt10  
  && (louthd7 !=0 && linhd7!=0)){
  i=321;
  }

  if (mydOW7==-1 && t2h1dwt7 > 0 && t2h1dwt7 < t1 
  && t2h1dwt7 < t2w1r && t2h1dwt7 < t2w1l && t2h1dwt7 < t2h1u && t2h1dwt7 < t2h1d && t2h1dwt7 < t2w1rwt && t2h1dwt7 < t2w1lwt && t2h1dwt7 < t2h1uwt && t2h1dwt7 < t2h1dwt 
  && t2h1dwt7 < t2w1r1 && t2h1dwt7 < t2w1l1 && t2h1dwt7 < t2h1u1 && t2h1dwt7 < t2h1d1 && t2h1dwt7 < t2w1rwt1 && t2h1dwt7 < t2w1lwt1 && t2h1dwt7 < t2h1uwt1 && t2h1dwt7 < t2h1dwt1
  && t2h1dwt7 < t2w1r2 && t2h1dwt7 < t2w1l2 && t2h1dwt7 < t2h1u2 && t2h1dwt7 < t2h1d2 && t2h1dwt7 < t2w1rwt2 && t2h1dwt7 < t2w1lwt2 && t2h1dwt7 < t2h1uwt2 && t2h1dwt7 < t2h1dwt2 
  && t2h1dwt7 < t2w1r3 && t2h1dwt7 < t2w1l3 && t2h1dwt7 < t2h1u3 && t2h1dwt7 < t2h1d3 && t2h1dwt7 < t2w1rwt3 && t2h1dwt7 < t2w1lwt3 && t2h1dwt7 < t2h1uwt3 && t2h1dwt7 < t2h1dwt3
  && t2h1dwt7 < t2w1r4 && t2h1dwt7 < t2w1l4 && t2h1dwt7 < t2h1u4 && t2h1dwt7 < t2h1d4 && t2h1dwt7 < t2w1rwt4 && t2h1dwt7 < t2w1lwt4 && t2h1dwt7 < t2h1uwt4 && t2h1dwt7 < t2h1dwt4
  && t2h1dwt7 < t2w1r5 && t2h1dwt7 < t2w1l5 && t2h1dwt7 < t2h1u5 && t2h1dwt7 < t2h1d5 && t2h1dwt7 < t2w1rwt5 && t2h1dwt7 < t2w1lwt5 && t2h1dwt7 < t2h1uwt5 && t2h1dwt7 < t2h1dwt5
  && t2h1dwt7 < t2w1r6 && t2h1dwt7 < t2w1l6 && t2h1dwt7 < t2h1u6 && t2h1dwt7 < t2h1d6 && t2h1dwt7 < t2w1rwt6 && t2h1dwt7 < t2w1lwt6 && t2h1dwt7 < t2h1uwt6 && t2h1dwt7 < t2h1dwt6
  && t2h1dwt7 < t2w1r7 && t2h1dwt7 < t2w1l7 && t2h1dwt7 < t2h1u7 && t2h1dwt7 < t2h1d7 && t2h1dwt7 < t2w1rwt7 && t2h1dwt7 < t2w1lwt7 && t2h1dwt7 < t2h1uwt7 
  && t2h1dwt7 < t2w1r8 && t2h1dwt7 < t2w1l8 && t2h1dwt7 < t2h1u8 && t2h1dwt7 < t2h1d8 && t2h1dwt7 < t2w1rwt8 && t2h1dwt7 < t2w1lwt8 && t2h1dwt7 < t2h1uwt8 && t2h1dwt7 < t2h1dwt8
  && t2h1dwt7 < t2w1r9 && t2h1dwt7 < t2w1l9 && t2h1dwt7 < t2h1u9 && t2h1dwt7 < t2h1d9 && t2h1dwt7 < t2w1rwt9 && t2h1dwt7 < t2w1lwt9 && t2h1dwt7 < t2h1uwt9 && t2h1dwt7 < t2h1dwt9 
  && t2h1dwt7 < t2w1r10 && t2h1dwt7 < t2w1l10 && t2h1dwt7 < t2h1u10 && t2h1dwt7 < t2h1d10 && t2h1dwt7 < t2w1rwt10 && t2h1dwt7 < t2w1lwt10 && t2h1dwt7 < t2h1uwt10 && t2h1dwt7 < t2h1dwt10
  && ((louthd7 !=0 && linhd7==0) || (louthd7 ==0 && linhd7!=0))){
  i=321;
  }

  if (mydOW7==-1 && t2h1dwt7 > 0 && t2h1dwt7 < t1 
  && t2h1dwt7 < t2w1r && t2h1dwt7 < t2w1l && t2h1dwt7 < t2h1u && t2h1dwt7 < t2h1d && t2h1dwt7 < t2w1rwt && t2h1dwt7 < t2w1lwt && t2h1dwt7 < t2h1uwt && t2h1dwt7 < t2h1dwt 
  && t2h1dwt7 < t2w1r1 && t2h1dwt7 < t2w1l1 && t2h1dwt7 < t2h1u1 && t2h1dwt7 < t2h1d1 && t2h1dwt7 < t2w1rwt1 && t2h1dwt7 < t2w1lwt1 && t2h1dwt7 < t2h1uwt1 && t2h1dwt7 < t2h1dwt1
  && t2h1dwt7 < t2w1r2 && t2h1dwt7 < t2w1l2 && t2h1dwt7 < t2h1u2 && t2h1dwt7 < t2h1d2 && t2h1dwt7 < t2w1rwt2 && t2h1dwt7 < t2w1lwt2 && t2h1dwt7 < t2h1uwt2 && t2h1dwt7 < t2h1dwt2 
  && t2h1dwt7 < t2w1r3 && t2h1dwt7 < t2w1l3 && t2h1dwt7 < t2h1u3 && t2h1dwt7 < t2h1d3 && t2h1dwt7 < t2w1rwt3 && t2h1dwt7 < t2w1lwt3 && t2h1dwt7 < t2h1uwt3 && t2h1dwt7 < t2h1dwt3
  && t2h1dwt7 < t2w1r4 && t2h1dwt7 < t2w1l4 && t2h1dwt7 < t2h1u4 && t2h1dwt7 < t2h1d4 && t2h1dwt7 < t2w1rwt4 && t2h1dwt7 < t2w1lwt4 && t2h1dwt7 < t2h1uwt4 && t2h1dwt7 < t2h1dwt4
  && t2h1dwt7 < t2w1r5 && t2h1dwt7 < t2w1l5 && t2h1dwt7 < t2h1u5 && t2h1dwt7 < t2h1d5 && t2h1dwt7 < t2w1rwt5 && t2h1dwt7 < t2w1lwt5 && t2h1dwt7 < t2h1uwt5 && t2h1dwt7 < t2h1dwt5
  && t2h1dwt7 < t2w1r6 && t2h1dwt7 < t2w1l6 && t2h1dwt7 < t2h1u6 && t2h1dwt7 < t2h1d6 && t2h1dwt7 < t2w1rwt6 && t2h1dwt7 < t2w1lwt6 && t2h1dwt7 < t2h1uwt6 && t2h1dwt7 < t2h1dwt6
  && t2h1dwt7 < t2w1r7 && t2h1dwt7 < t2w1l7 && t2h1dwt7 < t2h1u7 && t2h1dwt7 < t2h1d7 && t2h1dwt7 < t2w1rwt7 && t2h1dwt7 < t2w1lwt7 && t2h1dwt7 < t2h1uwt7 
  && t2h1dwt7 < t2w1r8 && t2h1dwt7 < t2w1l8 && t2h1dwt7 < t2h1u8 && t2h1dwt7 < t2h1d8 && t2h1dwt7 < t2w1rwt8 && t2h1dwt7 < t2w1lwt8 && t2h1dwt7 < t2h1uwt8 && t2h1dwt7 < t2h1dwt8
  && t2h1dwt7 < t2w1r9 && t2h1dwt7 < t2w1l9 && t2h1dwt7 < t2h1u9 && t2h1dwt7 < t2h1d9 && t2h1dwt7 < t2w1rwt9 && t2h1dwt7 < t2w1lwt9 && t2h1dwt7 < t2h1uwt9 && t2h1dwt7 < t2h1dwt9 
  && t2h1dwt7 < t2w1r10 && t2h1dwt7 < t2w1l10 && t2h1dwt7 < t2h1u10 && t2h1dwt7 < t2h1d10 && t2h1dwt7 < t2w1rwt10 && t2h1dwt7 < t2w1lwt10 && t2h1dwt7 < t2h1uwt10 && t2h1dwt7 < t2h1dwt10
  && (louthd7 == 0 && linhd7 == 0)){ 
  i=321;
  }


  if (mxr8!=-1 && t2w1r8 > 0 && t2w1r8 < t1 
     && t2w1r8 < t2w1r && t2w1r8 < t2w1l && t2w1r8 < t2h1u && t2w1r8 < t2h1d && t2w1r8 < t2w1rwt && t2w1r8 < t2w1lwt && t2w1r8 < t2h1uwt && t2w1r8 < t2h1dwt
     && t2w1r8 < t2w1r1 && t2w1r8 < t2w1l1 && t2w1r8 < t2h1u1 && t2w1r8 < t2h1d1 && t2w1r8 < t2w1rwt1 && t2w1r8 < t2w1lwt1 && t2w1r8 < t2h1uwt1 && t2w1r8 < t2h1dwt1
     && t2w1r8 < t2w1r2 && t2w1r8 < t2w1l2 && t2w1r8 < t2h1u2 && t2w1r8 < t2h1d2 && t2w1r8 < t2w1rwt2 && t2w1r8 < t2w1lwt2 && t2w1r8 < t2h1uwt2 && t2w1r8 < t2h1dwt2 
     && t2w1r8 < t2w1r3 && t2w1r8 < t2w1l3 && t2w1r8 < t2h1u3 && t2w1r8 < t2h1d3 && t2w1r8 < t2w1rwt3 && t2w1r8 < t2w1lwt3 && t2w1r8 < t2h1uwt3 && t2w1r8 < t2h1dwt3
     && t2w1r8 < t2w1r4 && t2w1r8 < t2w1l4 && t2w1r8 < t2h1u4 && t2w1r8 < t2h1d4 && t2w1r8 < t2w1rwt4 && t2w1r8 < t2w1lwt4 && t2w1r8 < t2h1uwt4 && t2w1r8 < t2h1dwt4
     && t2w1r8 < t2w1r5 && t2w1r8 < t2w1l5 && t2w1r8 < t2h1u5 && t2w1r8 < t2h1d5 && t2w1r8 < t2w1rwt5 && t2w1r8 < t2w1lwt5 && t2w1r8 < t2h1uwt5 && t2w1r8 < t2h1dwt5
     && t2w1r8 < t2w1r6 && t2w1r8 < t2w1l6 && t2w1r8 < t2h1u6 && t2w1r8 < t2h1d6 && t2w1r8 < t2w1rwt6 && t2w1r8 < t2w1lwt6 && t2w1r8 < t2h1uwt6 && t2w1r8 < t2h1dwt6
     && t2w1r8 < t2w1r7 && t2w1r8 < t2w1l7 && t2w1r8 < t2h1u7 && t2w1r8 < t2h1d7 && t2w1r8 < t2w1rwt7 && t2w1r8 < t2w1lwt7 && t2w1r8 < t2h1uwt7 && t2w1r8 < t2h1dwt7
     && t2w1r8 < t2w1l8 && t2w1r8 < t2h1u8 && t2w1r8 < t2h1d8 && t2w1r8 < t2w1rwt8 && t2w1r8 < t2w1lwt8 && t2w1r8 < t2h1uwt8 && t2w1r8 < t2h1dwt8
     && t2w1r8 < t2w1r9 && t2w1r8 < t2w1l9 && t2w1r8 < t2h1u9 && t2w1r8 < t2h1d9 && t2w1r8 < t2w1rwt9 && t2w1r8 < t2w1lwt9 && t2w1r8 < t2h1uwt9 && t2w1r8 < t2h1dwt9
     && t2w1r8 < t2w1r10 && t2w1r8 < t2w1l10 && t2w1r8 < t2h1u10 && t2w1r8 < t2h1d10 && t2w1r8 < t2w1rwt10 && t2w1r8 < t2w1lwt10 && t2w1r8 < t2h1uwt10 && t2w1r8 < t2h1dwt10
     && ((linwr8!=0) && (loutwr8!=0) )) {	
    if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1r8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1r8+z))*(z0hd8+(vz*t2w1r8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1r8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1r8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1r8+z))*(z0hu8+(vz*t2w1r8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1r8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1r8+y;
  xlimitr=bwr8*sqrt(1-((vz*t2w1r8+z)+z0wr8)*((vz*t2w1r8+z)+z0wr8)/a2wr8);
  xtest=vx*t2w1r8+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr8 > 0){
  i=322;
  }else{
  i=338;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr8!=-1 && t2w1r8 > 0 && t2w1r8 < t1 
     && t2w1r8 < t2w1r && t2w1r8 < t2w1l && t2w1r8 < t2h1u && t2w1r8 < t2h1d && t2w1r8 < t2w1rwt && t2w1r8 < t2w1lwt && t2w1r8 < t2h1uwt && t2w1r8 < t2h1dwt
     && t2w1r8 < t2w1r1 && t2w1r8 < t2w1l1 && t2w1r8 < t2h1u1 && t2w1r8 < t2h1d1 && t2w1r8 < t2w1rwt1 && t2w1r8 < t2w1lwt1 && t2w1r8 < t2h1uwt1 && t2w1r8 < t2h1dwt1
     && t2w1r8 < t2w1r2 && t2w1r8 < t2w1l2 && t2w1r8 < t2h1u2 && t2w1r8 < t2h1d2 && t2w1r8 < t2w1rwt2 && t2w1r8 < t2w1lwt2 && t2w1r8 < t2h1uwt2 && t2w1r8 < t2h1dwt2 
     && t2w1r8 < t2w1r3 && t2w1r8 < t2w1l3 && t2w1r8 < t2h1u3 && t2w1r8 < t2h1d3 && t2w1r8 < t2w1rwt3 && t2w1r8 < t2w1lwt3 && t2w1r8 < t2h1uwt3 && t2w1r8 < t2h1dwt3
     && t2w1r8 < t2w1r4 && t2w1r8 < t2w1l4 && t2w1r8 < t2h1u4 && t2w1r8 < t2h1d4 && t2w1r8 < t2w1rwt4 && t2w1r8 < t2w1lwt4 && t2w1r8 < t2h1uwt4 && t2w1r8 < t2h1dwt4
     && t2w1r8 < t2w1r5 && t2w1r8 < t2w1l5 && t2w1r8 < t2h1u5 && t2w1r8 < t2h1d5 && t2w1r8 < t2w1rwt5 && t2w1r8 < t2w1lwt5 && t2w1r8 < t2h1uwt5 && t2w1r8 < t2h1dwt5
     && t2w1r8 < t2w1r6 && t2w1r8 < t2w1l6 && t2w1r8 < t2h1u6 && t2w1r8 < t2h1d6 && t2w1r8 < t2w1rwt6 && t2w1r8 < t2w1lwt6 && t2w1r8 < t2h1uwt6 && t2w1r8 < t2h1dwt6
     && t2w1r8 < t2w1r7 && t2w1r8 < t2w1l7 && t2w1r8 < t2h1u7 && t2w1r8 < t2h1d7 && t2w1r8 < t2w1rwt7 && t2w1r8 < t2w1lwt7 && t2w1r8 < t2h1uwt7 && t2w1r8 < t2h1dwt7
     && t2w1r8 < t2w1l8 && t2w1r8 < t2h1u8 && t2w1r8 < t2h1d8 && t2w1r8 < t2w1rwt8 && t2w1r8 < t2w1lwt8 && t2w1r8 < t2h1uwt8 && t2w1r8 < t2h1dwt8
     && t2w1r8 < t2w1r9 && t2w1r8 < t2w1l9 && t2w1r8 < t2h1u9 && t2w1r8 < t2h1d9 && t2w1r8 < t2w1rwt9 && t2w1r8 < t2w1lwt9 && t2w1r8 < t2h1uwt9 && t2w1r8 < t2h1dwt9
     && t2w1r8 < t2w1r10 && t2w1r8 < t2w1l10 && t2w1r8 < t2h1u10 && t2w1r8 < t2h1d10 && t2w1r8 < t2w1rwt10 && t2w1r8 < t2w1lwt10 && t2w1r8 < t2h1uwt10 && t2w1r8 < t2h1dwt10
     && ((loutwr8!=0 && linwr8==0) || (loutwr8==0 && linwr8!=0))){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1r8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1r8+z))*(z0hd8+(vz*t2w1r8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1r8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1r8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1r8+z))*(z0hu8+(vz*t2w1r8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1r8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1r8+y;
  xtest=vx*t2w1r8+x;
  xlimitr=-sqrt(pbwr8-(vz*t2w1r8+z)/pawr8);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr8 > 0){
  i=323;
  }else{
  i=338;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr8!=-1 && t2w1r8 > 0 && t2w1r8 < t1 
     && t2w1r8 < t2w1r && t2w1r8 < t2w1l && t2w1r8 < t2h1u && t2w1r8 < t2h1d && t2w1r8 < t2w1rwt && t2w1r8 < t2w1lwt && t2w1r8 < t2h1uwt && t2w1r8 < t2h1dwt
     && t2w1r8 < t2w1r1 && t2w1r8 < t2w1l1 && t2w1r8 < t2h1u1 && t2w1r8 < t2h1d1 && t2w1r8 < t2w1rwt1 && t2w1r8 < t2w1lwt1 && t2w1r8 < t2h1uwt1 && t2w1r8 < t2h1dwt1
     && t2w1r8 < t2w1r2 && t2w1r8 < t2w1l2 && t2w1r8 < t2h1u2 && t2w1r8 < t2h1d2 && t2w1r8 < t2w1rwt2 && t2w1r8 < t2w1lwt2 && t2w1r8 < t2h1uwt2 && t2w1r8 < t2h1dwt2 
     && t2w1r8 < t2w1r3 && t2w1r8 < t2w1l3 && t2w1r8 < t2h1u3 && t2w1r8 < t2h1d3 && t2w1r8 < t2w1rwt3 && t2w1r8 < t2w1lwt3 && t2w1r8 < t2h1uwt3 && t2w1r8 < t2h1dwt3
     && t2w1r8 < t2w1r4 && t2w1r8 < t2w1l4 && t2w1r8 < t2h1u4 && t2w1r8 < t2h1d4 && t2w1r8 < t2w1rwt4 && t2w1r8 < t2w1lwt4 && t2w1r8 < t2h1uwt4 && t2w1r8 < t2h1dwt4
     && t2w1r8 < t2w1r5 && t2w1r8 < t2w1l5 && t2w1r8 < t2h1u5 && t2w1r8 < t2h1d5 && t2w1r8 < t2w1rwt5 && t2w1r8 < t2w1lwt5 && t2w1r8 < t2h1uwt5 && t2w1r8 < t2h1dwt5
     && t2w1r8 < t2w1r6 && t2w1r8 < t2w1l6 && t2w1r8 < t2h1u6 && t2w1r8 < t2h1d6 && t2w1r8 < t2w1rwt6 && t2w1r8 < t2w1lwt6 && t2w1r8 < t2h1uwt6 && t2w1r8 < t2h1dwt6
     && t2w1r8 < t2w1r7 && t2w1r8 < t2w1l7 && t2w1r8 < t2h1u7 && t2w1r8 < t2h1d7 && t2w1r8 < t2w1rwt7 && t2w1r8 < t2w1lwt7 && t2w1r8 < t2h1uwt7 && t2w1r8 < t2h1dwt7
     && t2w1r8 < t2w1l8 && t2w1r8 < t2h1u8 && t2w1r8 < t2h1d8 && t2w1r8 < t2w1rwt8 && t2w1r8 < t2w1lwt8 && t2w1r8 < t2h1uwt8 && t2w1r8 < t2h1dwt8
     && t2w1r8 < t2w1r9 && t2w1r8 < t2w1l9 && t2w1r8 < t2h1u9 && t2w1r8 < t2h1d9 && t2w1r8 < t2w1rwt9 && t2w1r8 < t2w1lwt9 && t2w1r8 < t2h1uwt9 && t2w1r8 < t2h1dwt9
     && t2w1r8 < t2w1r10 && t2w1r8 < t2w1l10 && t2w1r8 < t2h1u10 && t2w1r8 < t2h1d10 && t2w1r8 < t2w1rwt10 && t2w1r8 < t2w1lwt10 && t2w1r8 < t2h1uwt10 && t2w1r8 < t2h1dwt10
     && (loutwr8==0 && linwr8==0)){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1r8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1r8+z))*(z0hd8+(vz*t2w1r8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1r8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1r8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1r8+z))*(z0hu8+(vz*t2w1r8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1r8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1r8+y;
  xtest=vx*t2w1r8+x;
  xlimitr=-(w2r8+w1r8)*(vz*t2w1r8+z)/l-w1r8;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr8>0){
  i=324;
  }else{
  i=338;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl8!=-1 && t2w1l8 > 0 && t2w1l8 < t1 
      && t2w1l8 < t2w1r && t2w1l8 < t2w1l && t2w1l8 < t2h1u && t2w1l8 < t2h1d && t2w1l8 < t2w1rwt && t2w1l8 < t2w1lwt && t2w1l8 < t2h1uwt && t2w1l8 < t2h1dwt
      && t2w1l8 < t2w1r1 && t2w1l8 < t2w1l1 && t2w1l8 < t2h1u1 && t2w1l8 < t2h1d1 && t2w1l8 < t2w1rwt1 && t2w1l8 < t2w1lwt1 && t2w1l8 < t2h1uwt1 && t2w1l8 < t2h1dwt1
      && t2w1l8 < t2w1r2 && t2w1l8 < t2w1l2 && t2w1l8 < t2h1u2 && t2w1l8 < t2h1d2 && t2w1l8 < t2w1rwt2 && t2w1l8 < t2w1lwt2 && t2w1l8 < t2h1uwt2 && t2w1l8 < t2h1dwt2
      && t2w1l8 < t2w1r3 && t2w1l8 < t2w1l3 && t2w1l8 < t2h1u3 && t2w1l8 < t2h1d3 && t2w1l8 < t2w1rwt3 && t2w1l8 < t2w1lwt3 && t2w1l8 < t2h1uwt3 && t2w1l8 < t2h1dwt3
      && t2w1l8 < t2w1r4 && t2w1l8 < t2w1l4 && t2w1l8 < t2h1u4 && t2w1l8 < t2h1d4 && t2w1l8 < t2w1rwt4 && t2w1l8 < t2w1lwt4 && t2w1l8 < t2h1uwt4 && t2w1l8 < t2h1dwt4
      && t2w1l8 < t2w1r5 && t2w1l8 < t2w1l5 && t2w1l8 < t2h1u5 && t2w1l8 < t2h1d5 && t2w1l8 < t2w1rwt5 && t2w1l8 < t2w1lwt5 && t2w1l8 < t2h1uwt5 && t2w1l8 < t2h1dwt5
      && t2w1l8 < t2w1r6 && t2w1l8 < t2w1l6 && t2w1l8 < t2h1u6 && t2w1l8 < t2h1d6 && t2w1l8 < t2w1rwt6 && t2w1l8 < t2w1lwt6 && t2w1l8 < t2h1uwt6 && t2w1l8 < t2h1dwt6
      && t2w1l8 < t2w1r7 && t2w1l8 < t2w1l7 && t2w1l8 < t2h1u7 && t2w1l8 < t2h1d7 && t2w1l8 < t2w1rwt7 && t2w1l8 < t2w1lwt7 && t2w1l8 < t2h1uwt7 && t2w1l8 < t2h1dwt7
      && t2w1l8 < t2w1r8 && t2w1l8 < t2h1u8 && t2w1l8 < t2h1d8 && t2w1l8 < t2w1rwt8 && t2w1l8 < t2w1lwt8 && t2w1l8 < t2h1uwt8 && t2w1l8 < t2h1dwt8
      && t2w1l8 < t2w1r9 && t2w1l8 < t2w1l9 && t2w1l8 < t2h1u9 && t2w1l8 < t2h1d9 && t2w1l8 < t2w1rwt9 && t2w1l8 < t2w1lwt9 && t2w1l8 < t2h1uwt9 && t2w1l8 < t2h1dwt9
      && t2w1l8 < t2w1r10 && t2w1l8 < t2w1l10 && t2w1l8 < t2h1u10 && t2w1l8 < t2h1d10 && t2w1l8 < t2w1rwt10 && t2w1l8 < t2w1lwt10 && t2w1l8 < t2h1uwt10 && t2w1l8 < t2h1dwt10
      && ((linwl8!=0) && (loutwl8!=0) )){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1l8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1l8+z))*(z0hd8+(vz*t2w1l8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1l8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1l8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1l8+z))*(z0hu8+(vz*t2w1l8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1l8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1l8+y;
  xlimitl=bwl8*sqrt(1-((vz*t2w1l8+z)+z0wl8)*((vz*t2w1l8+z)+z0wl8)/a2wl8);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl8>0){
  i=325;
  }else{
  i=339;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl8!=-1 && t2w1l8 > 0 && t2w1l8 < t1 
      && t2w1l8 < t2w1r && t2w1l8 < t2w1l && t2w1l8 < t2h1u && t2w1l8 < t2h1d && t2w1l8 < t2w1rwt && t2w1l8 < t2w1lwt && t2w1l8 < t2h1uwt && t2w1l8 < t2h1dwt
      && t2w1l8 < t2w1r1 && t2w1l8 < t2w1l1 && t2w1l8 < t2h1u1 && t2w1l8 < t2h1d1 && t2w1l8 < t2w1rwt1 && t2w1l8 < t2w1lwt1 && t2w1l8 < t2h1uwt1 && t2w1l8 < t2h1dwt1
      && t2w1l8 < t2w1r2 && t2w1l8 < t2w1l2 && t2w1l8 < t2h1u2 && t2w1l8 < t2h1d2 && t2w1l8 < t2w1rwt2 && t2w1l8 < t2w1lwt2 && t2w1l8 < t2h1uwt2 && t2w1l8 < t2h1dwt2
      && t2w1l8 < t2w1r3 && t2w1l8 < t2w1l3 && t2w1l8 < t2h1u3 && t2w1l8 < t2h1d3 && t2w1l8 < t2w1rwt3 && t2w1l8 < t2w1lwt3 && t2w1l8 < t2h1uwt3 && t2w1l8 < t2h1dwt3
      && t2w1l8 < t2w1r4 && t2w1l8 < t2w1l4 && t2w1l8 < t2h1u4 && t2w1l8 < t2h1d4 && t2w1l8 < t2w1rwt4 && t2w1l8 < t2w1lwt4 && t2w1l8 < t2h1uwt4 && t2w1l8 < t2h1dwt4
      && t2w1l8 < t2w1r5 && t2w1l8 < t2w1l5 && t2w1l8 < t2h1u5 && t2w1l8 < t2h1d5 && t2w1l8 < t2w1rwt5 && t2w1l8 < t2w1lwt5 && t2w1l8 < t2h1uwt5 && t2w1l8 < t2h1dwt5
      && t2w1l8 < t2w1r6 && t2w1l8 < t2w1l6 && t2w1l8 < t2h1u6 && t2w1l8 < t2h1d6 && t2w1l8 < t2w1rwt6 && t2w1l8 < t2w1lwt6 && t2w1l8 < t2h1uwt6 && t2w1l8 < t2h1dwt6
      && t2w1l8 < t2w1r7 && t2w1l8 < t2w1l7 && t2w1l8 < t2h1u7 && t2w1l8 < t2h1d7 && t2w1l8 < t2w1rwt7 && t2w1l8 < t2w1lwt7 && t2w1l8 < t2h1uwt7 && t2w1l8 < t2h1dwt7
      && t2w1l8 < t2w1r8 && t2w1l8 < t2h1u8 && t2w1l8 < t2h1d8 && t2w1l8 < t2w1rwt8 && t2w1l8 < t2w1lwt8 && t2w1l8 < t2h1uwt8 && t2w1l8 < t2h1dwt8
      && t2w1l8 < t2w1r9 && t2w1l8 < t2w1l9 && t2w1l8 < t2h1u9 && t2w1l8 < t2h1d9 && t2w1l8 < t2w1rwt9 && t2w1l8 < t2w1lwt9 && t2w1l8 < t2h1uwt9 && t2w1l8 < t2h1dwt9
      && t2w1l8 < t2w1r10 && t2w1l8 < t2w1l10 && t2w1l8 < t2h1u10 && t2w1l8 < t2h1d10 && t2w1l8 < t2w1rwt10 && t2w1l8 < t2w1lwt10 && t2w1l8 < t2h1uwt10 && t2w1l8 < t2h1dwt10
      && ((loutwl8!=0 && linwl8==0) || (loutwl8==0 && linwl8!=0))){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1l8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1l8+z))*(z0hd8+(vz*t2w1l8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1l8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1l8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1l8+z))*(z0hu8+(vz*t2w1l8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1l8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1l8+y;
  xlimitl=sqrt(pbwl8-(vz*t2w1l8+z)/pawl8);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl8>0){
  i=326;
  }else{
  i=339;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl8!=-1 && t2w1l8 > 0 && t2w1l8 < t1 
      && t2w1l8 < t2w1r && t2w1l8 < t2w1l && t2w1l8 < t2h1u && t2w1l8 < t2h1d && t2w1l8 < t2w1rwt && t2w1l8 < t2w1lwt && t2w1l8 < t2h1uwt && t2w1l8 < t2h1dwt
      && t2w1l8 < t2w1r1 && t2w1l8 < t2w1l1 && t2w1l8 < t2h1u1 && t2w1l8 < t2h1d1 && t2w1l8 < t2w1rwt1 && t2w1l8 < t2w1lwt1 && t2w1l8 < t2h1uwt1 && t2w1l8 < t2h1dwt1
      && t2w1l8 < t2w1r2 && t2w1l8 < t2w1l2 && t2w1l8 < t2h1u2 && t2w1l8 < t2h1d2 && t2w1l8 < t2w1rwt2 && t2w1l8 < t2w1lwt2 && t2w1l8 < t2h1uwt2 && t2w1l8 < t2h1dwt2
      && t2w1l8 < t2w1r3 && t2w1l8 < t2w1l3 && t2w1l8 < t2h1u3 && t2w1l8 < t2h1d3 && t2w1l8 < t2w1rwt3 && t2w1l8 < t2w1lwt3 && t2w1l8 < t2h1uwt3 && t2w1l8 < t2h1dwt3
      && t2w1l8 < t2w1r4 && t2w1l8 < t2w1l4 && t2w1l8 < t2h1u4 && t2w1l8 < t2h1d4 && t2w1l8 < t2w1rwt4 && t2w1l8 < t2w1lwt4 && t2w1l8 < t2h1uwt4 && t2w1l8 < t2h1dwt4
      && t2w1l8 < t2w1r5 && t2w1l8 < t2w1l5 && t2w1l8 < t2h1u5 && t2w1l8 < t2h1d5 && t2w1l8 < t2w1rwt5 && t2w1l8 < t2w1lwt5 && t2w1l8 < t2h1uwt5 && t2w1l8 < t2h1dwt5
      && t2w1l8 < t2w1r6 && t2w1l8 < t2w1l6 && t2w1l8 < t2h1u6 && t2w1l8 < t2h1d6 && t2w1l8 < t2w1rwt6 && t2w1l8 < t2w1lwt6 && t2w1l8 < t2h1uwt6 && t2w1l8 < t2h1dwt6
      && t2w1l8 < t2w1r7 && t2w1l8 < t2w1l7 && t2w1l8 < t2h1u7 && t2w1l8 < t2h1d7 && t2w1l8 < t2w1rwt7 && t2w1l8 < t2w1lwt7 && t2w1l8 < t2h1uwt7 && t2w1l8 < t2h1dwt7
      && t2w1l8 < t2w1r8 && t2w1l8 < t2h1u8 && t2w1l8 < t2h1d8 && t2w1l8 < t2w1rwt8 && t2w1l8 < t2w1lwt8 && t2w1l8 < t2h1uwt8 && t2w1l8 < t2h1dwt8
      && t2w1l8 < t2w1r9 && t2w1l8 < t2w1l9 && t2w1l8 < t2h1u9 && t2w1l8 < t2h1d9 && t2w1l8 < t2w1rwt9 && t2w1l8 < t2w1lwt9 && t2w1l8 < t2h1uwt9 && t2w1l8 < t2h1dwt9
      && t2w1l8 < t2w1r10 && t2w1l8 < t2w1l10 && t2w1l8 < t2h1u10 && t2w1l8 < t2h1d10 && t2w1l8 < t2w1rwt10 && t2w1l8 < t2w1lwt10 && t2w1l8 < t2h1uwt10 && t2w1l8 < t2h1dwt10
      && (loutwl8==0 && linwl8==0)){
 if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1l8+z)-h1d8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhd8*sqrt(1-((z0hd8+(vz*t2w1l8+z))*(z0hd8+(vz*t2w1l8+z)))/a2hd8);
      }else{
      ylimitd=-sqrt(((vz*t2w1l8+z)-pbhd8)/-pahd8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1l8+z)+h1u8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhu8*sqrt(1-((z0hu8+(vz*t2w1l8+z))*(z0hu8+(vz*t2w1l8+z)))/a2hu8);
     }else{
     ylimitu=sqrt(((vz*t2w1l8+z)-pbhu8)/-pahu8);
    }
    }
  ytest=vy*t2w1l8+y;
  xlimitl=(w2l8-w1l8)*(vz*t2w1l8+z)/l+w1l8;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl8>0){
  i=327;
  }else{
  i=339;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu8!=-1 && t2h1u8 > 0 && t2h1u8 < t1 
  && t2h1u8 < t2w1r && t2h1u8 < t2w1l && t2h1u8 < t2h1u && t2h1u8 < t2h1d && t2h1u8 < t2w1rwt && t2h1u8 < t2w1lwt && t2h1u8 < t2h1uwt && t2h1u8 < t2h1dwt
  && t2h1u8 < t2w1r1 && t2h1u8 < t2w1l1 && t2h1u8 < t2h1u1 && t2h1u8 < t2h1d1 && t2h1u8 < t2w1rwt1 && t2h1u8 < t2w1lwt1 && t2h1u8 < t2h1uwt1 && t2h1u8 < t2h1dwt1
  && t2h1u8 < t2w1r2 && t2h1u8 < t2w1l2 && t2h1u8 < t2h1u2 && t2h1u8 < t2h1d2 && t2h1u8 < t2w1rwt2 && t2h1u8 < t2w1lwt2 && t2h1u8 < t2h1uwt2 && t2h1u8 < t2h1dwt2
  && t2h1u8 < t2w1r3 && t2h1u8 < t2w1l3 && t2h1u8 < t2h1u3 && t2h1u8 < t2h1d3 && t2h1u8 < t2w1rwt3 && t2h1u8 < t2w1lwt3 && t2h1u8 < t2h1uwt3 && t2h1u8 < t2h1dwt3
  && t2h1u8 < t2w1r4 && t2h1u8 < t2w1l4 && t2h1u8 < t2h1u4 && t2h1u8 < t2h1d4 && t2h1u8 < t2w1rwt4 && t2h1u8 < t2w1lwt4 && t2h1u8 < t2h1uwt4 && t2h1u8 < t2h1dwt4
  && t2h1u8 < t2w1r5 && t2h1u8 < t2w1l5 && t2h1u8 < t2h1u5 && t2h1u8 < t2h1d5 && t2h1u8 < t2w1rwt5 && t2h1u8 < t2w1lwt5 && t2h1u8 < t2h1uwt5 && t2h1u8 < t2h1dwt5
  && t2h1u8 < t2w1r6 && t2h1u8 < t2w1l6 && t2h1u8 < t2h1u6 && t2h1u8 < t2h1d6 && t2h1u8 < t2w1rwt6 && t2h1u8 < t2w1lwt6 && t2h1u8 < t2h1uwt6 && t2h1u8 < t2h1dwt6
  && t2h1u8 < t2w1r7 && t2h1u8 < t2w1l7 && t2h1u8 < t2h1u7 && t2h1u8 < t2h1d7 && t2h1u8 < t2w1rwt7 && t2h1u8 < t2w1lwt7 && t2h1u8 < t2h1uwt7 && t2h1u8 < t2h1dwt7
  && t2h1u8 < t2w1r8 && t2h1u8 < t2w1l8 && t2h1u8 < t2h1d8 && t2h1u8 < t2w1rwt8 && t2h1u8 < t2w1lwt8 && t2h1u8 < t2h1uwt8 && t2h1u8 < t2h1dwt8
  && t2h1u8 < t2w1r9 && t2h1u8 < t2w1l9 && t2h1u8 < t2h1u9 && t2h1u8 < t2h1d9 && t2h1u8 < t2w1rwt9 && t2h1u8 < t2w1lwt9 && t2h1u8 < t2h1uwt9 && t2h1u8 < t2h1dwt9
  && t2h1u8 < t2w1r10 && t2h1u8 < t2w1l10 && t2h1u8 < t2h1u10 && t2h1u8 < t2h1d10 && t2h1u8 < t2w1rwt10 && t2h1u8 < t2w1lwt10 && t2h1u8 < t2h1uwt10 && t2h1u8 < t2h1dwt10
  && (louthu8 !=0 && linhu8!=0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1u8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1u8+z))*(z0wr8+(vz*t2h1u8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1u8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1u8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1u8+z))*(z0wl8+(vz*t2h1u8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1u8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1u8+x;
  ylimitu=bhu8*sqrt(1-((vz*t2h1u8+z)+z0hu8)*((vz*t2h1u8+z)+z0hu8)/a2hu8);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu8>0 ){
  i=328;
  }else{
  i=340;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu8!=-1 && t2h1u8 > 0 && t2h1u8 < t1
  && t2h1u8 < t2w1r && t2h1u8 < t2w1l && t2h1u8 < t2h1u && t2h1u8 < t2h1d && t2h1u8 < t2w1rwt && t2h1u8 < t2w1lwt && t2h1u8 < t2h1uwt && t2h1u8 < t2h1dwt
  && t2h1u8 < t2w1r1 && t2h1u8 < t2w1l1 && t2h1u8 < t2h1u1 && t2h1u8 < t2h1d1 && t2h1u8 < t2w1rwt1 && t2h1u8 < t2w1lwt1 && t2h1u8 < t2h1uwt1 && t2h1u8 < t2h1dwt1
  && t2h1u8 < t2w1r2 && t2h1u8 < t2w1l2 && t2h1u8 < t2h1u2 && t2h1u8 < t2h1d2 && t2h1u8 < t2w1rwt2 && t2h1u8 < t2w1lwt2 && t2h1u8 < t2h1uwt2 && t2h1u8 < t2h1dwt2
  && t2h1u8 < t2w1r3 && t2h1u8 < t2w1l3 && t2h1u8 < t2h1u3 && t2h1u8 < t2h1d3 && t2h1u8 < t2w1rwt3 && t2h1u8 < t2w1lwt3 && t2h1u8 < t2h1uwt3 && t2h1u8 < t2h1dwt3
  && t2h1u8 < t2w1r4 && t2h1u8 < t2w1l4 && t2h1u8 < t2h1u4 && t2h1u8 < t2h1d4 && t2h1u8 < t2w1rwt4 && t2h1u8 < t2w1lwt4 && t2h1u8 < t2h1uwt4 && t2h1u8 < t2h1dwt4
  && t2h1u8 < t2w1r5 && t2h1u8 < t2w1l5 && t2h1u8 < t2h1u5 && t2h1u8 < t2h1d5 && t2h1u8 < t2w1rwt5 && t2h1u8 < t2w1lwt5 && t2h1u8 < t2h1uwt5 && t2h1u8 < t2h1dwt5
  && t2h1u8 < t2w1r6 && t2h1u8 < t2w1l6 && t2h1u8 < t2h1u6 && t2h1u8 < t2h1d6 && t2h1u8 < t2w1rwt6 && t2h1u8 < t2w1lwt6 && t2h1u8 < t2h1uwt6 && t2h1u8 < t2h1dwt6
  && t2h1u8 < t2w1r7 && t2h1u8 < t2w1l7 && t2h1u8 < t2h1u7 && t2h1u8 < t2h1d7 && t2h1u8 < t2w1rwt7 && t2h1u8 < t2w1lwt7 && t2h1u8 < t2h1uwt7 && t2h1u8 < t2h1dwt7
  && t2h1u8 < t2w1r8 && t2h1u8 < t2w1l8 && t2h1u8 < t2h1d8 && t2h1u8 < t2w1rwt8 && t2h1u8 < t2w1lwt8 && t2h1u8 < t2h1uwt8 && t2h1u8 < t2h1dwt8
  && t2h1u8 < t2w1r9 && t2h1u8 < t2w1l9 && t2h1u8 < t2h1u9 && t2h1u8 < t2h1d9 && t2h1u8 < t2w1rwt9 && t2h1u8 < t2w1lwt9 && t2h1u8 < t2h1uwt9 && t2h1u8 < t2h1dwt9
  && t2h1u8 < t2w1r10 && t2h1u8 < t2w1l10 && t2h1u8 < t2h1u10 && t2h1u8 < t2h1d10 && t2h1u8 < t2w1rwt10 && t2h1u8 < t2w1lwt10 && t2h1u8 < t2h1uwt10 && t2h1u8 < t2h1dwt10 
  && ((louthu8!=0 && linhu8==0) || (louthu8==0 && linhu8!=0))){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1u8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1u8+z))*(z0wr8+(vz*t2h1u8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1u8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1u8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1u8+z))*(z0wl8+(vz*t2h1u8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1u8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1u8+x;
  ylimitu=sqrt(pbhu8-(vz*t2h1u8+z)/pahu8);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu8>0){
  i=329;
  }else{
  i=340;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu8!=-1 && t2h1u8 > 0 && t2h1u8 < t1
  && t2h1u8 < t2w1r && t2h1u8 < t2w1l && t2h1u8 < t2h1u && t2h1u8 < t2h1d && t2h1u8 < t2w1rwt && t2h1u8 < t2w1lwt && t2h1u8 < t2h1uwt && t2h1u8 < t2h1dwt
  && t2h1u8 < t2w1r1 && t2h1u8 < t2w1l1 && t2h1u8 < t2h1u1 && t2h1u8 < t2h1d1 && t2h1u8 < t2w1rwt1 && t2h1u8 < t2w1lwt1 && t2h1u8 < t2h1uwt1 && t2h1u8 < t2h1dwt1
  && t2h1u8 < t2w1r2 && t2h1u8 < t2w1l2 && t2h1u8 < t2h1u2 && t2h1u8 < t2h1d2 && t2h1u8 < t2w1rwt2 && t2h1u8 < t2w1lwt2 && t2h1u8 < t2h1uwt2 && t2h1u8 < t2h1dwt2
  && t2h1u8 < t2w1r3 && t2h1u8 < t2w1l3 && t2h1u8 < t2h1u3 && t2h1u8 < t2h1d3 && t2h1u8 < t2w1rwt3 && t2h1u8 < t2w1lwt3 && t2h1u8 < t2h1uwt3 && t2h1u8 < t2h1dwt3
  && t2h1u8 < t2w1r4 && t2h1u8 < t2w1l4 && t2h1u8 < t2h1u4 && t2h1u8 < t2h1d4 && t2h1u8 < t2w1rwt4 && t2h1u8 < t2w1lwt4 && t2h1u8 < t2h1uwt4 && t2h1u8 < t2h1dwt4
  && t2h1u8 < t2w1r5 && t2h1u8 < t2w1l5 && t2h1u8 < t2h1u5 && t2h1u8 < t2h1d5 && t2h1u8 < t2w1rwt5 && t2h1u8 < t2w1lwt5 && t2h1u8 < t2h1uwt5 && t2h1u8 < t2h1dwt5
  && t2h1u8 < t2w1r6 && t2h1u8 < t2w1l6 && t2h1u8 < t2h1u6 && t2h1u8 < t2h1d6 && t2h1u8 < t2w1rwt6 && t2h1u8 < t2w1lwt6 && t2h1u8 < t2h1uwt6 && t2h1u8 < t2h1dwt6
  && t2h1u8 < t2w1r7 && t2h1u8 < t2w1l7 && t2h1u8 < t2h1u7 && t2h1u8 < t2h1d7 && t2h1u8 < t2w1rwt7 && t2h1u8 < t2w1lwt7 && t2h1u8 < t2h1uwt7 && t2h1u8 < t2h1dwt7
  && t2h1u8 < t2w1r8 && t2h1u8 < t2w1l8 && t2h1u8 < t2h1d8 && t2h1u8 < t2w1rwt8 && t2h1u8 < t2w1lwt8 && t2h1u8 < t2h1uwt8 && t2h1u8 < t2h1dwt8
  && t2h1u8 < t2w1r9 && t2h1u8 < t2w1l9 && t2h1u8 < t2h1u9 && t2h1u8 < t2h1d9 && t2h1u8 < t2w1rwt9 && t2h1u8 < t2w1lwt9 && t2h1u8 < t2h1uwt9 && t2h1u8 < t2h1dwt9
  && t2h1u8 < t2w1r10 && t2h1u8 < t2w1l10 && t2h1u8 < t2h1u10 && t2h1u8 < t2h1d10 && t2h1u8 < t2w1rwt10 && t2h1u8 < t2w1lwt10 && t2h1u8 < t2h1uwt10 && t2h1u8 < t2h1dwt10
  && (louthu8 == 0 && linhu8 == 0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1u8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1u8+z))*(z0wr8+(vz*t2h1u8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1u8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1u8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1u8+z))*(z0wl8+(vz*t2h1u8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1u8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1u8+x;
  ylimitu=(h2u8-h1u8)*(vz*t2h1u8+z)/l+h1u8;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu8>0 ){
  i=330;
  }else{
  i=340;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd8!=-1 && t2h1d8 > 0 && t2h1d8 < t1 
  && t2h1d8 < t2w1r && t2h1d8 < t2w1l && t2h1d8 < t2h1u && t2h1d8 < t2h1d && t2h1d8 < t2w1rwt && t2h1d8 < t2w1lwt && t2h1d8 < t2h1uwt && t2h1d8 < t2h1dwt
  && t2h1d8 < t2w1r1 && t2h1d8 < t2w1l1 && t2h1d8 < t2h1u1 && t2h1d8 < t2h1d1 && t2h1d8 < t2w1rwt1 && t2h1d8 < t2w1lwt1 && t2h1d8 < t2h1uwt1 && t2h1d8 < t2h1dwt1
  && t2h1d8 < t2w1r2 && t2h1d8 < t2w1l2 && t2h1d8 < t2h1u2 && t2h1d8 < t2h1d2 && t2h1d8 < t2w1rwt2 && t2h1d8 < t2w1lwt2 && t2h1d8 < t2h1uwt2 && t2h1d8 < t2h1dwt2
  && t2h1d8 < t2w1r3 && t2h1d8 < t2w1l3 && t2h1d8 < t2h1u3 && t2h1d8 < t2h1d3 && t2h1d8 < t2w1rwt3 && t2h1d8 < t2w1lwt3 && t2h1d8 < t2h1uwt3 && t2h1d8 < t2h1dwt3
  && t2h1d8 < t2w1r4 && t2h1d8 < t2w1l4 && t2h1d8 < t2h1u4 && t2h1d8 < t2h1d4 && t2h1d8 < t2w1rwt4 && t2h1d8 < t2w1lwt4 && t2h1d8 < t2h1uwt4 && t2h1d8 < t2h1dwt4
  && t2h1d8 < t2w1r5 && t2h1d8 < t2w1l5 && t2h1d8 < t2h1u5 && t2h1d8 < t2h1d5 && t2h1d8 < t2w1rwt5 && t2h1d8 < t2w1lwt5 && t2h1d8 < t2h1uwt5 && t2h1d8 < t2h1dwt5
  && t2h1d8 < t2w1r6 && t2h1d8 < t2w1l6 && t2h1d8 < t2h1u6 && t2h1d8 < t2h1d6 && t2h1d8 < t2w1rwt6 && t2h1d8 < t2w1lwt6 && t2h1d8 < t2h1uwt6 && t2h1d8 < t2h1dwt6
  && t2h1d8 < t2w1r7 && t2h1d8 < t2w1l7 && t2h1d8 < t2h1u7 && t2h1d8 < t2h1d7 && t2h1d8 < t2w1rwt7 && t2h1d8 < t2w1lwt7 && t2h1d8 < t2h1uwt7 && t2h1d8 < t2h1dwt7
  && t2h1d8 < t2w1r8 && t2h1d8 < t2w1l8 && t2h1d8 < t2h1u8 && t2h1d8 < t2w1rwt8 && t2h1d8 < t2w1lwt8 && t2h1d8 < t2h1uwt8 && t2h1d8 < t2h1dwt8
  && t2h1d8 < t2w1r9 && t2h1d8 < t2w1l9 && t2h1d8 < t2h1u9 && t2h1d8 < t2h1d9 && t2h1d8 < t2w1rwt9 && t2h1d8 < t2w1lwt9 && t2h1d8 < t2h1uwt9 && t2h1d8 < t2h1dwt9
  && t2h1d8 < t2w1r10 && t2h1d8 < t2w1l10 && t2h1d8 < t2h1u10 && t2h1d8 < t2h1d10 && t2h1d8 < t2w1rwt10 && t2h1d8 < t2w1lwt10 && t2h1d8 < t2h1uwt10 && t2h1d8 < t2h1dwt10
  && (louthd8 !=0 && linhd8!=0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1d8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1d8+z))*(z0wr8+(vz*t2h1d8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1d8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1d8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1d8+z))*(z0wl8+(vz*t2h1d8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1d8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1d8+x;
  ylimitd=-bhd8*sqrt(1-((vz*t2h1d8+z)+z0hd8)*((vz*t2h1d8+z)+z0hd8)/a2hd8);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd8>0){
  i=331;
  }else{
  i=341;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd8!=-1 && t2h1d8 > 0 && t2h1d8 < t1 
  && t2h1d8 < t2w1r && t2h1d8 < t2w1l && t2h1d8 < t2h1u && t2h1d8 < t2h1d && t2h1d8 < t2w1rwt && t2h1d8 < t2w1lwt && t2h1d8 < t2h1uwt && t2h1d8 < t2h1dwt
  && t2h1d8 < t2w1r1 && t2h1d8 < t2w1l1 && t2h1d8 < t2h1u1 && t2h1d8 < t2h1d1 && t2h1d8 < t2w1rwt1 && t2h1d8 < t2w1lwt1 && t2h1d8 < t2h1uwt1 && t2h1d8 < t2h1dwt1
  && t2h1d8 < t2w1r2 && t2h1d8 < t2w1l2 && t2h1d8 < t2h1u2 && t2h1d8 < t2h1d2 && t2h1d8 < t2w1rwt2 && t2h1d8 < t2w1lwt2 && t2h1d8 < t2h1uwt2 && t2h1d8 < t2h1dwt2
  && t2h1d8 < t2w1r3 && t2h1d8 < t2w1l3 && t2h1d8 < t2h1u3 && t2h1d8 < t2h1d3 && t2h1d8 < t2w1rwt3 && t2h1d8 < t2w1lwt3 && t2h1d8 < t2h1uwt3 && t2h1d8 < t2h1dwt3
  && t2h1d8 < t2w1r4 && t2h1d8 < t2w1l4 && t2h1d8 < t2h1u4 && t2h1d8 < t2h1d4 && t2h1d8 < t2w1rwt4 && t2h1d8 < t2w1lwt4 && t2h1d8 < t2h1uwt4 && t2h1d8 < t2h1dwt4
  && t2h1d8 < t2w1r5 && t2h1d8 < t2w1l5 && t2h1d8 < t2h1u5 && t2h1d8 < t2h1d5 && t2h1d8 < t2w1rwt5 && t2h1d8 < t2w1lwt5 && t2h1d8 < t2h1uwt5 && t2h1d8 < t2h1dwt5
  && t2h1d8 < t2w1r6 && t2h1d8 < t2w1l6 && t2h1d8 < t2h1u6 && t2h1d8 < t2h1d6 && t2h1d8 < t2w1rwt6 && t2h1d8 < t2w1lwt6 && t2h1d8 < t2h1uwt6 && t2h1d8 < t2h1dwt6
  && t2h1d8 < t2w1r7 && t2h1d8 < t2w1l7 && t2h1d8 < t2h1u7 && t2h1d8 < t2h1d7 && t2h1d8 < t2w1rwt7 && t2h1d8 < t2w1lwt7 && t2h1d8 < t2h1uwt7 && t2h1d8 < t2h1dwt7
  && t2h1d8 < t2w1r8 && t2h1d8 < t2w1l8 && t2h1d8 < t2h1u8 && t2h1d8 < t2w1rwt8 && t2h1d8 < t2w1lwt8 && t2h1d8 < t2h1uwt8 && t2h1d8 < t2h1dwt8
  && t2h1d8 < t2w1r9 && t2h1d8 < t2w1l9 && t2h1d8 < t2h1u9 && t2h1d8 < t2h1d9 && t2h1d8 < t2w1rwt9 && t2h1d8 < t2w1lwt9 && t2h1d8 < t2h1uwt9 && t2h1d8 < t2h1dwt9
  && t2h1d8 < t2w1r10 && t2h1d8 < t2w1l10 && t2h1d8 < t2h1u10 && t2h1d8 < t2h1d10 && t2h1d8 < t2w1rwt10 && t2h1d8 < t2w1lwt10 && t2h1d8 < t2h1uwt10 && t2h1d8 < t2h1dwt10
  && ((louthd8 !=0 && linhd8==0) || (louthd8 ==0 && linhd8!=0))){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1d8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1d8+z))*(z0wr8+(vz*t2h1d8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1d8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1d8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1d8+z))*(z0wl8+(vz*t2h1d8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1d8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1d8+x;
  ylimitd=-sqrt(pbhd8-(vz*t2h1d8+z)/pahd8);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd8>0 ){
  i=332;
  }else{
  i=341;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd8!=-1 && t2h1d8 > 0 && t2h1d8 < t1 
  && t2h1d8 < t2w1r && t2h1d8 < t2w1l && t2h1d8 < t2h1u && t2h1d8 < t2h1d && t2h1d8 < t2w1rwt && t2h1d8 < t2w1lwt && t2h1d8 < t2h1uwt && t2h1d8 < t2h1dwt
  && t2h1d8 < t2w1r1 && t2h1d8 < t2w1l1 && t2h1d8 < t2h1u1 && t2h1d8 < t2h1d1 && t2h1d8 < t2w1rwt1 && t2h1d8 < t2w1lwt1 && t2h1d8 < t2h1uwt1 && t2h1d8 < t2h1dwt1
  && t2h1d8 < t2w1r2 && t2h1d8 < t2w1l2 && t2h1d8 < t2h1u2 && t2h1d8 < t2h1d2 && t2h1d8 < t2w1rwt2 && t2h1d8 < t2w1lwt2 && t2h1d8 < t2h1uwt2 && t2h1d8 < t2h1dwt2
  && t2h1d8 < t2w1r3 && t2h1d8 < t2w1l3 && t2h1d8 < t2h1u3 && t2h1d8 < t2h1d3 && t2h1d8 < t2w1rwt3 && t2h1d8 < t2w1lwt3 && t2h1d8 < t2h1uwt3 && t2h1d8 < t2h1dwt3
  && t2h1d8 < t2w1r4 && t2h1d8 < t2w1l4 && t2h1d8 < t2h1u4 && t2h1d8 < t2h1d4 && t2h1d8 < t2w1rwt4 && t2h1d8 < t2w1lwt4 && t2h1d8 < t2h1uwt4 && t2h1d8 < t2h1dwt4
  && t2h1d8 < t2w1r5 && t2h1d8 < t2w1l5 && t2h1d8 < t2h1u5 && t2h1d8 < t2h1d5 && t2h1d8 < t2w1rwt5 && t2h1d8 < t2w1lwt5 && t2h1d8 < t2h1uwt5 && t2h1d8 < t2h1dwt5
  && t2h1d8 < t2w1r6 && t2h1d8 < t2w1l6 && t2h1d8 < t2h1u6 && t2h1d8 < t2h1d6 && t2h1d8 < t2w1rwt6 && t2h1d8 < t2w1lwt6 && t2h1d8 < t2h1uwt6 && t2h1d8 < t2h1dwt6
  && t2h1d8 < t2w1r7 && t2h1d8 < t2w1l7 && t2h1d8 < t2h1u7 && t2h1d8 < t2h1d7 && t2h1d8 < t2w1rwt7 && t2h1d8 < t2w1lwt7 && t2h1d8 < t2h1uwt7 && t2h1d8 < t2h1dwt7
  && t2h1d8 < t2w1r8 && t2h1d8 < t2w1l8 && t2h1d8 < t2h1u8 && t2h1d8 < t2w1rwt8 && t2h1d8 < t2w1lwt8 && t2h1d8 < t2h1uwt8 && t2h1d8 < t2h1dwt8
  && t2h1d8 < t2w1r9 && t2h1d8 < t2w1l9 && t2h1d8 < t2h1u9 && t2h1d8 < t2h1d9 && t2h1d8 < t2w1rwt9 && t2h1d8 < t2w1lwt9 && t2h1d8 < t2h1uwt9 && t2h1d8 < t2h1dwt9
  && t2h1d8 < t2w1r10 && t2h1d8 < t2w1l10 && t2h1d8 < t2h1u10 && t2h1d8 < t2h1d10 && t2h1d8 < t2w1rwt10 && t2h1d8 < t2w1lwt10 && t2h1d8 < t2h1uwt10 && t2h1d8 < t2h1dwt10
  && (louthd8 == 0 && linhd8 == 0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1d8+z)-w1r8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwr8*sqrt(1-((z0wr8+(vz*t2h1d8+z))*(z0wr8+(vz*t2h1d8+z)))/a2wr8);
    }else{
    xlimitr=-sqrt(((vz*t2h1d8+z)-pbwr8)/-pawr8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1d8+z)+w1l8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwl8*sqrt(1-((z0wl8+(vz*t2h1d8+z))*(z0wl8+(vz*t2h1d8+z)))/a2wl8);
      }else{
      xlimitl=sqrt(((vz*t2h1d8+z)-pbwl8)/-pawl8);
      }
   }
  xtest=vx*t2h1d8+x;
  ylimitd=(-h2d8+h1d8)*(vz*t2h1d8+z)/l-h1d8;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd8>0 ){
  i=333;
  }else{
  i=341;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr8==-1 && t2w1r8 > 0 && t2w1r8 < t1 
     && t2w1r8 < t2w1r && t2w1r8 < t2w1l && t2w1r8 < t2h1u && t2w1r8 < t2h1d && t2w1r8 < t2w1rwt && t2w1r8 < t2w1lwt && t2w1r8 < t2h1uwt && t2w1r8 < t2h1dwt
     && t2w1r8 < t2w1r1 && t2w1r8 < t2w1l1 && t2w1r8 < t2h1u1 && t2w1r8 < t2h1d1 && t2w1r8 < t2w1rwt1 && t2w1r8 < t2w1lwt1 && t2w1r8 < t2h1uwt1 && t2w1r8 < t2h1dwt1
     && t2w1r8 < t2w1r2 && t2w1r8 < t2w1l2 && t2w1r8 < t2h1u2 && t2w1r8 < t2h1d2 && t2w1r8 < t2w1rwt2 && t2w1r8 < t2w1lwt2 && t2w1r8 < t2h1uwt2 && t2w1r8 < t2h1dwt2 
     && t2w1r8 < t2w1r3 && t2w1r8 < t2w1l3 && t2w1r8 < t2h1u3 && t2w1r8 < t2h1d3 && t2w1r8 < t2w1rwt3 && t2w1r8 < t2w1lwt3 && t2w1r8 < t2h1uwt3 && t2w1r8 < t2h1dwt3
     && t2w1r8 < t2w1r4 && t2w1r8 < t2w1l4 && t2w1r8 < t2h1u4 && t2w1r8 < t2h1d4 && t2w1r8 < t2w1rwt4 && t2w1r8 < t2w1lwt4 && t2w1r8 < t2h1uwt4 && t2w1r8 < t2h1dwt4
     && t2w1r8 < t2w1r5 && t2w1r8 < t2w1l5 && t2w1r8 < t2h1u5 && t2w1r8 < t2h1d5 && t2w1r8 < t2w1rwt5 && t2w1r8 < t2w1lwt5 && t2w1r8 < t2h1uwt5 && t2w1r8 < t2h1dwt5
     && t2w1r8 < t2w1r6 && t2w1r8 < t2w1l6 && t2w1r8 < t2h1u6 && t2w1r8 < t2h1d6 && t2w1r8 < t2w1rwt6 && t2w1r8 < t2w1lwt6 && t2w1r8 < t2h1uwt6 && t2w1r8 < t2h1dwt6
     && t2w1r8 < t2w1r7 && t2w1r8 < t2w1l7 && t2w1r8 < t2h1u7 && t2w1r8 < t2h1d7 && t2w1r8 < t2w1rwt7 && t2w1r8 < t2w1lwt7 && t2w1r8 < t2h1uwt7 && t2w1r8 < t2h1dwt7
     && t2w1r8 < t2w1l8 && t2w1r8 < t2h1u8 && t2w1r8 < t2h1d8 && t2w1r8 < t2w1rwt8 && t2w1r8 < t2w1lwt8 && t2w1r8 < t2h1uwt8 && t2w1r8 < t2h1dwt8
     && t2w1r8 < t2w1r9 && t2w1r8 < t2w1l9 && t2w1r8 < t2h1u9 && t2w1r8 < t2h1d9 && t2w1r8 < t2w1rwt9 && t2w1r8 < t2w1lwt9 && t2w1r8 < t2h1uwt9 && t2w1r8 < t2h1dwt9
     && t2w1r8 < t2w1r10 && t2w1r8 < t2w1l10 && t2w1r8 < t2h1u10 && t2w1r8 < t2h1d10 && t2w1r8 < t2w1rwt10 && t2w1r8 < t2w1lwt10 && t2w1r8 < t2h1uwt10 && t2w1r8 < t2h1dwt10
     && ((linwr8!=0) && (loutwr8!=0) )) {
  i=334;
  }

  if (mxr8==-1 && t2w1r8 > 0 && t2w1r8 < t1 
     && t2w1r8 < t2w1r && t2w1r8 < t2w1l && t2w1r8 < t2h1u && t2w1r8 < t2h1d && t2w1r8 < t2w1rwt && t2w1r8 < t2w1lwt && t2w1r8 < t2h1uwt && t2w1r8 < t2h1dwt
     && t2w1r8 < t2w1r1 && t2w1r8 < t2w1l1 && t2w1r8 < t2h1u1 && t2w1r8 < t2h1d1 && t2w1r8 < t2w1rwt1 && t2w1r8 < t2w1lwt1 && t2w1r8 < t2h1uwt1 && t2w1r8 < t2h1dwt1
     && t2w1r8 < t2w1r2 && t2w1r8 < t2w1l2 && t2w1r8 < t2h1u2 && t2w1r8 < t2h1d2 && t2w1r8 < t2w1rwt2 && t2w1r8 < t2w1lwt2 && t2w1r8 < t2h1uwt2 && t2w1r8 < t2h1dwt2 
     && t2w1r8 < t2w1r3 && t2w1r8 < t2w1l3 && t2w1r8 < t2h1u3 && t2w1r8 < t2h1d3 && t2w1r8 < t2w1rwt3 && t2w1r8 < t2w1lwt3 && t2w1r8 < t2h1uwt3 && t2w1r8 < t2h1dwt3
     && t2w1r8 < t2w1r4 && t2w1r8 < t2w1l4 && t2w1r8 < t2h1u4 && t2w1r8 < t2h1d4 && t2w1r8 < t2w1rwt4 && t2w1r8 < t2w1lwt4 && t2w1r8 < t2h1uwt4 && t2w1r8 < t2h1dwt4
     && t2w1r8 < t2w1r5 && t2w1r8 < t2w1l5 && t2w1r8 < t2h1u5 && t2w1r8 < t2h1d5 && t2w1r8 < t2w1rwt5 && t2w1r8 < t2w1lwt5 && t2w1r8 < t2h1uwt5 && t2w1r8 < t2h1dwt5
     && t2w1r8 < t2w1r6 && t2w1r8 < t2w1l6 && t2w1r8 < t2h1u6 && t2w1r8 < t2h1d6 && t2w1r8 < t2w1rwt6 && t2w1r8 < t2w1lwt6 && t2w1r8 < t2h1uwt6 && t2w1r8 < t2h1dwt6
     && t2w1r8 < t2w1r7 && t2w1r8 < t2w1l7 && t2w1r8 < t2h1u7 && t2w1r8 < t2h1d7 && t2w1r8 < t2w1rwt7 && t2w1r8 < t2w1lwt7 && t2w1r8 < t2h1uwt7 && t2w1r8 < t2h1dwt7
     && t2w1r8 < t2w1l8 && t2w1r8 < t2h1u8 && t2w1r8 < t2h1d8 && t2w1r8 < t2w1rwt8 && t2w1r8 < t2w1lwt8 && t2w1r8 < t2h1uwt8 && t2w1r8 < t2h1dwt8
     && t2w1r8 < t2w1r9 && t2w1r8 < t2w1l9 && t2w1r8 < t2h1u9 && t2w1r8 < t2h1d9 && t2w1r8 < t2w1rwt9 && t2w1r8 < t2w1lwt9 && t2w1r8 < t2h1uwt9 && t2w1r8 < t2h1dwt9
     && t2w1r8 < t2w1r10 && t2w1r8 < t2w1l10 && t2w1r8 < t2h1u10 && t2w1r8 < t2h1d10 && t2w1r8 < t2w1rwt10 && t2w1r8 < t2w1lwt10 && t2w1r8 < t2h1uwt10 && t2w1r8 < t2h1dwt10
     && ((loutwr8!=0 && linwr8==0) || (loutwr8==0 && linwr8!=0))){
  i=334;
  }

  if (mxr8==-1 && t2w1r8 > 0 && t2w1r8 < t1 
     && t2w1r8 < t2w1r && t2w1r8 < t2w1l && t2w1r8 < t2h1u && t2w1r8 < t2h1d && t2w1r8 < t2w1rwt && t2w1r8 < t2w1lwt && t2w1r8 < t2h1uwt && t2w1r8 < t2h1dwt
     && t2w1r8 < t2w1r1 && t2w1r8 < t2w1l1 && t2w1r8 < t2h1u1 && t2w1r8 < t2h1d1 && t2w1r8 < t2w1rwt1 && t2w1r8 < t2w1lwt1 && t2w1r8 < t2h1uwt1 && t2w1r8 < t2h1dwt1
     && t2w1r8 < t2w1r2 && t2w1r8 < t2w1l2 && t2w1r8 < t2h1u2 && t2w1r8 < t2h1d2 && t2w1r8 < t2w1rwt2 && t2w1r8 < t2w1lwt2 && t2w1r8 < t2h1uwt2 && t2w1r8 < t2h1dwt2 
     && t2w1r8 < t2w1r3 && t2w1r8 < t2w1l3 && t2w1r8 < t2h1u3 && t2w1r8 < t2h1d3 && t2w1r8 < t2w1rwt3 && t2w1r8 < t2w1lwt3 && t2w1r8 < t2h1uwt3 && t2w1r8 < t2h1dwt3
     && t2w1r8 < t2w1r4 && t2w1r8 < t2w1l4 && t2w1r8 < t2h1u4 && t2w1r8 < t2h1d4 && t2w1r8 < t2w1rwt4 && t2w1r8 < t2w1lwt4 && t2w1r8 < t2h1uwt4 && t2w1r8 < t2h1dwt4
     && t2w1r8 < t2w1r5 && t2w1r8 < t2w1l5 && t2w1r8 < t2h1u5 && t2w1r8 < t2h1d5 && t2w1r8 < t2w1rwt5 && t2w1r8 < t2w1lwt5 && t2w1r8 < t2h1uwt5 && t2w1r8 < t2h1dwt5
     && t2w1r8 < t2w1r6 && t2w1r8 < t2w1l6 && t2w1r8 < t2h1u6 && t2w1r8 < t2h1d6 && t2w1r8 < t2w1rwt6 && t2w1r8 < t2w1lwt6 && t2w1r8 < t2h1uwt6 && t2w1r8 < t2h1dwt6
     && t2w1r8 < t2w1r7 && t2w1r8 < t2w1l7 && t2w1r8 < t2h1u7 && t2w1r8 < t2h1d7 && t2w1r8 < t2w1rwt7 && t2w1r8 < t2w1lwt7 && t2w1r8 < t2h1uwt7 && t2w1r8 < t2h1dwt7
     && t2w1r8 < t2w1l8 && t2w1r8 < t2h1u8 && t2w1r8 < t2h1d8 && t2w1r8 < t2w1rwt8 && t2w1r8 < t2w1lwt8 && t2w1r8 < t2h1uwt8 && t2w1r8 < t2h1dwt8
     && t2w1r8 < t2w1r9 && t2w1r8 < t2w1l9 && t2w1r8 < t2h1u9 && t2w1r8 < t2h1d9 && t2w1r8 < t2w1rwt9 && t2w1r8 < t2w1lwt9 && t2w1r8 < t2h1uwt9 && t2w1r8 < t2h1dwt9
     && t2w1r8 < t2w1r10 && t2w1r8 < t2w1l10 && t2w1r8 < t2h1u10 && t2w1r8 < t2h1d10 && t2w1r8 < t2w1rwt10 && t2w1r8 < t2w1lwt10 && t2w1r8 < t2h1uwt10 && t2w1r8 < t2h1dwt10
     && (loutwr8==0 && linwr8==0)){
  i=334;
  }

  if (mxl8==-1 && t2w1l8 > 0 && t2w1l8 < t1 
      && t2w1l8 < t2w1r && t2w1l8 < t2w1l && t2w1l8 < t2h1u && t2w1l8 < t2h1d && t2w1l8 < t2w1rwt && t2w1l8 < t2w1lwt && t2w1l8 < t2h1uwt && t2w1l8 < t2h1dwt
      && t2w1l8 < t2w1r1 && t2w1l8 < t2w1l1 && t2w1l8 < t2h1u1 && t2w1l8 < t2h1d1 && t2w1l8 < t2w1rwt1 && t2w1l8 < t2w1lwt1 && t2w1l8 < t2h1uwt1 && t2w1l8 < t2h1dwt1
      && t2w1l8 < t2w1r2 && t2w1l8 < t2w1l2 && t2w1l8 < t2h1u2 && t2w1l8 < t2h1d2 && t2w1l8 < t2w1rwt2 && t2w1l8 < t2w1lwt2 && t2w1l8 < t2h1uwt2 && t2w1l8 < t2h1dwt2
      && t2w1l8 < t2w1r3 && t2w1l8 < t2w1l3 && t2w1l8 < t2h1u3 && t2w1l8 < t2h1d3 && t2w1l8 < t2w1rwt3 && t2w1l8 < t2w1lwt3 && t2w1l8 < t2h1uwt3 && t2w1l8 < t2h1dwt3
      && t2w1l8 < t2w1r4 && t2w1l8 < t2w1l4 && t2w1l8 < t2h1u4 && t2w1l8 < t2h1d4 && t2w1l8 < t2w1rwt4 && t2w1l8 < t2w1lwt4 && t2w1l8 < t2h1uwt4 && t2w1l8 < t2h1dwt4
      && t2w1l8 < t2w1r5 && t2w1l8 < t2w1l5 && t2w1l8 < t2h1u5 && t2w1l8 < t2h1d5 && t2w1l8 < t2w1rwt5 && t2w1l8 < t2w1lwt5 && t2w1l8 < t2h1uwt5 && t2w1l8 < t2h1dwt5
      && t2w1l8 < t2w1r6 && t2w1l8 < t2w1l6 && t2w1l8 < t2h1u6 && t2w1l8 < t2h1d6 && t2w1l8 < t2w1rwt6 && t2w1l8 < t2w1lwt6 && t2w1l8 < t2h1uwt6 && t2w1l8 < t2h1dwt6
      && t2w1l8 < t2w1r7 && t2w1l8 < t2w1l7 && t2w1l8 < t2h1u7 && t2w1l8 < t2h1d7 && t2w1l8 < t2w1rwt7 && t2w1l8 < t2w1lwt7 && t2w1l8 < t2h1uwt7 && t2w1l8 < t2h1dwt7
      && t2w1l8 < t2w1r8 && t2w1l8 < t2h1u8 && t2w1l8 < t2h1d8 && t2w1l8 < t2w1rwt8 && t2w1l8 < t2w1lwt8 && t2w1l8 < t2h1uwt8 && t2w1l8 < t2h1dwt8
      && t2w1l8 < t2w1r9 && t2w1l8 < t2w1l9 && t2w1l8 < t2h1u9 && t2w1l8 < t2h1d9 && t2w1l8 < t2w1rwt9 && t2w1l8 < t2w1lwt9 && t2w1l8 < t2h1uwt9 && t2w1l8 < t2h1dwt9
      && t2w1l8 < t2w1r10 && t2w1l8 < t2w1l10 && t2w1l8 < t2h1u10 && t2w1l8 < t2h1d10 && t2w1l8 < t2w1rwt10 && t2w1l8 < t2w1lwt10 && t2w1l8 < t2h1uwt10 && t2w1l8 < t2h1dwt10
      && ((linwl8!=0) && (loutwl8!=0) )){
  i=335;
  }

  if (mxl8==-1 && t2w1l8 > 0 && t2w1l8 < t1 
      && t2w1l8 < t2w1r && t2w1l8 < t2w1l && t2w1l8 < t2h1u && t2w1l8 < t2h1d && t2w1l8 < t2w1rwt && t2w1l8 < t2w1lwt && t2w1l8 < t2h1uwt && t2w1l8 < t2h1dwt
      && t2w1l8 < t2w1r1 && t2w1l8 < t2w1l1 && t2w1l8 < t2h1u1 && t2w1l8 < t2h1d1 && t2w1l8 < t2w1rwt1 && t2w1l8 < t2w1lwt1 && t2w1l8 < t2h1uwt1 && t2w1l8 < t2h1dwt1
      && t2w1l8 < t2w1r2 && t2w1l8 < t2w1l2 && t2w1l8 < t2h1u2 && t2w1l8 < t2h1d2 && t2w1l8 < t2w1rwt2 && t2w1l8 < t2w1lwt2 && t2w1l8 < t2h1uwt2 && t2w1l8 < t2h1dwt2
      && t2w1l8 < t2w1r3 && t2w1l8 < t2w1l3 && t2w1l8 < t2h1u3 && t2w1l8 < t2h1d3 && t2w1l8 < t2w1rwt3 && t2w1l8 < t2w1lwt3 && t2w1l8 < t2h1uwt3 && t2w1l8 < t2h1dwt3
      && t2w1l8 < t2w1r4 && t2w1l8 < t2w1l4 && t2w1l8 < t2h1u4 && t2w1l8 < t2h1d4 && t2w1l8 < t2w1rwt4 && t2w1l8 < t2w1lwt4 && t2w1l8 < t2h1uwt4 && t2w1l8 < t2h1dwt4
      && t2w1l8 < t2w1r5 && t2w1l8 < t2w1l5 && t2w1l8 < t2h1u5 && t2w1l8 < t2h1d5 && t2w1l8 < t2w1rwt5 && t2w1l8 < t2w1lwt5 && t2w1l8 < t2h1uwt5 && t2w1l8 < t2h1dwt5
      && t2w1l8 < t2w1r6 && t2w1l8 < t2w1l6 && t2w1l8 < t2h1u6 && t2w1l8 < t2h1d6 && t2w1l8 < t2w1rwt6 && t2w1l8 < t2w1lwt6 && t2w1l8 < t2h1uwt6 && t2w1l8 < t2h1dwt6
      && t2w1l8 < t2w1r7 && t2w1l8 < t2w1l7 && t2w1l8 < t2h1u7 && t2w1l8 < t2h1d7 && t2w1l8 < t2w1rwt7 && t2w1l8 < t2w1lwt7 && t2w1l8 < t2h1uwt7 && t2w1l8 < t2h1dwt7
      && t2w1l8 < t2w1r8 && t2w1l8 < t2h1u8 && t2w1l8 < t2h1d8 && t2w1l8 < t2w1rwt8 && t2w1l8 < t2w1lwt8 && t2w1l8 < t2h1uwt8 && t2w1l8 < t2h1dwt8
      && t2w1l8 < t2w1r9 && t2w1l8 < t2w1l9 && t2w1l8 < t2h1u9 && t2w1l8 < t2h1d9 && t2w1l8 < t2w1rwt9 && t2w1l8 < t2w1lwt9 && t2w1l8 < t2h1uwt9 && t2w1l8 < t2h1dwt9
      && t2w1l8 < t2w1r10 && t2w1l8 < t2w1l10 && t2w1l8 < t2h1u10 && t2w1l8 < t2h1d10 && t2w1l8 < t2w1rwt10 && t2w1l8 < t2w1lwt10 && t2w1l8 < t2h1uwt10 && t2w1l8 < t2h1dwt10
      &&  ((loutwl8!=0 && linwl8==0) || (loutwl8==0 && linwl8!=0))){
  i=335;
  }

  if (mxl8==-1 && t2w1l8 > 0 && t2w1l8 < t1 
      && t2w1l8 < t2w1r && t2w1l8 < t2w1l && t2w1l8 < t2h1u && t2w1l8 < t2h1d && t2w1l8 < t2w1rwt && t2w1l8 < t2w1lwt && t2w1l8 < t2h1uwt && t2w1l8 < t2h1dwt
      && t2w1l8 < t2w1r1 && t2w1l8 < t2w1l1 && t2w1l8 < t2h1u1 && t2w1l8 < t2h1d1 && t2w1l8 < t2w1rwt1 && t2w1l8 < t2w1lwt1 && t2w1l8 < t2h1uwt1 && t2w1l8 < t2h1dwt1
      && t2w1l8 < t2w1r2 && t2w1l8 < t2w1l2 && t2w1l8 < t2h1u2 && t2w1l8 < t2h1d2 && t2w1l8 < t2w1rwt2 && t2w1l8 < t2w1lwt2 && t2w1l8 < t2h1uwt2 && t2w1l8 < t2h1dwt2
      && t2w1l8 < t2w1r3 && t2w1l8 < t2w1l3 && t2w1l8 < t2h1u3 && t2w1l8 < t2h1d3 && t2w1l8 < t2w1rwt3 && t2w1l8 < t2w1lwt3 && t2w1l8 < t2h1uwt3 && t2w1l8 < t2h1dwt3
      && t2w1l8 < t2w1r4 && t2w1l8 < t2w1l4 && t2w1l8 < t2h1u4 && t2w1l8 < t2h1d4 && t2w1l8 < t2w1rwt4 && t2w1l8 < t2w1lwt4 && t2w1l8 < t2h1uwt4 && t2w1l8 < t2h1dwt4
      && t2w1l8 < t2w1r5 && t2w1l8 < t2w1l5 && t2w1l8 < t2h1u5 && t2w1l8 < t2h1d5 && t2w1l8 < t2w1rwt5 && t2w1l8 < t2w1lwt5 && t2w1l8 < t2h1uwt5 && t2w1l8 < t2h1dwt5
      && t2w1l8 < t2w1r6 && t2w1l8 < t2w1l6 && t2w1l8 < t2h1u6 && t2w1l8 < t2h1d6 && t2w1l8 < t2w1rwt6 && t2w1l8 < t2w1lwt6 && t2w1l8 < t2h1uwt6 && t2w1l8 < t2h1dwt6
      && t2w1l8 < t2w1r7 && t2w1l8 < t2w1l7 && t2w1l8 < t2h1u7 && t2w1l8 < t2h1d7 && t2w1l8 < t2w1rwt7 && t2w1l8 < t2w1lwt7 && t2w1l8 < t2h1uwt7 && t2w1l8 < t2h1dwt7
      && t2w1l8 < t2w1r8 && t2w1l8 < t2h1u8 && t2w1l8 < t2h1d8 && t2w1l8 < t2w1rwt8 && t2w1l8 < t2w1lwt8 && t2w1l8 < t2h1uwt8 && t2w1l8 < t2h1dwt8
      && t2w1l8 < t2w1r9 && t2w1l8 < t2w1l9 && t2w1l8 < t2h1u9 && t2w1l8 < t2h1d9 && t2w1l8 < t2w1rwt9 && t2w1l8 < t2w1lwt9 && t2w1l8 < t2h1uwt9 && t2w1l8 < t2h1dwt9
      && t2w1l8 < t2w1r10 && t2w1l8 < t2w1l10 && t2w1l8 < t2h1u10 && t2w1l8 < t2h1d10 && t2w1l8 < t2w1rwt10 && t2w1l8 < t2w1lwt10 && t2w1l8 < t2h1uwt10 && t2w1l8 < t2h1dwt10
      && (loutwl8==0 && linwl8==0)){
  i=335;
  }

  if (myu8==-1 && t2h1u8 > 0 && t2h1u8 < t1 
  && t2h1u8 < t2w1r && t2h1u8 < t2w1l && t2h1u8 < t2h1u && t2h1u8 < t2h1d && t2h1u8 < t2w1rwt && t2h1u8 < t2w1lwt && t2h1u8 < t2h1uwt && t2h1u8 < t2h1dwt
  && t2h1u8 < t2w1r1 && t2h1u8 < t2w1l1 && t2h1u8 < t2h1u1 && t2h1u8 < t2h1d1 && t2h1u8 < t2w1rwt1 && t2h1u8 < t2w1lwt1 && t2h1u8 < t2h1uwt1 && t2h1u8 < t2h1dwt1
  && t2h1u8 < t2w1r2 && t2h1u8 < t2w1l2 && t2h1u8 < t2h1u2 && t2h1u8 < t2h1d2 && t2h1u8 < t2w1rwt2 && t2h1u8 < t2w1lwt2 && t2h1u8 < t2h1uwt2 && t2h1u8 < t2h1dwt2
  && t2h1u8 < t2w1r3 && t2h1u8 < t2w1l3 && t2h1u8 < t2h1u3 && t2h1u8 < t2h1d3 && t2h1u8 < t2w1rwt3 && t2h1u8 < t2w1lwt3 && t2h1u8 < t2h1uwt3 && t2h1u8 < t2h1dwt3
  && t2h1u8 < t2w1r4 && t2h1u8 < t2w1l4 && t2h1u8 < t2h1u4 && t2h1u8 < t2h1d4 && t2h1u8 < t2w1rwt4 && t2h1u8 < t2w1lwt4 && t2h1u8 < t2h1uwt4 && t2h1u8 < t2h1dwt4
  && t2h1u8 < t2w1r5 && t2h1u8 < t2w1l5 && t2h1u8 < t2h1u5 && t2h1u8 < t2h1d5 && t2h1u8 < t2w1rwt5 && t2h1u8 < t2w1lwt5 && t2h1u8 < t2h1uwt5 && t2h1u8 < t2h1dwt5
  && t2h1u8 < t2w1r6 && t2h1u8 < t2w1l6 && t2h1u8 < t2h1u6 && t2h1u8 < t2h1d6 && t2h1u8 < t2w1rwt6 && t2h1u8 < t2w1lwt6 && t2h1u8 < t2h1uwt6 && t2h1u8 < t2h1dwt6
  && t2h1u8 < t2w1r7 && t2h1u8 < t2w1l7 && t2h1u8 < t2h1u7 && t2h1u8 < t2h1d7 && t2h1u8 < t2w1rwt7 && t2h1u8 < t2w1lwt7 && t2h1u8 < t2h1uwt7 && t2h1u8 < t2h1dwt7
  && t2h1u8 < t2w1r8 && t2h1u8 < t2w1l8 && t2h1u8 < t2h1d8 && t2h1u8 < t2w1rwt8 && t2h1u8 < t2w1lwt8 && t2h1u8 < t2h1uwt8 && t2h1u8 < t2h1dwt8
  && t2h1u8 < t2w1r9 && t2h1u8 < t2w1l9 && t2h1u8 < t2h1u9 && t2h1u8 < t2h1d9 && t2h1u8 < t2w1rwt9 && t2h1u8 < t2w1lwt9 && t2h1u8 < t2h1uwt9 && t2h1u8 < t2h1dwt9
  && t2h1u8 < t2w1r10 && t2h1u8 < t2w1l10 && t2h1u8 < t2h1u10 && t2h1u8 < t2h1d10 && t2h1u8 < t2w1rwt10 && t2h1u8 < t2w1lwt10 && t2h1u8 < t2h1uwt10 && t2h1u8 < t2h1dwt10
  && (louthu8 !=0 && linhu8!=0)){
  i=336;
  }

  if (myu8==-1 && t2h1u8 > 0 && t2h1u8 < t1 
  && t2h1u8 < t2w1r && t2h1u8 < t2w1l && t2h1u8 < t2h1u && t2h1u8 < t2h1d && t2h1u8 < t2w1rwt && t2h1u8 < t2w1lwt && t2h1u8 < t2h1uwt && t2h1u8 < t2h1dwt
  && t2h1u8 < t2w1r1 && t2h1u8 < t2w1l1 && t2h1u8 < t2h1u1 && t2h1u8 < t2h1d1 && t2h1u8 < t2w1rwt1 && t2h1u8 < t2w1lwt1 && t2h1u8 < t2h1uwt1 && t2h1u8 < t2h1dwt1
  && t2h1u8 < t2w1r2 && t2h1u8 < t2w1l2 && t2h1u8 < t2h1u2 && t2h1u8 < t2h1d2 && t2h1u8 < t2w1rwt2 && t2h1u8 < t2w1lwt2 && t2h1u8 < t2h1uwt2 && t2h1u8 < t2h1dwt2
  && t2h1u8 < t2w1r3 && t2h1u8 < t2w1l3 && t2h1u8 < t2h1u3 && t2h1u8 < t2h1d3 && t2h1u8 < t2w1rwt3 && t2h1u8 < t2w1lwt3 && t2h1u8 < t2h1uwt3 && t2h1u8 < t2h1dwt3
  && t2h1u8 < t2w1r4 && t2h1u8 < t2w1l4 && t2h1u8 < t2h1u4 && t2h1u8 < t2h1d4 && t2h1u8 < t2w1rwt4 && t2h1u8 < t2w1lwt4 && t2h1u8 < t2h1uwt4 && t2h1u8 < t2h1dwt4
  && t2h1u8 < t2w1r5 && t2h1u8 < t2w1l5 && t2h1u8 < t2h1u5 && t2h1u8 < t2h1d5 && t2h1u8 < t2w1rwt5 && t2h1u8 < t2w1lwt5 && t2h1u8 < t2h1uwt5 && t2h1u8 < t2h1dwt5
  && t2h1u8 < t2w1r6 && t2h1u8 < t2w1l6 && t2h1u8 < t2h1u6 && t2h1u8 < t2h1d6 && t2h1u8 < t2w1rwt6 && t2h1u8 < t2w1lwt6 && t2h1u8 < t2h1uwt6 && t2h1u8 < t2h1dwt6
  && t2h1u8 < t2w1r7 && t2h1u8 < t2w1l7 && t2h1u8 < t2h1u7 && t2h1u8 < t2h1d7 && t2h1u8 < t2w1rwt7 && t2h1u8 < t2w1lwt7 && t2h1u8 < t2h1uwt7 && t2h1u8 < t2h1dwt7
  && t2h1u8 < t2w1r8 && t2h1u8 < t2w1l8 && t2h1u8 < t2h1d8 && t2h1u8 < t2w1rwt8 && t2h1u8 < t2w1lwt8 && t2h1u8 < t2h1uwt8 && t2h1u8 < t2h1dwt8
  && t2h1u8 < t2w1r9 && t2h1u8 < t2w1l9 && t2h1u8 < t2h1u9 && t2h1u8 < t2h1d9 && t2h1u8 < t2w1rwt9 && t2h1u8 < t2w1lwt9 && t2h1u8 < t2h1uwt9 && t2h1u8 < t2h1dwt9
  && t2h1u8 < t2w1r10 && t2h1u8 < t2w1l10 && t2h1u8 < t2h1u10 && t2h1u8 < t2h1d10 && t2h1u8 < t2w1rwt10 && t2h1u8 < t2w1lwt10 && t2h1u8 < t2h1uwt10 && t2h1u8 < t2h1dwt10
  && ((louthu8!=0 && linhu8==0) || (louthu8==0 && linhu8!=0))){
  i=336;
  }

  if (myu8==-1 && t2h1u8 > 0 && t2h1u8 < t1 
  && t2h1u8 < t2w1r && t2h1u8 < t2w1l && t2h1u8 < t2h1u && t2h1u8 < t2h1d && t2h1u8 < t2w1rwt && t2h1u8 < t2w1lwt && t2h1u8 < t2h1uwt && t2h1u8 < t2h1dwt
  && t2h1u8 < t2w1r1 && t2h1u8 < t2w1l1 && t2h1u8 < t2h1u1 && t2h1u8 < t2h1d1 && t2h1u8 < t2w1rwt1 && t2h1u8 < t2w1lwt1 && t2h1u8 < t2h1uwt1 && t2h1u8 < t2h1dwt1
  && t2h1u8 < t2w1r2 && t2h1u8 < t2w1l2 && t2h1u8 < t2h1u2 && t2h1u8 < t2h1d2 && t2h1u8 < t2w1rwt2 && t2h1u8 < t2w1lwt2 && t2h1u8 < t2h1uwt2 && t2h1u8 < t2h1dwt2
  && t2h1u8 < t2w1r3 && t2h1u8 < t2w1l3 && t2h1u8 < t2h1u3 && t2h1u8 < t2h1d3 && t2h1u8 < t2w1rwt3 && t2h1u8 < t2w1lwt3 && t2h1u8 < t2h1uwt3 && t2h1u8 < t2h1dwt3
  && t2h1u8 < t2w1r4 && t2h1u8 < t2w1l4 && t2h1u8 < t2h1u4 && t2h1u8 < t2h1d4 && t2h1u8 < t2w1rwt4 && t2h1u8 < t2w1lwt4 && t2h1u8 < t2h1uwt4 && t2h1u8 < t2h1dwt4
  && t2h1u8 < t2w1r5 && t2h1u8 < t2w1l5 && t2h1u8 < t2h1u5 && t2h1u8 < t2h1d5 && t2h1u8 < t2w1rwt5 && t2h1u8 < t2w1lwt5 && t2h1u8 < t2h1uwt5 && t2h1u8 < t2h1dwt5
  && t2h1u8 < t2w1r6 && t2h1u8 < t2w1l6 && t2h1u8 < t2h1u6 && t2h1u8 < t2h1d6 && t2h1u8 < t2w1rwt6 && t2h1u8 < t2w1lwt6 && t2h1u8 < t2h1uwt6 && t2h1u8 < t2h1dwt6
  && t2h1u8 < t2w1r7 && t2h1u8 < t2w1l7 && t2h1u8 < t2h1u7 && t2h1u8 < t2h1d7 && t2h1u8 < t2w1rwt7 && t2h1u8 < t2w1lwt7 && t2h1u8 < t2h1uwt7 && t2h1u8 < t2h1dwt7
  && t2h1u8 < t2w1r8 && t2h1u8 < t2w1l8 && t2h1u8 < t2h1d8 && t2h1u8 < t2w1rwt8 && t2h1u8 < t2w1lwt8 && t2h1u8 < t2h1uwt8 && t2h1u8 < t2h1dwt8
  && t2h1u8 < t2w1r9 && t2h1u8 < t2w1l9 && t2h1u8 < t2h1u9 && t2h1u8 < t2h1d9 && t2h1u8 < t2w1rwt9 && t2h1u8 < t2w1lwt9 && t2h1u8 < t2h1uwt9 && t2h1u8 < t2h1dwt9
  && t2h1u8 < t2w1r10 && t2h1u8 < t2w1l10 && t2h1u8 < t2h1u10 && t2h1u8 < t2h1d10 && t2h1u8 < t2w1rwt10 && t2h1u8 < t2w1lwt10 && t2h1u8 < t2h1uwt10 && t2h1u8 < t2h1dwt10
  && (louthu8 == 0 && linhu8 == 0)){
  i=336;
  }

  if (myd8==-1 && t2h1d8 > 0 && t2h1d8 < t1 
  && t2h1d8 < t2w1r && t2h1d8 < t2w1l && t2h1d8 < t2h1u && t2h1d8 < t2h1d && t2h1d8 < t2w1rwt && t2h1d8 < t2w1lwt && t2h1d8 < t2h1uwt && t2h1d8 < t2h1dwt
  && t2h1d8 < t2w1r1 && t2h1d8 < t2w1l1 && t2h1d8 < t2h1u1 && t2h1d8 < t2h1d1 && t2h1d8 < t2w1rwt1 && t2h1d8 < t2w1lwt1 && t2h1d8 < t2h1uwt1 && t2h1d8 < t2h1dwt1
  && t2h1d8 < t2w1r2 && t2h1d8 < t2w1l2 && t2h1d8 < t2h1u2 && t2h1d8 < t2h1d2 && t2h1d8 < t2w1rwt2 && t2h1d8 < t2w1lwt2 && t2h1d8 < t2h1uwt2 && t2h1d8 < t2h1dwt2
  && t2h1d8 < t2w1r3 && t2h1d8 < t2w1l3 && t2h1d8 < t2h1u3 && t2h1d8 < t2h1d3 && t2h1d8 < t2w1rwt3 && t2h1d8 < t2w1lwt3 && t2h1d8 < t2h1uwt3 && t2h1d8 < t2h1dwt3
  && t2h1d8 < t2w1r4 && t2h1d8 < t2w1l4 && t2h1d8 < t2h1u4 && t2h1d8 < t2h1d4 && t2h1d8 < t2w1rwt4 && t2h1d8 < t2w1lwt4 && t2h1d8 < t2h1uwt4 && t2h1d8 < t2h1dwt4
  && t2h1d8 < t2w1r5 && t2h1d8 < t2w1l5 && t2h1d8 < t2h1u5 && t2h1d8 < t2h1d5 && t2h1d8 < t2w1rwt5 && t2h1d8 < t2w1lwt5 && t2h1d8 < t2h1uwt5 && t2h1d8 < t2h1dwt5
  && t2h1d8 < t2w1r6 && t2h1d8 < t2w1l6 && t2h1d8 < t2h1u6 && t2h1d8 < t2h1d6 && t2h1d8 < t2w1rwt6 && t2h1d8 < t2w1lwt6 && t2h1d8 < t2h1uwt6 && t2h1d8 < t2h1dwt6
  && t2h1d8 < t2w1r7 && t2h1d8 < t2w1l7 && t2h1d8 < t2h1u7 && t2h1d8 < t2h1d7 && t2h1d8 < t2w1rwt7 && t2h1d8 < t2w1lwt7 && t2h1d8 < t2h1uwt7 && t2h1d8 < t2h1dwt7
  && t2h1d8 < t2w1r8 && t2h1d8 < t2w1l8 && t2h1d8 < t2h1u8 && t2h1d8 < t2w1rwt8 && t2h1d8 < t2w1lwt8 && t2h1d8 < t2h1uwt8 && t2h1d8 < t2h1dwt8
  && t2h1d8 < t2w1r9 && t2h1d8 < t2w1l9 && t2h1d8 < t2h1u9 && t2h1d8 < t2h1d9 && t2h1d8 < t2w1rwt9 && t2h1d8 < t2w1lwt9 && t2h1d8 < t2h1uwt9 && t2h1d8 < t2h1dwt9
  && t2h1d8 < t2w1r10 && t2h1d8 < t2w1l10 && t2h1d8 < t2h1u10 && t2h1d8 < t2h1d10 && t2h1d8 < t2w1rwt10 && t2h1d8 < t2w1lwt10 && t2h1d8 < t2h1uwt10 && t2h1d8 < t2h1dwt10
  && (louthd8 !=0 && linhd8!=0)){
  i=337;
  }

  if (myd8==-1 && t2h1d8 > 0 && t2h1d8 < t1 
  && t2h1d8 < t2w1r && t2h1d8 < t2w1l && t2h1d8 < t2h1u && t2h1d8 < t2h1d && t2h1d8 < t2w1rwt && t2h1d8 < t2w1lwt && t2h1d8 < t2h1uwt && t2h1d8 < t2h1dwt
  && t2h1d8 < t2w1r1 && t2h1d8 < t2w1l1 && t2h1d8 < t2h1u1 && t2h1d8 < t2h1d1 && t2h1d8 < t2w1rwt1 && t2h1d8 < t2w1lwt1 && t2h1d8 < t2h1uwt1 && t2h1d8 < t2h1dwt1
  && t2h1d8 < t2w1r2 && t2h1d8 < t2w1l2 && t2h1d8 < t2h1u2 && t2h1d8 < t2h1d2 && t2h1d8 < t2w1rwt2 && t2h1d8 < t2w1lwt2 && t2h1d8 < t2h1uwt2 && t2h1d8 < t2h1dwt2
  && t2h1d8 < t2w1r3 && t2h1d8 < t2w1l3 && t2h1d8 < t2h1u3 && t2h1d8 < t2h1d3 && t2h1d8 < t2w1rwt3 && t2h1d8 < t2w1lwt3 && t2h1d8 < t2h1uwt3 && t2h1d8 < t2h1dwt3
  && t2h1d8 < t2w1r4 && t2h1d8 < t2w1l4 && t2h1d8 < t2h1u4 && t2h1d8 < t2h1d4 && t2h1d8 < t2w1rwt4 && t2h1d8 < t2w1lwt4 && t2h1d8 < t2h1uwt4 && t2h1d8 < t2h1dwt4
  && t2h1d8 < t2w1r5 && t2h1d8 < t2w1l5 && t2h1d8 < t2h1u5 && t2h1d8 < t2h1d5 && t2h1d8 < t2w1rwt5 && t2h1d8 < t2w1lwt5 && t2h1d8 < t2h1uwt5 && t2h1d8 < t2h1dwt5
  && t2h1d8 < t2w1r6 && t2h1d8 < t2w1l6 && t2h1d8 < t2h1u6 && t2h1d8 < t2h1d6 && t2h1d8 < t2w1rwt6 && t2h1d8 < t2w1lwt6 && t2h1d8 < t2h1uwt6 && t2h1d8 < t2h1dwt6
  && t2h1d8 < t2w1r7 && t2h1d8 < t2w1l7 && t2h1d8 < t2h1u7 && t2h1d8 < t2h1d7 && t2h1d8 < t2w1rwt7 && t2h1d8 < t2w1lwt7 && t2h1d8 < t2h1uwt7 && t2h1d8 < t2h1dwt7
  && t2h1d8 < t2w1r8 && t2h1d8 < t2w1l8 && t2h1d8 < t2h1u8 && t2h1d8 < t2w1rwt8 && t2h1d8 < t2w1lwt8 && t2h1d8 < t2h1uwt8 && t2h1d8 < t2h1dwt8
  && t2h1d8 < t2w1r9 && t2h1d8 < t2w1l9 && t2h1d8 < t2h1u9 && t2h1d8 < t2h1d9 && t2h1d8 < t2w1rwt9 && t2h1d8 < t2w1lwt9 && t2h1d8 < t2h1uwt9 && t2h1d8 < t2h1dwt9
  && t2h1d8 < t2w1r10 && t2h1d8 < t2w1l10 && t2h1d8 < t2h1u10 && t2h1d8 < t2h1d10 && t2h1d8 < t2w1rwt10 && t2h1d8 < t2w1lwt10 && t2h1d8 < t2h1uwt10 && t2h1d8 < t2h1dwt10
  && ((louthd8 !=0 && linhd8==0) || (louthd8 ==0 && linhd8!=0))){
  i=337;
  }

  if (myd8==-1 && t2h1d8 > 0 && t2h1d8 < t1 
  && t2h1d8 < t2w1r && t2h1d8 < t2w1l && t2h1d8 < t2h1u && t2h1d8 < t2h1d && t2h1d8 < t2w1rwt && t2h1d8 < t2w1lwt && t2h1d8 < t2h1uwt && t2h1d8 < t2h1dwt
  && t2h1d8 < t2w1r1 && t2h1d8 < t2w1l1 && t2h1d8 < t2h1u1 && t2h1d8 < t2h1d1 && t2h1d8 < t2w1rwt1 && t2h1d8 < t2w1lwt1 && t2h1d8 < t2h1uwt1 && t2h1d8 < t2h1dwt1
  && t2h1d8 < t2w1r2 && t2h1d8 < t2w1l2 && t2h1d8 < t2h1u2 && t2h1d8 < t2h1d2 && t2h1d8 < t2w1rwt2 && t2h1d8 < t2w1lwt2 && t2h1d8 < t2h1uwt2 && t2h1d8 < t2h1dwt2
  && t2h1d8 < t2w1r3 && t2h1d8 < t2w1l3 && t2h1d8 < t2h1u3 && t2h1d8 < t2h1d3 && t2h1d8 < t2w1rwt3 && t2h1d8 < t2w1lwt3 && t2h1d8 < t2h1uwt3 && t2h1d8 < t2h1dwt3
  && t2h1d8 < t2w1r4 && t2h1d8 < t2w1l4 && t2h1d8 < t2h1u4 && t2h1d8 < t2h1d4 && t2h1d8 < t2w1rwt4 && t2h1d8 < t2w1lwt4 && t2h1d8 < t2h1uwt4 && t2h1d8 < t2h1dwt4
  && t2h1d8 < t2w1r5 && t2h1d8 < t2w1l5 && t2h1d8 < t2h1u5 && t2h1d8 < t2h1d5 && t2h1d8 < t2w1rwt5 && t2h1d8 < t2w1lwt5 && t2h1d8 < t2h1uwt5 && t2h1d8 < t2h1dwt5
  && t2h1d8 < t2w1r6 && t2h1d8 < t2w1l6 && t2h1d8 < t2h1u6 && t2h1d8 < t2h1d6 && t2h1d8 < t2w1rwt6 && t2h1d8 < t2w1lwt6 && t2h1d8 < t2h1uwt6 && t2h1d8 < t2h1dwt6
  && t2h1d8 < t2w1r7 && t2h1d8 < t2w1l7 && t2h1d8 < t2h1u7 && t2h1d8 < t2h1d7 && t2h1d8 < t2w1rwt7 && t2h1d8 < t2w1lwt7 && t2h1d8 < t2h1uwt7 && t2h1d8 < t2h1dwt7
  && t2h1d8 < t2w1r8 && t2h1d8 < t2w1l8 && t2h1d8 < t2h1u8 && t2h1d8 < t2w1rwt8 && t2h1d8 < t2w1lwt8 && t2h1d8 < t2h1uwt8 && t2h1d8 < t2h1dwt8
  && t2h1d8 < t2w1r9 && t2h1d8 < t2w1l9 && t2h1d8 < t2h1u9 && t2h1d8 < t2h1d9 && t2h1d8 < t2w1rwt9 && t2h1d8 < t2w1lwt9 && t2h1d8 < t2h1uwt9 && t2h1d8 < t2h1dwt9
  && t2h1d8 < t2w1r10 && t2h1d8 < t2w1l10 && t2h1d8 < t2h1u10 && t2h1d8 < t2h1d10 && t2h1d8 < t2w1rwt10 && t2h1d8 < t2w1lwt10 && t2h1d8 < t2h1uwt10 && t2h1d8 < t2h1dwt10
  && (louthd8 == 0 && linhd8 == 0)){
  i=337;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW8!=-1 && t2w1rwt8 > 0 && t2w1rwt8 < t1 
  && t2w1rwt8 < t2w1r && t2w1rwt8 < t2w1l && t2w1rwt8 < t2h1u && t2w1rwt8 < t2h1d && t2w1rwt8 <t2w1rwt && t2w1rwt8 <t2w1lwt && t2w1rwt8 < t2h1uwt && t2w1rwt8 < t2h1dwt
  && t2w1rwt8 < t2w1r1 && t2w1rwt8 < t2w1l1 && t2w1rwt8 < t2h1u1 && t2w1rwt8 < t2h1d1 && t2w1rwt8 <t2w1rwt1 && t2w1rwt8 <t2w1lwt1 && t2w1rwt8 < t2h1uwt1 && t2w1rwt8 < t2h1dwt1
  && t2w1rwt8 < t2w1r2 && t2w1rwt8 < t2w1l2 && t2w1rwt8 < t2h1u2 && t2w1rwt8 < t2h1d2 && t2w1rwt8 <t2w1rwt2 && t2w1rwt8 <t2w1lwt2 && t2w1rwt8 < t2h1uwt2 && t2w1rwt8 < t2h1dwt2
  && t2w1rwt8 < t2w1r3 && t2w1rwt8 < t2w1l3 && t2w1rwt8 < t2h1u3 && t2w1rwt8 < t2h1d3 && t2w1rwt8 <t2w1rwt3 && t2w1rwt8 <t2w1lwt3 && t2w1rwt8 < t2h1uwt3 && t2w1rwt8 < t2h1dwt3
  && t2w1rwt8 < t2w1r4 && t2w1rwt8 < t2w1l4 && t2w1rwt8 < t2h1u4 && t2w1rwt8 < t2h1d4 && t2w1rwt8 <t2w1rwt4 && t2w1rwt8 <t2w1lwt4 && t2w1rwt8 < t2h1uwt4 && t2w1rwt8 < t2h1dwt4
  && t2w1rwt8 < t2w1r5 && t2w1rwt8 < t2w1l5 && t2w1rwt8 < t2h1u5 && t2w1rwt8 < t2h1d5 && t2w1rwt8 <t2w1rwt5 && t2w1rwt8 <t2w1lwt5 && t2w1rwt8 < t2h1uwt5 && t2w1rwt8 < t2h1dwt5
  && t2w1rwt8 < t2w1r6 && t2w1rwt8 < t2w1l6 && t2w1rwt8 < t2h1u6 && t2w1rwt8 < t2h1d6 && t2w1rwt8 <t2w1rwt6 && t2w1rwt8 <t2w1lwt6 && t2w1rwt8 < t2h1uwt6 && t2w1rwt8 < t2h1dwt6
  && t2w1rwt8 < t2w1r7 && t2w1rwt8 < t2w1l7 && t2w1rwt8 < t2h1u7 && t2w1rwt8 < t2h1d7 && t2w1rwt8 <t2w1rwt7 && t2w1rwt8 <t2w1lwt7 && t2w1rwt8 < t2h1uwt7 && t2w1rwt8 < t2h1dwt7
  && t2w1rwt8 < t2w1r8 && t2w1rwt8 < t2w1l8 && t2w1rwt8 < t2h1u8 && t2w1rwt8 < t2h1d8 && t2w1rwt8 <t2w1lwt8 && t2w1rwt8 < t2h1uwt8 && t2w1rwt8 < t2h1dwt8
  && t2w1rwt8 < t2w1r9 && t2w1rwt8 < t2w1l9 && t2w1rwt8 < t2h1u9 && t2w1rwt8 < t2h1d9 && t2w1rwt8 <t2w1rwt9 && t2w1rwt8 <t2w1lwt9 && t2w1rwt8 < t2h1uwt9 && t2w1rwt8 < t2h1dwt9
  && t2w1rwt8 < t2w1r10 && t2w1rwt8 < t2w1l10 && t2w1rwt8 < t2h1u10 && t2w1rwt8 < t2h1d10 && t2w1rwt8 <t2w1rwt10 && t2w1rwt8 <t2w1lwt10 && t2w1rwt8 < t2h1uwt10 && t2w1rwt8 < t2h1dwt10
  && ((linwr8!=0) && (loutwr8!=0) )){	
   if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1rwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1rwt8+z))*(z0hd8+(vz*t2w1rwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1rwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1rwt8+z))*(z0hu8+(vz*t2w1rwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1rwt8+y;
  xtest=vx*t2w1rwt8+x;
  xlimitrwt=-bwrwt8*sqrt(1-((vz*t2w1rwt8+z)+z0wr8)*((vz*t2w1rwt8+z)+z0wr8)/a2wrwt8);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW8 > 0){
  i=342;
  }
  else{
  i=354;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW8!=-1 && t2w1rwt8 > 0 && t2w1rwt8 < t1 
  && t2w1rwt8 < t2w1r && t2w1rwt8 < t2w1l && t2w1rwt8 < t2h1u && t2w1rwt8 < t2h1d && t2w1rwt8 <t2w1rwt && t2w1rwt8 <t2w1lwt && t2w1rwt8 < t2h1uwt && t2w1rwt8 < t2h1dwt
  && t2w1rwt8 < t2w1r1 && t2w1rwt8 < t2w1l1 && t2w1rwt8 < t2h1u1 && t2w1rwt8 < t2h1d1 && t2w1rwt8 <t2w1rwt1 && t2w1rwt8 <t2w1lwt1 && t2w1rwt8 < t2h1uwt1 && t2w1rwt8 < t2h1dwt1
  && t2w1rwt8 < t2w1r2 && t2w1rwt8 < t2w1l2 && t2w1rwt8 < t2h1u2 && t2w1rwt8 < t2h1d2 && t2w1rwt8 <t2w1rwt2 && t2w1rwt8 <t2w1lwt2 && t2w1rwt8 < t2h1uwt2 && t2w1rwt8 < t2h1dwt2
  && t2w1rwt8 < t2w1r3 && t2w1rwt8 < t2w1l3 && t2w1rwt8 < t2h1u3 && t2w1rwt8 < t2h1d3 && t2w1rwt8 <t2w1rwt3 && t2w1rwt8 <t2w1lwt3 && t2w1rwt8 < t2h1uwt3 && t2w1rwt8 < t2h1dwt3
  && t2w1rwt8 < t2w1r4 && t2w1rwt8 < t2w1l4 && t2w1rwt8 < t2h1u4 && t2w1rwt8 < t2h1d4 && t2w1rwt8 <t2w1rwt4 && t2w1rwt8 <t2w1lwt4 && t2w1rwt8 < t2h1uwt4 && t2w1rwt8 < t2h1dwt4
  && t2w1rwt8 < t2w1r5 && t2w1rwt8 < t2w1l5 && t2w1rwt8 < t2h1u5 && t2w1rwt8 < t2h1d5 && t2w1rwt8 <t2w1rwt5 && t2w1rwt8 <t2w1lwt5 && t2w1rwt8 < t2h1uwt5 && t2w1rwt8 < t2h1dwt5
  && t2w1rwt8 < t2w1r6 && t2w1rwt8 < t2w1l6 && t2w1rwt8 < t2h1u6 && t2w1rwt8 < t2h1d6 && t2w1rwt8 <t2w1rwt6 && t2w1rwt8 <t2w1lwt6 && t2w1rwt8 < t2h1uwt6 && t2w1rwt8 < t2h1dwt6
  && t2w1rwt8 < t2w1r7 && t2w1rwt8 < t2w1l7 && t2w1rwt8 < t2h1u7 && t2w1rwt8 < t2h1d7 && t2w1rwt8 <t2w1rwt7 && t2w1rwt8 <t2w1lwt7 && t2w1rwt8 < t2h1uwt7 && t2w1rwt8 < t2h1dwt7
  && t2w1rwt8 < t2w1r8 && t2w1rwt8 < t2w1l8 && t2w1rwt8 < t2h1u8 && t2w1rwt8 < t2h1d8 && t2w1rwt8 <t2w1lwt8 && t2w1rwt8 < t2h1uwt8 && t2w1rwt8 < t2h1dwt8
  && t2w1rwt8 < t2w1r9 && t2w1rwt8 < t2w1l9 && t2w1rwt8 < t2h1u9 && t2w1rwt8 < t2h1d9 && t2w1rwt8 <t2w1rwt9 && t2w1rwt8 <t2w1lwt9 && t2w1rwt8 < t2h1uwt9 && t2w1rwt8 < t2h1dwt9
  && t2w1rwt8 < t2w1r10 && t2w1rwt8 < t2w1l10 && t2w1rwt8 < t2h1u10 && t2w1rwt8 < t2h1d10 && t2w1rwt8 <t2w1rwt10 && t2w1rwt8 <t2w1lwt10 && t2w1rwt8 < t2h1uwt10 && t2w1rwt8 < t2h1dwt10
  && ((loutwr8!=0 && linwr8==0) || (loutwr8==0 && linwr8!=0))){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1rwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1rwt8+z))*(z0hd8+(vz*t2w1rwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1rwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1rwt8+z))*(z0hu8+(vz*t2w1rwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1rwt8+y;
  xtest=vx*t2w1rwt8+x;
  xlimitr=-sqrt((pbwrwt8-(vz*t2w1rwt8+z))/pawrwt8);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW8 > 0){
  i=343; 
  }else{
  i=354;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW8!=-1 && t2w1rwt8 > 0 && t2w1rwt8 < t1 
  && t2w1rwt8 < t2w1r && t2w1rwt8 < t2w1l && t2w1rwt8 < t2h1u && t2w1rwt8 < t2h1d && t2w1rwt8 <t2w1rwt && t2w1rwt8 <t2w1lwt && t2w1rwt8 < t2h1uwt && t2w1rwt8 < t2h1dwt
  && t2w1rwt8 < t2w1r1 && t2w1rwt8 < t2w1l1 && t2w1rwt8 < t2h1u1 && t2w1rwt8 < t2h1d1 && t2w1rwt8 <t2w1rwt1 && t2w1rwt8 <t2w1lwt1 && t2w1rwt8 < t2h1uwt1 && t2w1rwt8 < t2h1dwt1
  && t2w1rwt8 < t2w1r2 && t2w1rwt8 < t2w1l2 && t2w1rwt8 < t2h1u2 && t2w1rwt8 < t2h1d2 && t2w1rwt8 <t2w1rwt2 && t2w1rwt8 <t2w1lwt2 && t2w1rwt8 < t2h1uwt2 && t2w1rwt8 < t2h1dwt2
  && t2w1rwt8 < t2w1r3 && t2w1rwt8 < t2w1l3 && t2w1rwt8 < t2h1u3 && t2w1rwt8 < t2h1d3 && t2w1rwt8 <t2w1rwt3 && t2w1rwt8 <t2w1lwt3 && t2w1rwt8 < t2h1uwt3 && t2w1rwt8 < t2h1dwt3
  && t2w1rwt8 < t2w1r4 && t2w1rwt8 < t2w1l4 && t2w1rwt8 < t2h1u4 && t2w1rwt8 < t2h1d4 && t2w1rwt8 <t2w1rwt4 && t2w1rwt8 <t2w1lwt4 && t2w1rwt8 < t2h1uwt4 && t2w1rwt8 < t2h1dwt4
  && t2w1rwt8 < t2w1r5 && t2w1rwt8 < t2w1l5 && t2w1rwt8 < t2h1u5 && t2w1rwt8 < t2h1d5 && t2w1rwt8 <t2w1rwt5 && t2w1rwt8 <t2w1lwt5 && t2w1rwt8 < t2h1uwt5 && t2w1rwt8 < t2h1dwt5
  && t2w1rwt8 < t2w1r6 && t2w1rwt8 < t2w1l6 && t2w1rwt8 < t2h1u6 && t2w1rwt8 < t2h1d6 && t2w1rwt8 <t2w1rwt6 && t2w1rwt8 <t2w1lwt6 && t2w1rwt8 < t2h1uwt6 && t2w1rwt8 < t2h1dwt6
  && t2w1rwt8 < t2w1r7 && t2w1rwt8 < t2w1l7 && t2w1rwt8 < t2h1u7 && t2w1rwt8 < t2h1d7 && t2w1rwt8 <t2w1rwt7 && t2w1rwt8 <t2w1lwt7 && t2w1rwt8 < t2h1uwt7 && t2w1rwt8 < t2h1dwt7
  && t2w1rwt8 < t2w1r8 && t2w1rwt8 < t2w1l8 && t2w1rwt8 < t2h1u8 && t2w1rwt8 < t2h1d8 && t2w1rwt8 <t2w1lwt8 && t2w1rwt8 < t2h1uwt8 && t2w1rwt8 < t2h1dwt8
  && t2w1rwt8 < t2w1r9 && t2w1rwt8 < t2w1l9 && t2w1rwt8 < t2h1u9 && t2w1rwt8 < t2h1d9 && t2w1rwt8 <t2w1rwt9 && t2w1rwt8 <t2w1lwt9 && t2w1rwt8 < t2h1uwt9 && t2w1rwt8 < t2h1dwt9
  && t2w1rwt8 < t2w1r10 && t2w1rwt8 < t2w1l10 && t2w1rwt8 < t2h1u10 && t2w1rwt8 < t2h1d10 && t2w1rwt8 <t2w1rwt10 && t2w1rwt8 <t2w1lwt10 && t2w1rwt8 < t2h1uwt10 && t2w1rwt8 < t2h1dwt10
  && (loutwr8==0 && linwr8==0)){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1rwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1rwt8+z))*(z0hd8+(vz*t2w1rwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1rwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1rwt8+z))*(z0hu8+(vz*t2w1rwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1rwt8+y; 
  xtest=vx*t2w1rwt8+x;
  xlimitr=-(-w2r8+w1r8)*(vz*t2w1rwt8+z)/l-w1rwt8;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW8>0){
  i=344;
  }else{
  i=354;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW8!=-1 && t2w1lwt8 > 0 && t2w1lwt8 < t1 
  && t2w1lwt8 < t2w1r && t2w1lwt8 < t2w1l && t2w1lwt8 < t2h1u && t2w1lwt8 < t2h1d && t2w1lwt8 <t2w1rwt && t2w1lwt8 <t2w1lwt && t2w1lwt8 < t2h1uwt && t2w1lwt8 < t2h1dwt
  && t2w1lwt8 < t2w1r1 && t2w1lwt8 < t2w1l1 && t2w1lwt8 < t2h1u1 && t2w1lwt8 < t2h1d1 && t2w1lwt8 <t2w1rwt1 && t2w1lwt8 <t2w1lwt1 && t2w1lwt8 < t2h1uwt1 && t2w1lwt8 < t2h1dwt1
  && t2w1lwt8 < t2w1r2 && t2w1lwt8 < t2w1l2 && t2w1lwt8 < t2h1u2 && t2w1lwt8 < t2h1d2 && t2w1lwt8 <t2w1rwt2 && t2w1lwt8 <t2w1lwt2 && t2w1lwt8 < t2h1uwt2 && t2w1lwt8 < t2h1dwt2
  && t2w1lwt8 < t2w1r3 && t2w1lwt8 < t2w1l3 && t2w1lwt8 < t2h1u3 && t2w1lwt8 < t2h1d3 && t2w1lwt8 <t2w1rwt3 && t2w1lwt8 <t2w1lwt3 && t2w1lwt8 < t2h1uwt3 && t2w1lwt8 < t2h1dwt3
  && t2w1lwt8 < t2w1r4 && t2w1lwt8 < t2w1l4 && t2w1lwt8 < t2h1u4 && t2w1lwt8 < t2h1d4 && t2w1lwt8 <t2w1rwt4 && t2w1lwt8 <t2w1lwt4 && t2w1lwt8 < t2h1uwt4 && t2w1lwt8 < t2h1dwt4
  && t2w1lwt8 < t2w1r5 && t2w1lwt8 < t2w1l5 && t2w1lwt8 < t2h1u5 && t2w1lwt8 < t2h1d5 && t2w1lwt8 <t2w1rwt5 && t2w1lwt8 <t2w1lwt5 && t2w1lwt8 < t2h1uwt5 && t2w1lwt8 < t2h1dwt5
  && t2w1lwt8 < t2w1r6 && t2w1lwt8 < t2w1l6 && t2w1lwt8 < t2h1u6 && t2w1lwt8 < t2h1d6 && t2w1lwt8 <t2w1rwt6 && t2w1lwt8 <t2w1lwt6 && t2w1lwt8 < t2h1uwt6 && t2w1lwt8 < t2h1dwt6
  && t2w1lwt8 < t2w1r7 && t2w1lwt8 < t2w1l7 && t2w1lwt8 < t2h1u7 && t2w1lwt8 < t2h1d7 && t2w1lwt8 <t2w1rwt7 && t2w1lwt8 <t2w1lwt7 && t2w1lwt8 < t2h1uwt7 && t2w1lwt8 < t2h1dwt7
  && t2w1lwt8 < t2w1r8 && t2w1lwt8 < t2w1l8 && t2w1lwt8 < t2h1u8 && t2w1lwt8 < t2h1d8 && t2w1lwt8 <t2w1rwt8 && t2w1lwt8 < t2h1uwt8 && t2w1lwt8 < t2h1dwt8
  && t2w1lwt8 < t2w1r9 && t2w1lwt8 < t2w1l9 && t2w1lwt8 < t2h1u9 && t2w1lwt8 < t2h1d9 && t2w1lwt8 <t2w1rwt9 && t2w1lwt8 <t2w1lwt9 && t2w1lwt8 < t2h1uwt9 && t2w1lwt8 < t2h1dwt9
  && t2w1lwt8 < t2w1r10 && t2w1lwt8 < t2w1l10 && t2w1lwt8 < t2h1u10 && t2w1lwt8 < t2h1d10 && t2w1lwt8 <t2w1rwt10 && t2w1lwt8 <t2w1lwt10 && t2w1lwt8 < t2h1uwt10 && t2w1lwt8 < t2h1dwt10
  && ((linwl8!=0) && (loutwl8!=0) )){
  if(linhd8==0 && louthd8==0)
   if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1lwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1lwt8+z))*(z0hd8+(vz*t2w1lwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1lwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1lwt8+z))*(z0hu8+(vz*t2w1lwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1lwt8+y;
  xtest=vx*t2w1lwt8+x;
  xlimitlwt=-bwlwt8*sqrt(1-((vz*t2w1lwt8+z)+z0wl8)*((vz*t2w1lwt8+z)+z0wl8)/a2wlwt8);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW8>0){
  i=345;
  }else{
  i=355;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW8!=-1 && t2w1lwt8 > 0 && t2w1lwt8 < t1 
  && t2w1lwt8 < t2w1r && t2w1lwt8 < t2w1l && t2w1lwt8 < t2h1u && t2w1lwt8 < t2h1d && t2w1lwt8 <t2w1rwt && t2w1lwt8 <t2w1lwt && t2w1lwt8 < t2h1uwt && t2w1lwt8 < t2h1dwt
  && t2w1lwt8 < t2w1r1 && t2w1lwt8 < t2w1l1 && t2w1lwt8 < t2h1u1 && t2w1lwt8 < t2h1d1 && t2w1lwt8 <t2w1rwt1 && t2w1lwt8 <t2w1lwt1 && t2w1lwt8 < t2h1uwt1 && t2w1lwt8 < t2h1dwt1
  && t2w1lwt8 < t2w1r2 && t2w1lwt8 < t2w1l2 && t2w1lwt8 < t2h1u2 && t2w1lwt8 < t2h1d2 && t2w1lwt8 <t2w1rwt2 && t2w1lwt8 <t2w1lwt2 && t2w1lwt8 < t2h1uwt2 && t2w1lwt8 < t2h1dwt2
  && t2w1lwt8 < t2w1r3 && t2w1lwt8 < t2w1l3 && t2w1lwt8 < t2h1u3 && t2w1lwt8 < t2h1d3 && t2w1lwt8 <t2w1rwt3 && t2w1lwt8 <t2w1lwt3 && t2w1lwt8 < t2h1uwt3 && t2w1lwt8 < t2h1dwt3
  && t2w1lwt8 < t2w1r4 && t2w1lwt8 < t2w1l4 && t2w1lwt8 < t2h1u4 && t2w1lwt8 < t2h1d4 && t2w1lwt8 <t2w1rwt4 && t2w1lwt8 <t2w1lwt4 && t2w1lwt8 < t2h1uwt4 && t2w1lwt8 < t2h1dwt4
  && t2w1lwt8 < t2w1r5 && t2w1lwt8 < t2w1l5 && t2w1lwt8 < t2h1u5 && t2w1lwt8 < t2h1d5 && t2w1lwt8 <t2w1rwt5 && t2w1lwt8 <t2w1lwt5 && t2w1lwt8 < t2h1uwt5 && t2w1lwt8 < t2h1dwt5
  && t2w1lwt8 < t2w1r6 && t2w1lwt8 < t2w1l6 && t2w1lwt8 < t2h1u6 && t2w1lwt8 < t2h1d6 && t2w1lwt8 <t2w1rwt6 && t2w1lwt8 <t2w1lwt6 && t2w1lwt8 < t2h1uwt6 && t2w1lwt8 < t2h1dwt6
  && t2w1lwt8 < t2w1r7 && t2w1lwt8 < t2w1l7 && t2w1lwt8 < t2h1u7 && t2w1lwt8 < t2h1d7 && t2w1lwt8 <t2w1rwt7 && t2w1lwt8 <t2w1lwt7 && t2w1lwt8 < t2h1uwt7 && t2w1lwt8 < t2h1dwt7
  && t2w1lwt8 < t2w1r8 && t2w1lwt8 < t2w1l8 && t2w1lwt8 < t2h1u8 && t2w1lwt8 < t2h1d8 && t2w1lwt8 <t2w1rwt8 && t2w1lwt8 < t2h1uwt8 && t2w1lwt8 < t2h1dwt8
  && t2w1lwt8 < t2w1r9 && t2w1lwt8 < t2w1l9 && t2w1lwt8 < t2h1u9 && t2w1lwt8 < t2h1d9 && t2w1lwt8 <t2w1rwt9 && t2w1lwt8 <t2w1lwt9 && t2w1lwt8 < t2h1uwt9 && t2w1lwt8 < t2h1dwt9
  && t2w1lwt8 < t2w1r10 && t2w1lwt8 < t2w1l10 && t2w1lwt8 < t2h1u10 && t2w1lwt8 < t2h1d10 && t2w1lwt8 <t2w1rwt10 && t2w1lwt8 <t2w1lwt10 && t2w1lwt8 < t2h1uwt10 && t2w1lwt8 < t2h1dwt10
  && ((loutwl8!=0 && linwl8==0) || (loutwl8==0 && linwl8!=0))){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1lwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1lwt8+z))*(z0hd8+(vz*t2w1lwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1lwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1lwt8+z))*(z0hu8+(vz*t2w1lwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1lwt8+y;
  xtest=vx*t2w1lwt8+x;
  xlimitl=-sqrt((pbwlwt8-(vz*t2w1lwt8+z))/pawlwt8);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW8>0){
  i=346;
  }else{
  i=355;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW8!=-1 && t2w1lwt8 > 0 && t2w1lwt8 < t1 
  && t2w1lwt8 < t2w1r && t2w1lwt8 < t2w1l && t2w1lwt8 < t2h1u && t2w1lwt8 < t2h1d && t2w1lwt8 <t2w1rwt && t2w1lwt8 <t2w1lwt && t2w1lwt8 < t2h1uwt && t2w1lwt8 < t2h1dwt
  && t2w1lwt8 < t2w1r1 && t2w1lwt8 < t2w1l1 && t2w1lwt8 < t2h1u1 && t2w1lwt8 < t2h1d1 && t2w1lwt8 <t2w1rwt1 && t2w1lwt8 <t2w1lwt1 && t2w1lwt8 < t2h1uwt1 && t2w1lwt8 < t2h1dwt1
  && t2w1lwt8 < t2w1r2 && t2w1lwt8 < t2w1l2 && t2w1lwt8 < t2h1u2 && t2w1lwt8 < t2h1d2 && t2w1lwt8 <t2w1rwt2 && t2w1lwt8 <t2w1lwt2 && t2w1lwt8 < t2h1uwt2 && t2w1lwt8 < t2h1dwt2
  && t2w1lwt8 < t2w1r3 && t2w1lwt8 < t2w1l3 && t2w1lwt8 < t2h1u3 && t2w1lwt8 < t2h1d3 && t2w1lwt8 <t2w1rwt3 && t2w1lwt8 <t2w1lwt3 && t2w1lwt8 < t2h1uwt3 && t2w1lwt8 < t2h1dwt3
  && t2w1lwt8 < t2w1r4 && t2w1lwt8 < t2w1l4 && t2w1lwt8 < t2h1u4 && t2w1lwt8 < t2h1d4 && t2w1lwt8 <t2w1rwt4 && t2w1lwt8 <t2w1lwt4 && t2w1lwt8 < t2h1uwt4 && t2w1lwt8 < t2h1dwt4
  && t2w1lwt8 < t2w1r5 && t2w1lwt8 < t2w1l5 && t2w1lwt8 < t2h1u5 && t2w1lwt8 < t2h1d5 && t2w1lwt8 <t2w1rwt5 && t2w1lwt8 <t2w1lwt5 && t2w1lwt8 < t2h1uwt5 && t2w1lwt8 < t2h1dwt5
  && t2w1lwt8 < t2w1r6 && t2w1lwt8 < t2w1l6 && t2w1lwt8 < t2h1u6 && t2w1lwt8 < t2h1d6 && t2w1lwt8 <t2w1rwt6 && t2w1lwt8 <t2w1lwt6 && t2w1lwt8 < t2h1uwt6 && t2w1lwt8 < t2h1dwt6
  && t2w1lwt8 < t2w1r7 && t2w1lwt8 < t2w1l7 && t2w1lwt8 < t2h1u7 && t2w1lwt8 < t2h1d7 && t2w1lwt8 <t2w1rwt7 && t2w1lwt8 <t2w1lwt7 && t2w1lwt8 < t2h1uwt7 && t2w1lwt8 < t2h1dwt7
  && t2w1lwt8 < t2w1r8 && t2w1lwt8 < t2w1l8 && t2w1lwt8 < t2h1u8 && t2w1lwt8 < t2h1d8 && t2w1lwt8 <t2w1rwt8 && t2w1lwt8 < t2h1uwt8 && t2w1lwt8 < t2h1dwt8
  && t2w1lwt8 < t2w1r9 && t2w1lwt8 < t2w1l9 && t2w1lwt8 < t2h1u9 && t2w1lwt8 < t2h1d9 && t2w1lwt8 <t2w1rwt9 && t2w1lwt8 <t2w1lwt9 && t2w1lwt8 < t2h1uwt9 && t2w1lwt8 < t2h1dwt9
  && t2w1lwt8 < t2w1r10 && t2w1lwt8 < t2w1l10 && t2w1lwt8 < t2h1u10 && t2w1lwt8 < t2h1d10 && t2w1lwt8 <t2w1rwt10 && t2w1lwt8 <t2w1lwt10 && t2w1lwt8 < t2h1uwt10 && t2w1lwt8 < t2h1dwt10
  && (loutwl8==0 && linwl8==0)){
  if(linhd8==0 && louthd8==0)
   {
      ylimitd=(-h2d8+h1d8)/l*(vz*t2w1lwt8+z)-h1dwt8;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ylimitd=-bhdwt8*sqrt(1-((z0hd8+(vz*t2w1lwt8+z))*(z0hd8+(vz*t2w1lwt8+z)))/a2hdwt8);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt8+z)-pbhdwt8)/-pahdwt8);
      }
   }
   if(linhu8==0 && louthu8==0)
    {
     ylimitu=(h2u8-h1u8)/l*(vz*t2w1lwt8+z)+h1uwt8;
    }else{
     if(linhu8!=0 && louthu8!=0)
     {
     ylimitu=bhuwt8*sqrt(1-((z0hu8+(vz*t2w1lwt8+z))*(z0hu8+(vz*t2w1lwt8+z)))/a2huwt8);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt8+z)-pbhuwt8)/-pahuwt8);
    }
    }
  ytest=vy*t2w1lwt8+y; 
  xtest=vx*t2w1lwt8+x;
  xlimitl=(w2l8-w1l8)*(vz*t2w1lwt8+z)/l+w1lwt8;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW8>0){
  i=347;
  }else{
  i=355;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW8!=-1 && t2h1uwt8 > 0 && t2h1uwt8 < t1 
  && t2h1uwt8 < t2w1r && t2h1uwt8 < t2w1l && t2h1uwt8 < t2h1u && t2h1uwt8 < t2h1d && t2h1uwt8 < t2w1rwt && t2h1uwt8 < t2w1lwt && t2h1uwt8 < t2h1uwt && t2h1uwt8 < t2h1dwt 
  && t2h1uwt8 < t2w1r1 && t2h1uwt8 < t2w1l1 && t2h1uwt8 < t2h1u1 && t2h1uwt8 < t2h1d1 && t2h1uwt8 < t2w1rwt1 && t2h1uwt8 < t2w1lwt1 && t2h1uwt8 < t2h1uwt1 && t2h1uwt8 < t2h1dwt1
  && t2h1uwt8 < t2w1r2 && t2h1uwt8 < t2w1l2 && t2h1uwt8 < t2h1u2 && t2h1uwt8 < t2h1d2 && t2h1uwt8 < t2w1rwt2 && t2h1uwt8 < t2w1lwt2 && t2h1uwt8 < t2h1uwt2 && t2h1uwt8 < t2h1dwt2
  && t2h1uwt8 < t2w1r3 && t2h1uwt8 < t2w1l3 && t2h1uwt8 < t2h1u3 && t2h1uwt8 < t2h1d3 && t2h1uwt8 < t2w1rwt3 && t2h1uwt8 < t2w1lwt3 && t2h1uwt8 < t2h1uwt3 && t2h1uwt8 < t2h1dwt3
  && t2h1uwt8 < t2w1r4 && t2h1uwt8 < t2w1l4 && t2h1uwt8 < t2h1u4 && t2h1uwt8 < t2h1d4 && t2h1uwt8 < t2w1rwt4 && t2h1uwt8 < t2w1lwt4 && t2h1uwt8 < t2h1uwt4 && t2h1uwt8 < t2h1dwt4
  && t2h1uwt8 < t2w1r5 && t2h1uwt8 < t2w1l5 && t2h1uwt8 < t2h1u5 && t2h1uwt8 < t2h1d5 && t2h1uwt8 < t2w1rwt5 && t2h1uwt8 < t2w1lwt5 && t2h1uwt8 < t2h1uwt5 && t2h1uwt8 < t2h1dwt5
  && t2h1uwt8 < t2w1r6 && t2h1uwt8 < t2w1l6 && t2h1uwt8 < t2h1u6 && t2h1uwt8 < t2h1d6 && t2h1uwt8 < t2w1rwt6 && t2h1uwt8 < t2w1lwt6 && t2h1uwt8 < t2h1uwt6 && t2h1uwt8 < t2h1dwt6
  && t2h1uwt8 < t2w1r7 && t2h1uwt8 < t2w1l7 && t2h1uwt8 < t2h1u7 && t2h1uwt8 < t2h1d7 && t2h1uwt8 < t2w1rwt7 && t2h1uwt8 < t2w1lwt7 && t2h1uwt8 < t2h1uwt7 && t2h1uwt8 < t2h1dwt7
  && t2h1uwt8 < t2w1r8 && t2h1uwt8 < t2w1l8 && t2h1uwt8 < t2h1u8 && t2h1uwt8 < t2h1d8 && t2h1uwt8 < t2w1rwt8 && t2h1uwt8 < t2w1lwt8 && t2h1uwt8 < t2h1dwt8
  && t2h1uwt8 < t2w1r9 && t2h1uwt8 < t2w1l9 && t2h1uwt8 < t2h1u9 && t2h1uwt8 < t2h1d9 && t2h1uwt8 < t2w1rwt9 && t2h1uwt8 < t2w1lwt9 && t2h1uwt8 < t2h1uwt9 && t2h1uwt8 < t2h1dwt9
  && t2h1uwt8 < t2w1r10 && t2h1uwt8 < t2w1l10 && t2h1uwt8 < t2h1u10 && t2h1uwt8 < t2h1d10 && t2h1uwt8 < t2w1rwt10 && t2h1uwt8 < t2w1lwt10 && t2h1uwt8 < t2h1uwt10 && t2h1uwt8 < t2h1dwt10
  && (louthu8 !=0 && linhu8!=0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1uwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1uwt8+z))*(z0wr8+(vz*t2h1uwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1uwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1uwt8+z))*(z0wl8+(vz*t2h1uwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1uwt8+x;
  ytest=vy*t2w1lwt8+y;
  ylimitu=bhuwt8*sqrt(1-((vz*t2h1uwt8+z)+z0hu8)*((vz*t2h1uwt8+z)+z0hu8)/a2huwt8);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW8>0 ){
  i=348;
  }else{
  i=356;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW8!=-1 && t2h1uwt8 > 0 && t2h1uwt8 < t1 
  && t2h1uwt8 < t2w1r && t2h1uwt8 < t2w1l && t2h1uwt8 < t2h1u && t2h1uwt8 < t2h1d && t2h1uwt8 < t2w1rwt && t2h1uwt8 < t2w1lwt && t2h1uwt8 < t2h1uwt && t2h1uwt8 < t2h1dwt 
  && t2h1uwt8 < t2w1r1 && t2h1uwt8 < t2w1l1 && t2h1uwt8 < t2h1u1 && t2h1uwt8 < t2h1d1 && t2h1uwt8 < t2w1rwt1 && t2h1uwt8 < t2w1lwt1 && t2h1uwt8 < t2h1uwt1 && t2h1uwt8 < t2h1dwt1
  && t2h1uwt8 < t2w1r2 && t2h1uwt8 < t2w1l2 && t2h1uwt8 < t2h1u2 && t2h1uwt8 < t2h1d2 && t2h1uwt8 < t2w1rwt2 && t2h1uwt8 < t2w1lwt2 && t2h1uwt8 < t2h1uwt2 && t2h1uwt8 < t2h1dwt2
  && t2h1uwt8 < t2w1r3 && t2h1uwt8 < t2w1l3 && t2h1uwt8 < t2h1u3 && t2h1uwt8 < t2h1d3 && t2h1uwt8 < t2w1rwt3 && t2h1uwt8 < t2w1lwt3 && t2h1uwt8 < t2h1uwt3 && t2h1uwt8 < t2h1dwt3
  && t2h1uwt8 < t2w1r4 && t2h1uwt8 < t2w1l4 && t2h1uwt8 < t2h1u4 && t2h1uwt8 < t2h1d4 && t2h1uwt8 < t2w1rwt4 && t2h1uwt8 < t2w1lwt4 && t2h1uwt8 < t2h1uwt4 && t2h1uwt8 < t2h1dwt4
  && t2h1uwt8 < t2w1r5 && t2h1uwt8 < t2w1l5 && t2h1uwt8 < t2h1u5 && t2h1uwt8 < t2h1d5 && t2h1uwt8 < t2w1rwt5 && t2h1uwt8 < t2w1lwt5 && t2h1uwt8 < t2h1uwt5 && t2h1uwt8 < t2h1dwt5
  && t2h1uwt8 < t2w1r6 && t2h1uwt8 < t2w1l6 && t2h1uwt8 < t2h1u6 && t2h1uwt8 < t2h1d6 && t2h1uwt8 < t2w1rwt6 && t2h1uwt8 < t2w1lwt6 && t2h1uwt8 < t2h1uwt6 && t2h1uwt8 < t2h1dwt6
  && t2h1uwt8 < t2w1r7 && t2h1uwt8 < t2w1l7 && t2h1uwt8 < t2h1u7 && t2h1uwt8 < t2h1d7 && t2h1uwt8 < t2w1rwt7 && t2h1uwt8 < t2w1lwt7 && t2h1uwt8 < t2h1uwt7 && t2h1uwt8 < t2h1dwt7
  && t2h1uwt8 < t2w1r8 && t2h1uwt8 < t2w1l8 && t2h1uwt8 < t2h1u8 && t2h1uwt8 < t2h1d8 && t2h1uwt8 < t2w1rwt8 && t2h1uwt8 < t2w1lwt8 && t2h1uwt8 < t2h1dwt8
  && t2h1uwt8 < t2w1r9 && t2h1uwt8 < t2w1l9 && t2h1uwt8 < t2h1u9 && t2h1uwt8 < t2h1d9 && t2h1uwt8 < t2w1rwt9 && t2h1uwt8 < t2w1lwt9 && t2h1uwt8 < t2h1uwt9 && t2h1uwt8 < t2h1dwt9
  && t2h1uwt8 < t2w1r10 && t2h1uwt8 < t2w1l10 && t2h1uwt8 < t2h1u10 && t2h1uwt8 < t2h1d10 && t2h1uwt8 < t2w1rwt10 && t2h1uwt8 < t2w1lwt10 && t2h1uwt8 < t2h1uwt10 && t2h1uwt8 < t2h1dwt10
  && ((louthu8!=0 && linhu8==0) || (louthu8==0 && linhu8!=0))){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1uwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1uwt8+z))*(z0wr8+(vz*t2h1uwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1uwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1uwt8+z))*(z0wl8+(vz*t2h1uwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1uwt8+x;
  ytest=vy*t2w1lwt8+y;
  ylimitu=sqrt((pbhuwt8-(vz*t2h1uwt8+z))/pahuwt8);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW8>0){
  i=349;
  }else{
  i=356;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW8!=-1 && t2h1uwt8 > 0 && t2h1uwt8 < t1 
  && t2h1uwt8 < t2w1r && t2h1uwt8 < t2w1l && t2h1uwt8 < t2h1u && t2h1uwt8 < t2h1d && t2h1uwt8 < t2w1rwt && t2h1uwt8 < t2w1lwt && t2h1uwt8 < t2h1uwt && t2h1uwt8 < t2h1dwt 
  && t2h1uwt8 < t2w1r1 && t2h1uwt8 < t2w1l1 && t2h1uwt8 < t2h1u1 && t2h1uwt8 < t2h1d1 && t2h1uwt8 < t2w1rwt1 && t2h1uwt8 < t2w1lwt1 && t2h1uwt8 < t2h1uwt1 && t2h1uwt8 < t2h1dwt1
  && t2h1uwt8 < t2w1r2 && t2h1uwt8 < t2w1l2 && t2h1uwt8 < t2h1u2 && t2h1uwt8 < t2h1d2 && t2h1uwt8 < t2w1rwt2 && t2h1uwt8 < t2w1lwt2 && t2h1uwt8 < t2h1uwt2 && t2h1uwt8 < t2h1dwt2
  && t2h1uwt8 < t2w1r3 && t2h1uwt8 < t2w1l3 && t2h1uwt8 < t2h1u3 && t2h1uwt8 < t2h1d3 && t2h1uwt8 < t2w1rwt3 && t2h1uwt8 < t2w1lwt3 && t2h1uwt8 < t2h1uwt3 && t2h1uwt8 < t2h1dwt3
  && t2h1uwt8 < t2w1r4 && t2h1uwt8 < t2w1l4 && t2h1uwt8 < t2h1u4 && t2h1uwt8 < t2h1d4 && t2h1uwt8 < t2w1rwt4 && t2h1uwt8 < t2w1lwt4 && t2h1uwt8 < t2h1uwt4 && t2h1uwt8 < t2h1dwt4
  && t2h1uwt8 < t2w1r5 && t2h1uwt8 < t2w1l5 && t2h1uwt8 < t2h1u5 && t2h1uwt8 < t2h1d5 && t2h1uwt8 < t2w1rwt5 && t2h1uwt8 < t2w1lwt5 && t2h1uwt8 < t2h1uwt5 && t2h1uwt8 < t2h1dwt5
  && t2h1uwt8 < t2w1r6 && t2h1uwt8 < t2w1l6 && t2h1uwt8 < t2h1u6 && t2h1uwt8 < t2h1d6 && t2h1uwt8 < t2w1rwt6 && t2h1uwt8 < t2w1lwt6 && t2h1uwt8 < t2h1uwt6 && t2h1uwt8 < t2h1dwt6
  && t2h1uwt8 < t2w1r7 && t2h1uwt8 < t2w1l7 && t2h1uwt8 < t2h1u7 && t2h1uwt8 < t2h1d7 && t2h1uwt8 < t2w1rwt7 && t2h1uwt8 < t2w1lwt7 && t2h1uwt8 < t2h1uwt7 && t2h1uwt8 < t2h1dwt7
  && t2h1uwt8 < t2w1r8 && t2h1uwt8 < t2w1l8 && t2h1uwt8 < t2h1u8 && t2h1uwt8 < t2h1d8 && t2h1uwt8 < t2w1rwt8 && t2h1uwt8 < t2w1lwt8 && t2h1uwt8 < t2h1dwt8
  && t2h1uwt8 < t2w1r9 && t2h1uwt8 < t2w1l9 && t2h1uwt8 < t2h1u9 && t2h1uwt8 < t2h1d9 && t2h1uwt8 < t2w1rwt9 && t2h1uwt8 < t2w1lwt9 && t2h1uwt8 < t2h1uwt9 && t2h1uwt8 < t2h1dwt9
  && t2h1uwt8 < t2w1r10 && t2h1uwt8 < t2w1l10 && t2h1uwt8 < t2h1u10 && t2h1uwt8 < t2h1d10 && t2h1uwt8 < t2w1rwt10 && t2h1uwt8 < t2w1lwt10 && t2h1uwt8 < t2h1uwt10 && t2h1uwt8 < t2h1dwt10
  && (louthu8 == 0 && linhu8 == 0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1uwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1uwt8+z))*(z0wr8+(vz*t2h1uwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1uwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1uwt8+z))*(z0wl8+(vz*t2h1uwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1uwt8+x;
  ytest=vy*t2w1lwt8+y;
  ylimitu=(h2u8-h1u8)*(vz*t2h1uwt8+z)/l+h1uwt8;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW8>0 ){
  i=350;
  }else{
  i=356;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW8!=-1 && t2h1dwt8 > 0 && t2h1dwt8 < t1 
  && t2h1dwt8 < t2w1r && t2h1dwt8 < t2w1l && t2h1dwt8 < t2h1u && t2h1dwt8 < t2h1d && t2h1dwt8 < t2w1rwt && t2h1dwt8 < t2w1lwt && t2h1dwt8 < t2h1uwt && t2h1dwt8 < t2h1dwt 
  && t2h1dwt8 < t2w1r1 && t2h1dwt8 < t2w1l1 && t2h1dwt8 < t2h1u1 && t2h1dwt8 < t2h1d1 && t2h1dwt8 < t2w1rwt1 && t2h1dwt8 < t2w1lwt1 && t2h1dwt8 < t2h1uwt1 && t2h1dwt8 < t2h1dwt1
  && t2h1dwt8 < t2w1r2 && t2h1dwt8 < t2w1l2 && t2h1dwt8 < t2h1u2 && t2h1dwt8 < t2h1d2 && t2h1dwt8 < t2w1rwt2 && t2h1dwt8 < t2w1lwt2 && t2h1dwt8 < t2h1uwt2 && t2h1dwt8 < t2h1dwt2 
  && t2h1dwt8 < t2w1r3 && t2h1dwt8 < t2w1l3 && t2h1dwt8 < t2h1u3 && t2h1dwt8 < t2h1d3 && t2h1dwt8 < t2w1rwt3 && t2h1dwt8 < t2w1lwt3 && t2h1dwt8 < t2h1uwt3 && t2h1dwt8 < t2h1dwt3
  && t2h1dwt8 < t2w1r4 && t2h1dwt8 < t2w1l4 && t2h1dwt8 < t2h1u4 && t2h1dwt8 < t2h1d4 && t2h1dwt8 < t2w1rwt4 && t2h1dwt8 < t2w1lwt4 && t2h1dwt8 < t2h1uwt4 && t2h1dwt8 < t2h1dwt4
  && t2h1dwt8 < t2w1r5 && t2h1dwt8 < t2w1l5 && t2h1dwt8 < t2h1u5 && t2h1dwt8 < t2h1d5 && t2h1dwt8 < t2w1rwt5 && t2h1dwt8 < t2w1lwt5 && t2h1dwt8 < t2h1uwt5 && t2h1dwt8 < t2h1dwt5
  && t2h1dwt8 < t2w1r6 && t2h1dwt8 < t2w1l6 && t2h1dwt8 < t2h1u6 && t2h1dwt8 < t2h1d6 && t2h1dwt8 < t2w1rwt6 && t2h1dwt8 < t2w1lwt6 && t2h1dwt8 < t2h1uwt6 && t2h1dwt8 < t2h1dwt6
  && t2h1dwt8 < t2w1r7 && t2h1dwt8 < t2w1l7 && t2h1dwt8 < t2h1u7 && t2h1dwt8 < t2h1d7 && t2h1dwt8 < t2w1rwt7 && t2h1dwt8 < t2w1lwt7 && t2h1dwt8 < t2h1uwt7 && t2h1dwt8 < t2h1dwt7 
  && t2h1dwt8 < t2w1r8 && t2h1dwt8 < t2w1l8 && t2h1dwt8 < t2h1u8 && t2h1dwt8 < t2h1d8 && t2h1dwt8 < t2w1rwt8 && t2h1dwt8 < t2w1lwt8 && t2h1dwt8 < t2h1uwt8 
  && t2h1dwt8 < t2w1r9 && t2h1dwt8 < t2w1l9 && t2h1dwt8 < t2h1u9 && t2h1dwt8 < t2h1d9 && t2h1dwt8 < t2w1rwt9 && t2h1dwt8 < t2w1lwt9 && t2h1dwt8 < t2h1uwt9 && t2h1dwt8 < t2h1dwt9 
  && t2h1dwt8 < t2w1r10 && t2h1dwt8 < t2w1l10 && t2h1dwt8 < t2h1u10 && t2h1dwt8 < t2h1d10 && t2h1dwt8 < t2w1rwt10 && t2h1dwt8 < t2w1lwt10 && t2h1dwt8 < t2h1uwt10 && t2h1dwt8 < t2h1dwt10  
  && (louthd8 !=0 && linhd8!=0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1dwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1dwt8+z))*(z0wr8+(vz*t2h1dwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1dwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1dwt8+z))*(z0wl8+(vz*t2h1dwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1dwt8+x;
  ytest=vy*t2w1lwt8+y;
  ylimitd=-bhdwt8*sqrt(1-((vz*t2h1dwt8+z)+z0hd8)*((vz*t2h1dwt8+z)+z0hd8)/a2hdwt8);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW8>0){
  i=351;
  }else{
  i=357;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW8!=-1 && t2h1dwt8 > 0 && t2h1dwt8 < t1 
  && t2h1dwt8 < t2w1r && t2h1dwt8 < t2w1l && t2h1dwt8 < t2h1u && t2h1dwt8 < t2h1d && t2h1dwt8 < t2w1rwt && t2h1dwt8 < t2w1lwt && t2h1dwt8 < t2h1uwt && t2h1dwt8 < t2h1dwt 
  && t2h1dwt8 < t2w1r1 && t2h1dwt8 < t2w1l1 && t2h1dwt8 < t2h1u1 && t2h1dwt8 < t2h1d1 && t2h1dwt8 < t2w1rwt1 && t2h1dwt8 < t2w1lwt1 && t2h1dwt8 < t2h1uwt1 && t2h1dwt8 < t2h1dwt1
  && t2h1dwt8 < t2w1r2 && t2h1dwt8 < t2w1l2 && t2h1dwt8 < t2h1u2 && t2h1dwt8 < t2h1d2 && t2h1dwt8 < t2w1rwt2 && t2h1dwt8 < t2w1lwt2 && t2h1dwt8 < t2h1uwt2 && t2h1dwt8 < t2h1dwt2 
  && t2h1dwt8 < t2w1r3 && t2h1dwt8 < t2w1l3 && t2h1dwt8 < t2h1u3 && t2h1dwt8 < t2h1d3 && t2h1dwt8 < t2w1rwt3 && t2h1dwt8 < t2w1lwt3 && t2h1dwt8 < t2h1uwt3 && t2h1dwt8 < t2h1dwt3
  && t2h1dwt8 < t2w1r4 && t2h1dwt8 < t2w1l4 && t2h1dwt8 < t2h1u4 && t2h1dwt8 < t2h1d4 && t2h1dwt8 < t2w1rwt4 && t2h1dwt8 < t2w1lwt4 && t2h1dwt8 < t2h1uwt4 && t2h1dwt8 < t2h1dwt4
  && t2h1dwt8 < t2w1r5 && t2h1dwt8 < t2w1l5 && t2h1dwt8 < t2h1u5 && t2h1dwt8 < t2h1d5 && t2h1dwt8 < t2w1rwt5 && t2h1dwt8 < t2w1lwt5 && t2h1dwt8 < t2h1uwt5 && t2h1dwt8 < t2h1dwt5
  && t2h1dwt8 < t2w1r6 && t2h1dwt8 < t2w1l6 && t2h1dwt8 < t2h1u6 && t2h1dwt8 < t2h1d6 && t2h1dwt8 < t2w1rwt6 && t2h1dwt8 < t2w1lwt6 && t2h1dwt8 < t2h1uwt6 && t2h1dwt8 < t2h1dwt6
  && t2h1dwt8 < t2w1r7 && t2h1dwt8 < t2w1l7 && t2h1dwt8 < t2h1u7 && t2h1dwt8 < t2h1d7 && t2h1dwt8 < t2w1rwt7 && t2h1dwt8 < t2w1lwt7 && t2h1dwt8 < t2h1uwt7 && t2h1dwt8 < t2h1dwt7 
  && t2h1dwt8 < t2w1r8 && t2h1dwt8 < t2w1l8 && t2h1dwt8 < t2h1u8 && t2h1dwt8 < t2h1d8 && t2h1dwt8 < t2w1rwt8 && t2h1dwt8 < t2w1lwt8 && t2h1dwt8 < t2h1uwt8 
  && t2h1dwt8 < t2w1r9 && t2h1dwt8 < t2w1l9 && t2h1dwt8 < t2h1u9 && t2h1dwt8 < t2h1d9 && t2h1dwt8 < t2w1rwt9 && t2h1dwt8 < t2w1lwt9 && t2h1dwt8 < t2h1uwt9 && t2h1dwt8 < t2h1dwt9 
  && t2h1dwt8 < t2w1r10 && t2h1dwt8 < t2w1l10 && t2h1dwt8 < t2h1u10 && t2h1dwt8 < t2h1d10 && t2h1dwt8 < t2w1rwt10 && t2h1dwt8 < t2w1lwt10 && t2h1dwt8 < t2h1uwt10 && t2h1dwt8 < t2h1dwt10
  && ((louthd8 !=0 && linhd8==0) || (louthd8 ==0 && linhd8!=0))){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1dwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1dwt8+z))*(z0wr8+(vz*t2h1dwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
     xlimitl=(w2l8-w1l8)/l*(vz*t2h1dwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1dwt8+z))*(z0wl8+(vz*t2h1dwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1dwt8+x;
  ytest=vy*t2w1lwt8+y;
  ylimitd=-sqrt((pbhdwt8-(vz*t2h1dwt8+z))/pahdwt8);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW8>0 ){
  i=352;
  }else{
  i=357;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW8!=-1 && t2h1dwt8 > 0 && t2h1dwt8 < t1 
  && t2h1dwt8 < t2w1r && t2h1dwt8 < t2w1l && t2h1dwt8 < t2h1u && t2h1dwt8 < t2h1d && t2h1dwt8 < t2w1rwt && t2h1dwt8 < t2w1lwt && t2h1dwt8 < t2h1uwt && t2h1dwt8 < t2h1dwt 
  && t2h1dwt8 < t2w1r1 && t2h1dwt8 < t2w1l1 && t2h1dwt8 < t2h1u1 && t2h1dwt8 < t2h1d1 && t2h1dwt8 < t2w1rwt1 && t2h1dwt8 < t2w1lwt1 && t2h1dwt8 < t2h1uwt1 && t2h1dwt8 < t2h1dwt1
  && t2h1dwt8 < t2w1r2 && t2h1dwt8 < t2w1l2 && t2h1dwt8 < t2h1u2 && t2h1dwt8 < t2h1d2 && t2h1dwt8 < t2w1rwt2 && t2h1dwt8 < t2w1lwt2 && t2h1dwt8 < t2h1uwt2 && t2h1dwt8 < t2h1dwt2 
  && t2h1dwt8 < t2w1r3 && t2h1dwt8 < t2w1l3 && t2h1dwt8 < t2h1u3 && t2h1dwt8 < t2h1d3 && t2h1dwt8 < t2w1rwt3 && t2h1dwt8 < t2w1lwt3 && t2h1dwt8 < t2h1uwt3 && t2h1dwt8 < t2h1dwt3
  && t2h1dwt8 < t2w1r4 && t2h1dwt8 < t2w1l4 && t2h1dwt8 < t2h1u4 && t2h1dwt8 < t2h1d4 && t2h1dwt8 < t2w1rwt4 && t2h1dwt8 < t2w1lwt4 && t2h1dwt8 < t2h1uwt4 && t2h1dwt8 < t2h1dwt4
  && t2h1dwt8 < t2w1r5 && t2h1dwt8 < t2w1l5 && t2h1dwt8 < t2h1u5 && t2h1dwt8 < t2h1d5 && t2h1dwt8 < t2w1rwt5 && t2h1dwt8 < t2w1lwt5 && t2h1dwt8 < t2h1uwt5 && t2h1dwt8 < t2h1dwt5
  && t2h1dwt8 < t2w1r6 && t2h1dwt8 < t2w1l6 && t2h1dwt8 < t2h1u6 && t2h1dwt8 < t2h1d6 && t2h1dwt8 < t2w1rwt6 && t2h1dwt8 < t2w1lwt6 && t2h1dwt8 < t2h1uwt6 && t2h1dwt8 < t2h1dwt6
  && t2h1dwt8 < t2w1r7 && t2h1dwt8 < t2w1l7 && t2h1dwt8 < t2h1u7 && t2h1dwt8 < t2h1d7 && t2h1dwt8 < t2w1rwt7 && t2h1dwt8 < t2w1lwt7 && t2h1dwt8 < t2h1uwt7 && t2h1dwt8 < t2h1dwt7 
  && t2h1dwt8 < t2w1r8 && t2h1dwt8 < t2w1l8 && t2h1dwt8 < t2h1u8 && t2h1dwt8 < t2h1d8 && t2h1dwt8 < t2w1rwt8 && t2h1dwt8 < t2w1lwt8 && t2h1dwt8 < t2h1uwt8 
  && t2h1dwt8 < t2w1r9 && t2h1dwt8 < t2w1l9 && t2h1dwt8 < t2h1u9 && t2h1dwt8 < t2h1d9 && t2h1dwt8 < t2w1rwt9 && t2h1dwt8 < t2w1lwt9 && t2h1dwt8 < t2h1uwt9 && t2h1dwt8 < t2h1dwt9 
  && t2h1dwt8 < t2w1r10 && t2h1dwt8 < t2w1l10 && t2h1dwt8 < t2h1u10 && t2h1dwt8 < t2h1d10 && t2h1dwt8 < t2w1rwt10 && t2h1dwt8 < t2w1lwt10 && t2h1dwt8 < t2h1uwt10 && t2h1dwt8 < t2h1dwt10
  && (louthd8 == 0 && linhd8 == 0)){
  if(linwr8==0 && loutwr8==0)
  {
    xlimitr=(-w2r8+w1r8)/l*(vz*t2h1dwt8+z)-w1rwt8;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xlimitr=-bwrwt8*sqrt(1-((z0wr8+(vz*t2h1dwt8+z))*(z0wr8+(vz*t2h1dwt8+z)))/a2wrwt8);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt8+z)-pbwrwt8)/-pawrwt8);
    }
  }
  if(linwl8==0 && loutwl8 == 0)
   {
      xlimitl=(w2l8-w1l8)/l*(vz*t2h1dwt8+z)+w1lwt8;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xlimitl=bwlwt8*sqrt(1-((z0wl8+(vz*t2h1dwt8+z))*(z0wl8+(vz*t2h1dwt8+z)))/a2wlwt8);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt8+z)-pbwlwt8)/-pawlwt8);
      }
   }
  xtest=vx*t2h1dwt8+x;
  ytest=vy*t2w1lwt8+y;
  ylimitd=(-h2d8+h1d8)*(vz*t2h1dwt8+z)/l-h1dwt8;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW8>0 ){
  i=353;
  }else{
  i=357;
  }
  }


  if (mxrOW8==-1 && t2w1rwt8 > 0 && t2w1rwt8 < t1 
  && t2w1rwt8 < t2w1r && t2w1rwt8 < t2w1l && t2w1rwt8 < t2h1u && t2w1rwt8 < t2h1d && t2w1rwt8 <t2w1rwt && t2w1rwt8 <t2w1lwt && t2w1rwt8 < t2h1uwt && t2w1rwt8 < t2h1dwt
  && t2w1rwt8 < t2w1r1 && t2w1rwt8 < t2w1l1 && t2w1rwt8 < t2h1u1 && t2w1rwt8 < t2h1d1 && t2w1rwt8 <t2w1rwt1 && t2w1rwt8 <t2w1lwt1 && t2w1rwt8 < t2h1uwt1 && t2w1rwt8 < t2h1dwt1
  && t2w1rwt8 < t2w1r2 && t2w1rwt8 < t2w1l2 && t2w1rwt8 < t2h1u2 && t2w1rwt8 < t2h1d2 && t2w1rwt8 <t2w1rwt2 && t2w1rwt8 <t2w1lwt2 && t2w1rwt8 < t2h1uwt2 && t2w1rwt8 < t2h1dwt2
  && t2w1rwt8 < t2w1r3 && t2w1rwt8 < t2w1l3 && t2w1rwt8 < t2h1u3 && t2w1rwt8 < t2h1d3 && t2w1rwt8 <t2w1rwt3 && t2w1rwt8 <t2w1lwt3 && t2w1rwt8 < t2h1uwt3 && t2w1rwt8 < t2h1dwt3
  && t2w1rwt8 < t2w1r4 && t2w1rwt8 < t2w1l4 && t2w1rwt8 < t2h1u4 && t2w1rwt8 < t2h1d4 && t2w1rwt8 <t2w1rwt4 && t2w1rwt8 <t2w1lwt4 && t2w1rwt8 < t2h1uwt4 && t2w1rwt8 < t2h1dwt4
  && t2w1rwt8 < t2w1r5 && t2w1rwt8 < t2w1l5 && t2w1rwt8 < t2h1u5 && t2w1rwt8 < t2h1d5 && t2w1rwt8 <t2w1rwt5 && t2w1rwt8 <t2w1lwt5 && t2w1rwt8 < t2h1uwt5 && t2w1rwt8 < t2h1dwt5
  && t2w1rwt8 < t2w1r6 && t2w1rwt8 < t2w1l6 && t2w1rwt8 < t2h1u6 && t2w1rwt8 < t2h1d6 && t2w1rwt8 <t2w1rwt6 && t2w1rwt8 <t2w1lwt6 && t2w1rwt8 < t2h1uwt6 && t2w1rwt8 < t2h1dwt6
  && t2w1rwt8 < t2w1r7 && t2w1rwt8 < t2w1l7 && t2w1rwt8 < t2h1u7 && t2w1rwt8 < t2h1d7 && t2w1rwt8 <t2w1rwt7 && t2w1rwt8 <t2w1lwt7 && t2w1rwt8 < t2h1uwt7 && t2w1rwt8 < t2h1dwt7
  && t2w1rwt8 < t2w1r8 && t2w1rwt8 < t2w1l8 && t2w1rwt8 < t2h1u8 && t2w1rwt8 < t2h1d8 && t2w1rwt8 <t2w1lwt8 && t2w1rwt8 < t2h1uwt8 && t2w1rwt8 < t2h1dwt8
  && t2w1rwt8 < t2w1r9 && t2w1rwt8 < t2w1l9 && t2w1rwt8 < t2h1u9 && t2w1rwt8 < t2h1d9 && t2w1rwt8 <t2w1rwt9 && t2w1rwt8 <t2w1lwt9 && t2w1rwt8 < t2h1uwt9 && t2w1rwt8 < t2h1dwt9
  && t2w1rwt8 < t2w1r10 && t2w1rwt8 < t2w1l10 && t2w1rwt8 < t2h1u10 && t2w1rwt8 < t2h1d10 && t2w1rwt8 <t2w1rwt10 && t2w1rwt8 <t2w1lwt10 && t2w1rwt8 < t2h1uwt10 && t2w1rwt8 < t2h1dwt10
  && ((linwr8!=0) && (loutwr8!=0) )){
  i=358;
  }

  if (mxrOW8==-1 && t2w1rwt8 > 0 && t2w1rwt8 < t1 
  && t2w1rwt8 < t2w1r && t2w1rwt8 < t2w1l && t2w1rwt8 < t2h1u && t2w1rwt8 < t2h1d && t2w1rwt8 <t2w1rwt && t2w1rwt8 <t2w1lwt && t2w1rwt8 < t2h1uwt && t2w1rwt8 < t2h1dwt
  && t2w1rwt8 < t2w1r1 && t2w1rwt8 < t2w1l1 && t2w1rwt8 < t2h1u1 && t2w1rwt8 < t2h1d1 && t2w1rwt8 <t2w1rwt1 && t2w1rwt8 <t2w1lwt1 && t2w1rwt8 < t2h1uwt1 && t2w1rwt8 < t2h1dwt1
  && t2w1rwt8 < t2w1r2 && t2w1rwt8 < t2w1l2 && t2w1rwt8 < t2h1u2 && t2w1rwt8 < t2h1d2 && t2w1rwt8 <t2w1rwt2 && t2w1rwt8 <t2w1lwt2 && t2w1rwt8 < t2h1uwt2 && t2w1rwt8 < t2h1dwt2
  && t2w1rwt8 < t2w1r3 && t2w1rwt8 < t2w1l3 && t2w1rwt8 < t2h1u3 && t2w1rwt8 < t2h1d3 && t2w1rwt8 <t2w1rwt3 && t2w1rwt8 <t2w1lwt3 && t2w1rwt8 < t2h1uwt3 && t2w1rwt8 < t2h1dwt3
  && t2w1rwt8 < t2w1r4 && t2w1rwt8 < t2w1l4 && t2w1rwt8 < t2h1u4 && t2w1rwt8 < t2h1d4 && t2w1rwt8 <t2w1rwt4 && t2w1rwt8 <t2w1lwt4 && t2w1rwt8 < t2h1uwt4 && t2w1rwt8 < t2h1dwt4
  && t2w1rwt8 < t2w1r5 && t2w1rwt8 < t2w1l5 && t2w1rwt8 < t2h1u5 && t2w1rwt8 < t2h1d5 && t2w1rwt8 <t2w1rwt5 && t2w1rwt8 <t2w1lwt5 && t2w1rwt8 < t2h1uwt5 && t2w1rwt8 < t2h1dwt5
  && t2w1rwt8 < t2w1r6 && t2w1rwt8 < t2w1l6 && t2w1rwt8 < t2h1u6 && t2w1rwt8 < t2h1d6 && t2w1rwt8 <t2w1rwt6 && t2w1rwt8 <t2w1lwt6 && t2w1rwt8 < t2h1uwt6 && t2w1rwt8 < t2h1dwt6
  && t2w1rwt8 < t2w1r7 && t2w1rwt8 < t2w1l7 && t2w1rwt8 < t2h1u7 && t2w1rwt8 < t2h1d7 && t2w1rwt8 <t2w1rwt7 && t2w1rwt8 <t2w1lwt7 && t2w1rwt8 < t2h1uwt7 && t2w1rwt8 < t2h1dwt7
  && t2w1rwt8 < t2w1r8 && t2w1rwt8 < t2w1l8 && t2w1rwt8 < t2h1u8 && t2w1rwt8 < t2h1d8 && t2w1rwt8 <t2w1lwt8 && t2w1rwt8 < t2h1uwt8 && t2w1rwt8 < t2h1dwt8
  && t2w1rwt8 < t2w1r9 && t2w1rwt8 < t2w1l9 && t2w1rwt8 < t2h1u9 && t2w1rwt8 < t2h1d9 && t2w1rwt8 <t2w1rwt9 && t2w1rwt8 <t2w1lwt9 && t2w1rwt8 < t2h1uwt9 && t2w1rwt8 < t2h1dwt9
  && t2w1rwt8 < t2w1r10 && t2w1rwt8 < t2w1l10 && t2w1rwt8 < t2h1u10 && t2w1rwt8 < t2h1d10 && t2w1rwt8 <t2w1rwt10 && t2w1rwt8 <t2w1lwt10 && t2w1rwt8 < t2h1uwt10 && t2w1rwt8 < t2h1dwt10
  && ((loutwr8!=0 && linwr8==0) || (loutwr8==0 && linwr8!=0))){
  i=358;
  }

  if (mxrOW8==-1 && t2w1rwt8 > 0 && t2w1rwt8 < t1 
  && t2w1rwt8 < t2w1r && t2w1rwt8 < t2w1l && t2w1rwt8 < t2h1u && t2w1rwt8 < t2h1d && t2w1rwt8 <t2w1rwt && t2w1rwt8 <t2w1lwt && t2w1rwt8 < t2h1uwt && t2w1rwt8 < t2h1dwt
  && t2w1rwt8 < t2w1r1 && t2w1rwt8 < t2w1l1 && t2w1rwt8 < t2h1u1 && t2w1rwt8 < t2h1d1 && t2w1rwt8 <t2w1rwt1 && t2w1rwt8 <t2w1lwt1 && t2w1rwt8 < t2h1uwt1 && t2w1rwt8 < t2h1dwt1
  && t2w1rwt8 < t2w1r2 && t2w1rwt8 < t2w1l2 && t2w1rwt8 < t2h1u2 && t2w1rwt8 < t2h1d2 && t2w1rwt8 <t2w1rwt2 && t2w1rwt8 <t2w1lwt2 && t2w1rwt8 < t2h1uwt2 && t2w1rwt8 < t2h1dwt2
  && t2w1rwt8 < t2w1r3 && t2w1rwt8 < t2w1l3 && t2w1rwt8 < t2h1u3 && t2w1rwt8 < t2h1d3 && t2w1rwt8 <t2w1rwt3 && t2w1rwt8 <t2w1lwt3 && t2w1rwt8 < t2h1uwt3 && t2w1rwt8 < t2h1dwt3
  && t2w1rwt8 < t2w1r4 && t2w1rwt8 < t2w1l4 && t2w1rwt8 < t2h1u4 && t2w1rwt8 < t2h1d4 && t2w1rwt8 <t2w1rwt4 && t2w1rwt8 <t2w1lwt4 && t2w1rwt8 < t2h1uwt4 && t2w1rwt8 < t2h1dwt4
  && t2w1rwt8 < t2w1r5 && t2w1rwt8 < t2w1l5 && t2w1rwt8 < t2h1u5 && t2w1rwt8 < t2h1d5 && t2w1rwt8 <t2w1rwt5 && t2w1rwt8 <t2w1lwt5 && t2w1rwt8 < t2h1uwt5 && t2w1rwt8 < t2h1dwt5
  && t2w1rwt8 < t2w1r6 && t2w1rwt8 < t2w1l6 && t2w1rwt8 < t2h1u6 && t2w1rwt8 < t2h1d6 && t2w1rwt8 <t2w1rwt6 && t2w1rwt8 <t2w1lwt6 && t2w1rwt8 < t2h1uwt6 && t2w1rwt8 < t2h1dwt6
  && t2w1rwt8 < t2w1r7 && t2w1rwt8 < t2w1l7 && t2w1rwt8 < t2h1u7 && t2w1rwt8 < t2h1d7 && t2w1rwt8 <t2w1rwt7 && t2w1rwt8 <t2w1lwt7 && t2w1rwt8 < t2h1uwt7 && t2w1rwt8 < t2h1dwt7
  && t2w1rwt8 < t2w1r8 && t2w1rwt8 < t2w1l8 && t2w1rwt8 < t2h1u8 && t2w1rwt8 < t2h1d8 && t2w1rwt8 <t2w1lwt8 && t2w1rwt8 < t2h1uwt8 && t2w1rwt8 < t2h1dwt8
  && t2w1rwt8 < t2w1r9 && t2w1rwt8 < t2w1l9 && t2w1rwt8 < t2h1u9 && t2w1rwt8 < t2h1d9 && t2w1rwt8 <t2w1rwt9 && t2w1rwt8 <t2w1lwt9 && t2w1rwt8 < t2h1uwt9 && t2w1rwt8 < t2h1dwt9
  && t2w1rwt8 < t2w1r10 && t2w1rwt8 < t2w1l10 && t2w1rwt8 < t2h1u10 && t2w1rwt8 < t2h1d10 && t2w1rwt8 <t2w1rwt10 && t2w1rwt8 <t2w1lwt10 && t2w1rwt8 < t2h1uwt10 && t2w1rwt8 < t2h1dwt10
  && (loutwr8==0 && linwr8==0)){
  i=358;
  }

  if (mxlOW8==-1 && t2w1lwt8 > 0 && t2w1lwt8 < t1 
  && t2w1lwt8 < t2w1r && t2w1lwt8 < t2w1l && t2w1lwt8 < t2h1u && t2w1lwt8 < t2h1d && t2w1lwt8 <t2w1rwt && t2w1lwt8 <t2w1lwt && t2w1lwt8 < t2h1uwt && t2w1lwt8 < t2h1dwt
  && t2w1lwt8 < t2w1r1 && t2w1lwt8 < t2w1l1 && t2w1lwt8 < t2h1u1 && t2w1lwt8 < t2h1d1 && t2w1lwt8 <t2w1rwt1 && t2w1lwt8 <t2w1lwt1 && t2w1lwt8 < t2h1uwt1 && t2w1lwt8 < t2h1dwt1
  && t2w1lwt8 < t2w1r2 && t2w1lwt8 < t2w1l2 && t2w1lwt8 < t2h1u2 && t2w1lwt8 < t2h1d2 && t2w1lwt8 <t2w1rwt2 && t2w1lwt8 <t2w1lwt2 && t2w1lwt8 < t2h1uwt2 && t2w1lwt8 < t2h1dwt2
  && t2w1lwt8 < t2w1r3 && t2w1lwt8 < t2w1l3 && t2w1lwt8 < t2h1u3 && t2w1lwt8 < t2h1d3 && t2w1lwt8 <t2w1rwt3 && t2w1lwt8 <t2w1lwt3 && t2w1lwt8 < t2h1uwt3 && t2w1lwt8 < t2h1dwt3
  && t2w1lwt8 < t2w1r4 && t2w1lwt8 < t2w1l4 && t2w1lwt8 < t2h1u4 && t2w1lwt8 < t2h1d4 && t2w1lwt8 <t2w1rwt4 && t2w1lwt8 <t2w1lwt4 && t2w1lwt8 < t2h1uwt4 && t2w1lwt8 < t2h1dwt4
  && t2w1lwt8 < t2w1r5 && t2w1lwt8 < t2w1l5 && t2w1lwt8 < t2h1u5 && t2w1lwt8 < t2h1d5 && t2w1lwt8 <t2w1rwt5 && t2w1lwt8 <t2w1lwt5 && t2w1lwt8 < t2h1uwt5 && t2w1lwt8 < t2h1dwt5
  && t2w1lwt8 < t2w1r6 && t2w1lwt8 < t2w1l6 && t2w1lwt8 < t2h1u6 && t2w1lwt8 < t2h1d6 && t2w1lwt8 <t2w1rwt6 && t2w1lwt8 <t2w1lwt6 && t2w1lwt8 < t2h1uwt6 && t2w1lwt8 < t2h1dwt6
  && t2w1lwt8 < t2w1r7 && t2w1lwt8 < t2w1l7 && t2w1lwt8 < t2h1u7 && t2w1lwt8 < t2h1d7 && t2w1lwt8 <t2w1rwt7 && t2w1lwt8 <t2w1lwt7 && t2w1lwt8 < t2h1uwt7 && t2w1lwt8 < t2h1dwt7
  && t2w1lwt8 < t2w1r8 && t2w1lwt8 < t2w1l8 && t2w1lwt8 < t2h1u8 && t2w1lwt8 < t2h1d8 && t2w1lwt8 <t2w1rwt8 && t2w1lwt8 < t2h1uwt8 && t2w1lwt8 < t2h1dwt8
  && t2w1lwt8 < t2w1r9 && t2w1lwt8 < t2w1l9 && t2w1lwt8 < t2h1u9 && t2w1lwt8 < t2h1d9 && t2w1lwt8 <t2w1rwt9 && t2w1lwt8 <t2w1lwt9 && t2w1lwt8 < t2h1uwt9 && t2w1lwt8 < t2h1dwt9
  && t2w1lwt8 < t2w1r10 && t2w1lwt8 < t2w1l10 && t2w1lwt8 < t2h1u10 && t2w1lwt8 < t2h1d10 && t2w1lwt8 <t2w1rwt10 && t2w1lwt8 <t2w1lwt10 && t2w1lwt8 < t2h1uwt10 && t2w1lwt8 < t2h1dwt10
  && ((linwl8!=0) && (loutwl8!=0) )){
  i=359;
  }

  if (mxlOW8==-1 && t2w1lwt8 > 0 && t2w1lwt8 < t1 
  && t2w1lwt8 < t2w1r && t2w1lwt8 < t2w1l && t2w1lwt8 < t2h1u && t2w1lwt8 < t2h1d && t2w1lwt8 <t2w1rwt && t2w1lwt8 <t2w1lwt && t2w1lwt8 < t2h1uwt && t2w1lwt8 < t2h1dwt
  && t2w1lwt8 < t2w1r1 && t2w1lwt8 < t2w1l1 && t2w1lwt8 < t2h1u1 && t2w1lwt8 < t2h1d1 && t2w1lwt8 <t2w1rwt1 && t2w1lwt8 <t2w1lwt1 && t2w1lwt8 < t2h1uwt1 && t2w1lwt8 < t2h1dwt1
  && t2w1lwt8 < t2w1r2 && t2w1lwt8 < t2w1l2 && t2w1lwt8 < t2h1u2 && t2w1lwt8 < t2h1d2 && t2w1lwt8 <t2w1rwt2 && t2w1lwt8 <t2w1lwt2 && t2w1lwt8 < t2h1uwt2 && t2w1lwt8 < t2h1dwt2
  && t2w1lwt8 < t2w1r3 && t2w1lwt8 < t2w1l3 && t2w1lwt8 < t2h1u3 && t2w1lwt8 < t2h1d3 && t2w1lwt8 <t2w1rwt3 && t2w1lwt8 <t2w1lwt3 && t2w1lwt8 < t2h1uwt3 && t2w1lwt8 < t2h1dwt3
  && t2w1lwt8 < t2w1r4 && t2w1lwt8 < t2w1l4 && t2w1lwt8 < t2h1u4 && t2w1lwt8 < t2h1d4 && t2w1lwt8 <t2w1rwt4 && t2w1lwt8 <t2w1lwt4 && t2w1lwt8 < t2h1uwt4 && t2w1lwt8 < t2h1dwt4
  && t2w1lwt8 < t2w1r5 && t2w1lwt8 < t2w1l5 && t2w1lwt8 < t2h1u5 && t2w1lwt8 < t2h1d5 && t2w1lwt8 <t2w1rwt5 && t2w1lwt8 <t2w1lwt5 && t2w1lwt8 < t2h1uwt5 && t2w1lwt8 < t2h1dwt5
  && t2w1lwt8 < t2w1r6 && t2w1lwt8 < t2w1l6 && t2w1lwt8 < t2h1u6 && t2w1lwt8 < t2h1d6 && t2w1lwt8 <t2w1rwt6 && t2w1lwt8 <t2w1lwt6 && t2w1lwt8 < t2h1uwt6 && t2w1lwt8 < t2h1dwt6
  && t2w1lwt8 < t2w1r7 && t2w1lwt8 < t2w1l7 && t2w1lwt8 < t2h1u7 && t2w1lwt8 < t2h1d7 && t2w1lwt8 <t2w1rwt7 && t2w1lwt8 <t2w1lwt7 && t2w1lwt8 < t2h1uwt7 && t2w1lwt8 < t2h1dwt7
  && t2w1lwt8 < t2w1r8 && t2w1lwt8 < t2w1l8 && t2w1lwt8 < t2h1u8 && t2w1lwt8 < t2h1d8 && t2w1lwt8 <t2w1rwt8 && t2w1lwt8 < t2h1uwt8 && t2w1lwt8 < t2h1dwt8
  && t2w1lwt8 < t2w1r9 && t2w1lwt8 < t2w1l9 && t2w1lwt8 < t2h1u9 && t2w1lwt8 < t2h1d9 && t2w1lwt8 <t2w1rwt9 && t2w1lwt8 <t2w1lwt9 && t2w1lwt8 < t2h1uwt9 && t2w1lwt8 < t2h1dwt9
  && t2w1lwt8 < t2w1r10 && t2w1lwt8 < t2w1l10 && t2w1lwt8 < t2h1u10 && t2w1lwt8 < t2h1d10 && t2w1lwt8 <t2w1rwt10 && t2w1lwt8 <t2w1lwt10 && t2w1lwt8 < t2h1uwt10 && t2w1lwt8 < t2h1dwt10
  && ((loutwl8!=0 && linwl8==0) || (loutwl8==0 && linwl8!=0))){
  i=359;
  }

  if (mxlOW8==-1 && t2w1lwt8 > 0 && t2w1lwt8 < t1 
  && t2w1lwt8 < t2w1r && t2w1lwt8 < t2w1l && t2w1lwt8 < t2h1u && t2w1lwt8 < t2h1d && t2w1lwt8 <t2w1rwt && t2w1lwt8 <t2w1lwt && t2w1lwt8 < t2h1uwt && t2w1lwt8 < t2h1dwt
  && t2w1lwt8 < t2w1r1 && t2w1lwt8 < t2w1l1 && t2w1lwt8 < t2h1u1 && t2w1lwt8 < t2h1d1 && t2w1lwt8 <t2w1rwt1 && t2w1lwt8 <t2w1lwt1 && t2w1lwt8 < t2h1uwt1 && t2w1lwt8 < t2h1dwt1
  && t2w1lwt8 < t2w1r2 && t2w1lwt8 < t2w1l2 && t2w1lwt8 < t2h1u2 && t2w1lwt8 < t2h1d2 && t2w1lwt8 <t2w1rwt2 && t2w1lwt8 <t2w1lwt2 && t2w1lwt8 < t2h1uwt2 && t2w1lwt8 < t2h1dwt2
  && t2w1lwt8 < t2w1r3 && t2w1lwt8 < t2w1l3 && t2w1lwt8 < t2h1u3 && t2w1lwt8 < t2h1d3 && t2w1lwt8 <t2w1rwt3 && t2w1lwt8 <t2w1lwt3 && t2w1lwt8 < t2h1uwt3 && t2w1lwt8 < t2h1dwt3
  && t2w1lwt8 < t2w1r4 && t2w1lwt8 < t2w1l4 && t2w1lwt8 < t2h1u4 && t2w1lwt8 < t2h1d4 && t2w1lwt8 <t2w1rwt4 && t2w1lwt8 <t2w1lwt4 && t2w1lwt8 < t2h1uwt4 && t2w1lwt8 < t2h1dwt4
  && t2w1lwt8 < t2w1r5 && t2w1lwt8 < t2w1l5 && t2w1lwt8 < t2h1u5 && t2w1lwt8 < t2h1d5 && t2w1lwt8 <t2w1rwt5 && t2w1lwt8 <t2w1lwt5 && t2w1lwt8 < t2h1uwt5 && t2w1lwt8 < t2h1dwt5
  && t2w1lwt8 < t2w1r6 && t2w1lwt8 < t2w1l6 && t2w1lwt8 < t2h1u6 && t2w1lwt8 < t2h1d6 && t2w1lwt8 <t2w1rwt6 && t2w1lwt8 <t2w1lwt6 && t2w1lwt8 < t2h1uwt6 && t2w1lwt8 < t2h1dwt6
  && t2w1lwt8 < t2w1r7 && t2w1lwt8 < t2w1l7 && t2w1lwt8 < t2h1u7 && t2w1lwt8 < t2h1d7 && t2w1lwt8 <t2w1rwt7 && t2w1lwt8 <t2w1lwt7 && t2w1lwt8 < t2h1uwt7 && t2w1lwt8 < t2h1dwt7
  && t2w1lwt8 < t2w1r8 && t2w1lwt8 < t2w1l8 && t2w1lwt8 < t2h1u8 && t2w1lwt8 < t2h1d8 && t2w1lwt8 <t2w1rwt8 && t2w1lwt8 < t2h1uwt8 && t2w1lwt8 < t2h1dwt8
  && t2w1lwt8 < t2w1r9 && t2w1lwt8 < t2w1l9 && t2w1lwt8 < t2h1u9 && t2w1lwt8 < t2h1d9 && t2w1lwt8 <t2w1rwt9 && t2w1lwt8 <t2w1lwt9 && t2w1lwt8 < t2h1uwt9 && t2w1lwt8 < t2h1dwt9
  && t2w1lwt8 < t2w1r10 && t2w1lwt8 < t2w1l10 && t2w1lwt8 < t2h1u10 && t2w1lwt8 < t2h1d10 && t2w1lwt8 <t2w1rwt10 && t2w1lwt8 <t2w1lwt10 && t2w1lwt8 < t2h1uwt10 && t2w1lwt8 < t2h1dwt10
  && (loutwl8==0 && linwl8==0)){
  i=359;}

  if (myuOW8==-1 && t2h1uwt8 > 0 && t2h1uwt8 < t1 
  && t2h1uwt8 < t2w1r && t2h1uwt8 < t2w1l && t2h1uwt8 < t2h1u && t2h1uwt8 < t2h1d && t2h1uwt8 < t2w1rwt && t2h1uwt8 < t2w1lwt && t2h1uwt8 < t2h1uwt && t2h1uwt8 < t2h1dwt 
  && t2h1uwt8 < t2w1r1 && t2h1uwt8 < t2w1l1 && t2h1uwt8 < t2h1u1 && t2h1uwt8 < t2h1d1 && t2h1uwt8 < t2w1rwt1 && t2h1uwt8 < t2w1lwt1 && t2h1uwt8 < t2h1uwt1 && t2h1uwt8 < t2h1dwt1
  && t2h1uwt8 < t2w1r2 && t2h1uwt8 < t2w1l2 && t2h1uwt8 < t2h1u2 && t2h1uwt8 < t2h1d2 && t2h1uwt8 < t2w1rwt2 && t2h1uwt8 < t2w1lwt2 && t2h1uwt8 < t2h1uwt2 && t2h1uwt8 < t2h1dwt2
  && t2h1uwt8 < t2w1r3 && t2h1uwt8 < t2w1l3 && t2h1uwt8 < t2h1u3 && t2h1uwt8 < t2h1d3 && t2h1uwt8 < t2w1rwt3 && t2h1uwt8 < t2w1lwt3 && t2h1uwt8 < t2h1uwt3 && t2h1uwt8 < t2h1dwt3
  && t2h1uwt8 < t2w1r4 && t2h1uwt8 < t2w1l4 && t2h1uwt8 < t2h1u4 && t2h1uwt8 < t2h1d4 && t2h1uwt8 < t2w1rwt4 && t2h1uwt8 < t2w1lwt4 && t2h1uwt8 < t2h1uwt4 && t2h1uwt8 < t2h1dwt4
  && t2h1uwt8 < t2w1r5 && t2h1uwt8 < t2w1l5 && t2h1uwt8 < t2h1u5 && t2h1uwt8 < t2h1d5 && t2h1uwt8 < t2w1rwt5 && t2h1uwt8 < t2w1lwt5 && t2h1uwt8 < t2h1uwt5 && t2h1uwt8 < t2h1dwt5
  && t2h1uwt8 < t2w1r6 && t2h1uwt8 < t2w1l6 && t2h1uwt8 < t2h1u6 && t2h1uwt8 < t2h1d6 && t2h1uwt8 < t2w1rwt6 && t2h1uwt8 < t2w1lwt6 && t2h1uwt8 < t2h1uwt6 && t2h1uwt8 < t2h1dwt6
  && t2h1uwt8 < t2w1r7 && t2h1uwt8 < t2w1l7 && t2h1uwt8 < t2h1u7 && t2h1uwt8 < t2h1d7 && t2h1uwt8 < t2w1rwt7 && t2h1uwt8 < t2w1lwt7 && t2h1uwt8 < t2h1uwt7 && t2h1uwt8 < t2h1dwt7
  && t2h1uwt8 < t2w1r8 && t2h1uwt8 < t2w1l8 && t2h1uwt8 < t2h1u8 && t2h1uwt8 < t2h1d8 && t2h1uwt8 < t2w1rwt8 && t2h1uwt8 < t2w1lwt8 && t2h1uwt8 < t2h1dwt8
  && t2h1uwt8 < t2w1r9 && t2h1uwt8 < t2w1l9 && t2h1uwt8 < t2h1u9 && t2h1uwt8 < t2h1d9 && t2h1uwt8 < t2w1rwt9 && t2h1uwt8 < t2w1lwt9 && t2h1uwt8 < t2h1uwt9 && t2h1uwt8 < t2h1dwt9
  && t2h1uwt8 < t2w1r10 && t2h1uwt8 < t2w1l10 && t2h1uwt8 < t2h1u10 && t2h1uwt8 < t2h1d10 && t2h1uwt8 < t2w1rwt10 && t2h1uwt8 < t2w1lwt10 && t2h1uwt8 < t2h1uwt10 && t2h1uwt8 < t2h1dwt10
  && (louthu8 !=0 && linhu8!=0)){
  i=360;
  }

  if (myuOW8==-1 && t2h1uwt8 > 0 && t2h1uwt8 < t1 
  && t2h1uwt8 < t2w1r && t2h1uwt8 < t2w1l && t2h1uwt8 < t2h1u && t2h1uwt8 < t2h1d && t2h1uwt8 < t2w1rwt && t2h1uwt8 < t2w1lwt && t2h1uwt8 < t2h1uwt && t2h1uwt8 < t2h1dwt 
  && t2h1uwt8 < t2w1r1 && t2h1uwt8 < t2w1l1 && t2h1uwt8 < t2h1u1 && t2h1uwt8 < t2h1d1 && t2h1uwt8 < t2w1rwt1 && t2h1uwt8 < t2w1lwt1 && t2h1uwt8 < t2h1uwt1 && t2h1uwt8 < t2h1dwt1
  && t2h1uwt8 < t2w1r2 && t2h1uwt8 < t2w1l2 && t2h1uwt8 < t2h1u2 && t2h1uwt8 < t2h1d2 && t2h1uwt8 < t2w1rwt2 && t2h1uwt8 < t2w1lwt2 && t2h1uwt8 < t2h1uwt2 && t2h1uwt8 < t2h1dwt2
  && t2h1uwt8 < t2w1r3 && t2h1uwt8 < t2w1l3 && t2h1uwt8 < t2h1u3 && t2h1uwt8 < t2h1d3 && t2h1uwt8 < t2w1rwt3 && t2h1uwt8 < t2w1lwt3 && t2h1uwt8 < t2h1uwt3 && t2h1uwt8 < t2h1dwt3
  && t2h1uwt8 < t2w1r4 && t2h1uwt8 < t2w1l4 && t2h1uwt8 < t2h1u4 && t2h1uwt8 < t2h1d4 && t2h1uwt8 < t2w1rwt4 && t2h1uwt8 < t2w1lwt4 && t2h1uwt8 < t2h1uwt4 && t2h1uwt8 < t2h1dwt4
  && t2h1uwt8 < t2w1r5 && t2h1uwt8 < t2w1l5 && t2h1uwt8 < t2h1u5 && t2h1uwt8 < t2h1d5 && t2h1uwt8 < t2w1rwt5 && t2h1uwt8 < t2w1lwt5 && t2h1uwt8 < t2h1uwt5 && t2h1uwt8 < t2h1dwt5
  && t2h1uwt8 < t2w1r6 && t2h1uwt8 < t2w1l6 && t2h1uwt8 < t2h1u6 && t2h1uwt8 < t2h1d6 && t2h1uwt8 < t2w1rwt6 && t2h1uwt8 < t2w1lwt6 && t2h1uwt8 < t2h1uwt6 && t2h1uwt8 < t2h1dwt6
  && t2h1uwt8 < t2w1r7 && t2h1uwt8 < t2w1l7 && t2h1uwt8 < t2h1u7 && t2h1uwt8 < t2h1d7 && t2h1uwt8 < t2w1rwt7 && t2h1uwt8 < t2w1lwt7 && t2h1uwt8 < t2h1uwt7 && t2h1uwt8 < t2h1dwt7
  && t2h1uwt8 < t2w1r8 && t2h1uwt8 < t2w1l8 && t2h1uwt8 < t2h1u8 && t2h1uwt8 < t2h1d8 && t2h1uwt8 < t2w1rwt8 && t2h1uwt8 < t2w1lwt8 && t2h1uwt8 < t2h1dwt8
  && t2h1uwt8 < t2w1r9 && t2h1uwt8 < t2w1l9 && t2h1uwt8 < t2h1u9 && t2h1uwt8 < t2h1d9 && t2h1uwt8 < t2w1rwt9 && t2h1uwt8 < t2w1lwt9 && t2h1uwt8 < t2h1uwt9 && t2h1uwt8 < t2h1dwt9
  && t2h1uwt8 < t2w1r10 && t2h1uwt8 < t2w1l10 && t2h1uwt8 < t2h1u10 && t2h1uwt8 < t2h1d10 && t2h1uwt8 < t2w1rwt10 && t2h1uwt8 < t2w1lwt10 && t2h1uwt8 < t2h1uwt10 && t2h1uwt8 < t2h1dwt10
  && ((louthu8!=0 && linhu8==0) || (louthu8==0 && linhu8!=0))){
  i=360;
  }

  if (myuOW8==-1 && t2h1uwt8 > 0 && t2h1uwt8 < t1 
  && t2h1uwt8 < t2w1r && t2h1uwt8 < t2w1l && t2h1uwt8 < t2h1u && t2h1uwt8 < t2h1d && t2h1uwt8 < t2w1rwt && t2h1uwt8 < t2w1lwt && t2h1uwt8 < t2h1uwt && t2h1uwt8 < t2h1dwt 
  && t2h1uwt8 < t2w1r1 && t2h1uwt8 < t2w1l1 && t2h1uwt8 < t2h1u1 && t2h1uwt8 < t2h1d1 && t2h1uwt8 < t2w1rwt1 && t2h1uwt8 < t2w1lwt1 && t2h1uwt8 < t2h1uwt1 && t2h1uwt8 < t2h1dwt1
  && t2h1uwt8 < t2w1r2 && t2h1uwt8 < t2w1l2 && t2h1uwt8 < t2h1u2 && t2h1uwt8 < t2h1d2 && t2h1uwt8 < t2w1rwt2 && t2h1uwt8 < t2w1lwt2 && t2h1uwt8 < t2h1uwt2 && t2h1uwt8 < t2h1dwt2
  && t2h1uwt8 < t2w1r3 && t2h1uwt8 < t2w1l3 && t2h1uwt8 < t2h1u3 && t2h1uwt8 < t2h1d3 && t2h1uwt8 < t2w1rwt3 && t2h1uwt8 < t2w1lwt3 && t2h1uwt8 < t2h1uwt3 && t2h1uwt8 < t2h1dwt3
  && t2h1uwt8 < t2w1r4 && t2h1uwt8 < t2w1l4 && t2h1uwt8 < t2h1u4 && t2h1uwt8 < t2h1d4 && t2h1uwt8 < t2w1rwt4 && t2h1uwt8 < t2w1lwt4 && t2h1uwt8 < t2h1uwt4 && t2h1uwt8 < t2h1dwt4
  && t2h1uwt8 < t2w1r5 && t2h1uwt8 < t2w1l5 && t2h1uwt8 < t2h1u5 && t2h1uwt8 < t2h1d5 && t2h1uwt8 < t2w1rwt5 && t2h1uwt8 < t2w1lwt5 && t2h1uwt8 < t2h1uwt5 && t2h1uwt8 < t2h1dwt5
  && t2h1uwt8 < t2w1r6 && t2h1uwt8 < t2w1l6 && t2h1uwt8 < t2h1u6 && t2h1uwt8 < t2h1d6 && t2h1uwt8 < t2w1rwt6 && t2h1uwt8 < t2w1lwt6 && t2h1uwt8 < t2h1uwt6 && t2h1uwt8 < t2h1dwt6
  && t2h1uwt8 < t2w1r7 && t2h1uwt8 < t2w1l7 && t2h1uwt8 < t2h1u7 && t2h1uwt8 < t2h1d7 && t2h1uwt8 < t2w1rwt7 && t2h1uwt8 < t2w1lwt7 && t2h1uwt8 < t2h1uwt7 && t2h1uwt8 < t2h1dwt7
  && t2h1uwt8 < t2w1r8 && t2h1uwt8 < t2w1l8 && t2h1uwt8 < t2h1u8 && t2h1uwt8 < t2h1d8 && t2h1uwt8 < t2w1rwt8 && t2h1uwt8 < t2w1lwt8 && t2h1uwt8 < t2h1dwt8
  && t2h1uwt8 < t2w1r9 && t2h1uwt8 < t2w1l9 && t2h1uwt8 < t2h1u9 && t2h1uwt8 < t2h1d9 && t2h1uwt8 < t2w1rwt9 && t2h1uwt8 < t2w1lwt9 && t2h1uwt8 < t2h1uwt9 && t2h1uwt8 < t2h1dwt9
  && t2h1uwt8 < t2w1r10 && t2h1uwt8 < t2w1l10 && t2h1uwt8 < t2h1u10 && t2h1uwt8 < t2h1d10 && t2h1uwt8 < t2w1rwt10 && t2h1uwt8 < t2w1lwt10 && t2h1uwt8 < t2h1uwt10 && t2h1uwt8 < t2h1dwt10
  && (louthu8 == 0 && linhu8 == 0)){
  i=360;
  }

  if (mydOW8==-1 && t2h1dwt8 > 0 && t2h1dwt8 < t1 
  && t2h1dwt8 < t2w1r && t2h1dwt8 < t2w1l && t2h1dwt8 < t2h1u && t2h1dwt8 < t2h1d && t2h1dwt8 < t2w1rwt && t2h1dwt8 < t2w1lwt && t2h1dwt8 < t2h1uwt && t2h1dwt8 < t2h1dwt 
  && t2h1dwt8 < t2w1r1 && t2h1dwt8 < t2w1l1 && t2h1dwt8 < t2h1u1 && t2h1dwt8 < t2h1d1 && t2h1dwt8 < t2w1rwt1 && t2h1dwt8 < t2w1lwt1 && t2h1dwt8 < t2h1uwt1 && t2h1dwt8 < t2h1dwt1
  && t2h1dwt8 < t2w1r2 && t2h1dwt8 < t2w1l2 && t2h1dwt8 < t2h1u2 && t2h1dwt8 < t2h1d2 && t2h1dwt8 < t2w1rwt2 && t2h1dwt8 < t2w1lwt2 && t2h1dwt8 < t2h1uwt2 && t2h1dwt8 < t2h1dwt2 
  && t2h1dwt8 < t2w1r3 && t2h1dwt8 < t2w1l3 && t2h1dwt8 < t2h1u3 && t2h1dwt8 < t2h1d3 && t2h1dwt8 < t2w1rwt3 && t2h1dwt8 < t2w1lwt3 && t2h1dwt8 < t2h1uwt3 && t2h1dwt8 < t2h1dwt3
  && t2h1dwt8 < t2w1r4 && t2h1dwt8 < t2w1l4 && t2h1dwt8 < t2h1u4 && t2h1dwt8 < t2h1d4 && t2h1dwt8 < t2w1rwt4 && t2h1dwt8 < t2w1lwt4 && t2h1dwt8 < t2h1uwt4 && t2h1dwt8 < t2h1dwt4
  && t2h1dwt8 < t2w1r5 && t2h1dwt8 < t2w1l5 && t2h1dwt8 < t2h1u5 && t2h1dwt8 < t2h1d5 && t2h1dwt8 < t2w1rwt5 && t2h1dwt8 < t2w1lwt5 && t2h1dwt8 < t2h1uwt5 && t2h1dwt8 < t2h1dwt5
  && t2h1dwt8 < t2w1r6 && t2h1dwt8 < t2w1l6 && t2h1dwt8 < t2h1u6 && t2h1dwt8 < t2h1d6 && t2h1dwt8 < t2w1rwt6 && t2h1dwt8 < t2w1lwt6 && t2h1dwt8 < t2h1uwt6 && t2h1dwt8 < t2h1dwt6
  && t2h1dwt8 < t2w1r7 && t2h1dwt8 < t2w1l7 && t2h1dwt8 < t2h1u7 && t2h1dwt8 < t2h1d7 && t2h1dwt8 < t2w1rwt7 && t2h1dwt8 < t2w1lwt7 && t2h1dwt8 < t2h1uwt7 && t2h1dwt8 < t2h1dwt7 
  && t2h1dwt8 < t2w1r8 && t2h1dwt8 < t2w1l8 && t2h1dwt8 < t2h1u8 && t2h1dwt8 < t2h1d8 && t2h1dwt8 < t2w1rwt8 && t2h1dwt8 < t2w1lwt8 && t2h1dwt8 < t2h1uwt8 
  && t2h1dwt8 < t2w1r9 && t2h1dwt8 < t2w1l9 && t2h1dwt8 < t2h1u9 && t2h1dwt8 < t2h1d9 && t2h1dwt8 < t2w1rwt9 && t2h1dwt8 < t2w1lwt9 && t2h1dwt8 < t2h1uwt9 && t2h1dwt8 < t2h1dwt9 
  && t2h1dwt8 < t2w1r10 && t2h1dwt8 < t2w1l10 && t2h1dwt8 < t2h1u10 && t2h1dwt8 < t2h1d10 && t2h1dwt8 < t2w1rwt10 && t2h1dwt8 < t2w1lwt10 && t2h1dwt8 < t2h1uwt10 && t2h1dwt8 < t2h1dwt10  
  && (louthd8 !=0 && linhd8!=0)){
  i=361;
  }

  if (mydOW8==-1 && t2h1dwt8 > 0 && t2h1dwt8 < t1 
  && t2h1dwt8 < t2w1r && t2h1dwt8 < t2w1l && t2h1dwt8 < t2h1u && t2h1dwt8 < t2h1d && t2h1dwt8 < t2w1rwt && t2h1dwt8 < t2w1lwt && t2h1dwt8 < t2h1uwt && t2h1dwt8 < t2h1dwt 
  && t2h1dwt8 < t2w1r1 && t2h1dwt8 < t2w1l1 && t2h1dwt8 < t2h1u1 && t2h1dwt8 < t2h1d1 && t2h1dwt8 < t2w1rwt1 && t2h1dwt8 < t2w1lwt1 && t2h1dwt8 < t2h1uwt1 && t2h1dwt8 < t2h1dwt1
  && t2h1dwt8 < t2w1r2 && t2h1dwt8 < t2w1l2 && t2h1dwt8 < t2h1u2 && t2h1dwt8 < t2h1d2 && t2h1dwt8 < t2w1rwt2 && t2h1dwt8 < t2w1lwt2 && t2h1dwt8 < t2h1uwt2 && t2h1dwt8 < t2h1dwt2 
  && t2h1dwt8 < t2w1r3 && t2h1dwt8 < t2w1l3 && t2h1dwt8 < t2h1u3 && t2h1dwt8 < t2h1d3 && t2h1dwt8 < t2w1rwt3 && t2h1dwt8 < t2w1lwt3 && t2h1dwt8 < t2h1uwt3 && t2h1dwt8 < t2h1dwt3
  && t2h1dwt8 < t2w1r4 && t2h1dwt8 < t2w1l4 && t2h1dwt8 < t2h1u4 && t2h1dwt8 < t2h1d4 && t2h1dwt8 < t2w1rwt4 && t2h1dwt8 < t2w1lwt4 && t2h1dwt8 < t2h1uwt4 && t2h1dwt8 < t2h1dwt4
  && t2h1dwt8 < t2w1r5 && t2h1dwt8 < t2w1l5 && t2h1dwt8 < t2h1u5 && t2h1dwt8 < t2h1d5 && t2h1dwt8 < t2w1rwt5 && t2h1dwt8 < t2w1lwt5 && t2h1dwt8 < t2h1uwt5 && t2h1dwt8 < t2h1dwt5
  && t2h1dwt8 < t2w1r6 && t2h1dwt8 < t2w1l6 && t2h1dwt8 < t2h1u6 && t2h1dwt8 < t2h1d6 && t2h1dwt8 < t2w1rwt6 && t2h1dwt8 < t2w1lwt6 && t2h1dwt8 < t2h1uwt6 && t2h1dwt8 < t2h1dwt6
  && t2h1dwt8 < t2w1r7 && t2h1dwt8 < t2w1l7 && t2h1dwt8 < t2h1u7 && t2h1dwt8 < t2h1d7 && t2h1dwt8 < t2w1rwt7 && t2h1dwt8 < t2w1lwt7 && t2h1dwt8 < t2h1uwt7 && t2h1dwt8 < t2h1dwt7 
  && t2h1dwt8 < t2w1r8 && t2h1dwt8 < t2w1l8 && t2h1dwt8 < t2h1u8 && t2h1dwt8 < t2h1d8 && t2h1dwt8 < t2w1rwt8 && t2h1dwt8 < t2w1lwt8 && t2h1dwt8 < t2h1uwt8 
  && t2h1dwt8 < t2w1r9 && t2h1dwt8 < t2w1l9 && t2h1dwt8 < t2h1u9 && t2h1dwt8 < t2h1d9 && t2h1dwt8 < t2w1rwt9 && t2h1dwt8 < t2w1lwt9 && t2h1dwt8 < t2h1uwt9 && t2h1dwt8 < t2h1dwt9 
  && t2h1dwt8 < t2w1r10 && t2h1dwt8 < t2w1l10 && t2h1dwt8 < t2h1u10 && t2h1dwt8 < t2h1d10 && t2h1dwt8 < t2w1rwt10 && t2h1dwt8 < t2w1lwt10 && t2h1dwt8 < t2h1uwt10 && t2h1dwt8 < t2h1dwt10
  && ((louthd8 !=0 && linhd8==0) || (louthd8 ==0 && linhd8!=0))){
  i=361;
  }

  if (mydOW8==-1 && t2h1dwt8 > 0 && t2h1dwt8 < t1 
  && t2h1dwt8 < t2w1r && t2h1dwt8 < t2w1l && t2h1dwt8 < t2h1u && t2h1dwt8 < t2h1d && t2h1dwt8 < t2w1rwt && t2h1dwt8 < t2w1lwt && t2h1dwt8 < t2h1uwt && t2h1dwt8 < t2h1dwt 
  && t2h1dwt8 < t2w1r1 && t2h1dwt8 < t2w1l1 && t2h1dwt8 < t2h1u1 && t2h1dwt8 < t2h1d1 && t2h1dwt8 < t2w1rwt1 && t2h1dwt8 < t2w1lwt1 && t2h1dwt8 < t2h1uwt1 && t2h1dwt8 < t2h1dwt1
  && t2h1dwt8 < t2w1r2 && t2h1dwt8 < t2w1l2 && t2h1dwt8 < t2h1u2 && t2h1dwt8 < t2h1d2 && t2h1dwt8 < t2w1rwt2 && t2h1dwt8 < t2w1lwt2 && t2h1dwt8 < t2h1uwt2 && t2h1dwt8 < t2h1dwt2 
  && t2h1dwt8 < t2w1r3 && t2h1dwt8 < t2w1l3 && t2h1dwt8 < t2h1u3 && t2h1dwt8 < t2h1d3 && t2h1dwt8 < t2w1rwt3 && t2h1dwt8 < t2w1lwt3 && t2h1dwt8 < t2h1uwt3 && t2h1dwt8 < t2h1dwt3
  && t2h1dwt8 < t2w1r4 && t2h1dwt8 < t2w1l4 && t2h1dwt8 < t2h1u4 && t2h1dwt8 < t2h1d4 && t2h1dwt8 < t2w1rwt4 && t2h1dwt8 < t2w1lwt4 && t2h1dwt8 < t2h1uwt4 && t2h1dwt8 < t2h1dwt4
  && t2h1dwt8 < t2w1r5 && t2h1dwt8 < t2w1l5 && t2h1dwt8 < t2h1u5 && t2h1dwt8 < t2h1d5 && t2h1dwt8 < t2w1rwt5 && t2h1dwt8 < t2w1lwt5 && t2h1dwt8 < t2h1uwt5 && t2h1dwt8 < t2h1dwt5
  && t2h1dwt8 < t2w1r6 && t2h1dwt8 < t2w1l6 && t2h1dwt8 < t2h1u6 && t2h1dwt8 < t2h1d6 && t2h1dwt8 < t2w1rwt6 && t2h1dwt8 < t2w1lwt6 && t2h1dwt8 < t2h1uwt6 && t2h1dwt8 < t2h1dwt6
  && t2h1dwt8 < t2w1r7 && t2h1dwt8 < t2w1l7 && t2h1dwt8 < t2h1u7 && t2h1dwt8 < t2h1d7 && t2h1dwt8 < t2w1rwt7 && t2h1dwt8 < t2w1lwt7 && t2h1dwt8 < t2h1uwt7 && t2h1dwt8 < t2h1dwt7 
  && t2h1dwt8 < t2w1r8 && t2h1dwt8 < t2w1l8 && t2h1dwt8 < t2h1u8 && t2h1dwt8 < t2h1d8 && t2h1dwt8 < t2w1rwt8 && t2h1dwt8 < t2w1lwt8 && t2h1dwt8 < t2h1uwt8 
  && t2h1dwt8 < t2w1r9 && t2h1dwt8 < t2w1l9 && t2h1dwt8 < t2h1u9 && t2h1dwt8 < t2h1d9 && t2h1dwt8 < t2w1rwt9 && t2h1dwt8 < t2w1lwt9 && t2h1dwt8 < t2h1uwt9 && t2h1dwt8 < t2h1dwt9 
  && t2h1dwt8 < t2w1r10 && t2h1dwt8 < t2w1l10 && t2h1dwt8 < t2h1u10 && t2h1dwt8 < t2h1d10 && t2h1dwt8 < t2w1rwt10 && t2h1dwt8 < t2w1lwt10 && t2h1dwt8 < t2h1uwt10 && t2h1dwt8 < t2h1dwt10
  && (louthd8 == 0 && linhd8 == 0)){ 
  i=361;
  }


  if (mxr9!=-1 && t2w1r9 > 0 && t2w1r9 < t1 
     && t2w1r9 < t2w1r && t2w1r9 < t2w1l && t2w1r9 < t2h1u && t2w1r9 < t2h1d && t2w1r9 < t2w1rwt && t2w1r9 < t2w1lwt && t2w1r9 < t2h1uwt && t2w1r9 < t2h1dwt
     && t2w1r9 < t2w1r1 && t2w1r9 < t2w1l1 && t2w1r9 < t2h1u1 && t2w1r9 < t2h1d1 && t2w1r9 < t2w1rwt1 && t2w1r9 < t2w1lwt1 && t2w1r9 < t2h1uwt1 && t2w1r9 < t2h1dwt1
     && t2w1r9 < t2w1r2 && t2w1r9 < t2w1l2 && t2w1r9 < t2h1u2 && t2w1r9 < t2h1d2 && t2w1r9 < t2w1rwt2 && t2w1r9 < t2w1lwt2 && t2w1r9 < t2h1uwt2 && t2w1r9 < t2h1dwt2 
     && t2w1r9 < t2w1r3 && t2w1r9 < t2w1l3 && t2w1r9 < t2h1u3 && t2w1r9 < t2h1d3 && t2w1r9 < t2w1rwt3 && t2w1r9 < t2w1lwt3 && t2w1r9 < t2h1uwt3 && t2w1r9 < t2h1dwt3
     && t2w1r9 < t2w1r4 && t2w1r9 < t2w1l4 && t2w1r9 < t2h1u4 && t2w1r9 < t2h1d4 && t2w1r9 < t2w1rwt4 && t2w1r9 < t2w1lwt4 && t2w1r9 < t2h1uwt4 && t2w1r9 < t2h1dwt4
     && t2w1r9 < t2w1r5 && t2w1r9 < t2w1l5 && t2w1r9 < t2h1u5 && t2w1r9 < t2h1d5 && t2w1r9 < t2w1rwt5 && t2w1r9 < t2w1lwt5 && t2w1r9 < t2h1uwt5 && t2w1r9 < t2h1dwt5
     && t2w1r9 < t2w1r6 && t2w1r9 < t2w1l6 && t2w1r9 < t2h1u6 && t2w1r9 < t2h1d6 && t2w1r9 < t2w1rwt6 && t2w1r9 < t2w1lwt6 && t2w1r9 < t2h1uwt6 && t2w1r9 < t2h1dwt6
     && t2w1r9 < t2w1r7 && t2w1r9 < t2w1l7 && t2w1r9 < t2h1u7 && t2w1r9 < t2h1d7 && t2w1r9 < t2w1rwt7 && t2w1r9 < t2w1lwt7 && t2w1r9 < t2h1uwt7 && t2w1r9 < t2h1dwt7
     && t2w1r9 < t2w1r8 && t2w1r9 < t2w1l8 && t2w1r9 < t2h1u8 && t2w1r9 < t2h1d8 && t2w1r9 < t2w1rwt8 && t2w1r9 < t2w1lwt8 && t2w1r9 < t2h1uwt8 && t2w1r9 < t2h1dwt8
     && t2w1r9 < t2w1l9 && t2w1r9 < t2h1u9 && t2w1r9 < t2h1d9 && t2w1r9 < t2w1rwt9 && t2w1r9 < t2w1lwt9 && t2w1r9 < t2h1uwt9 && t2w1r9 < t2h1dwt9
     && t2w1r9 < t2w1r10 && t2w1r9 < t2w1l10 && t2w1r9 < t2h1u10 && t2w1r9 < t2h1d10 && t2w1r9 < t2w1rwt10 && t2w1r9 < t2w1lwt10 && t2w1r9 < t2h1uwt10 && t2w1r9 < t2h1dwt10
     && ((linwr9!=0) && (loutwr9!=0) )) {	
    if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1r9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1r9+z))*(z0hd9+(vz*t2w1r9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1r9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1r9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1r9+z))*(z0hu9+(vz*t2w1r9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1r9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1r9+y;
  xlimitr=bwr9*sqrt(1-((vz*t2w1r9+z)+z0wr9)*((vz*t2w1r9+z)+z0wr9)/a2wr9);
  xtest=vx*t2w1r9+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr9 > 0){
  i=362;
  }else{
  i=378;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr9!=-1 && t2w1r9 > 0 && t2w1r9 < t1 
     && t2w1r9 < t2w1r && t2w1r9 < t2w1l && t2w1r9 < t2h1u && t2w1r9 < t2h1d && t2w1r9 < t2w1rwt && t2w1r9 < t2w1lwt && t2w1r9 < t2h1uwt && t2w1r9 < t2h1dwt
     && t2w1r9 < t2w1r1 && t2w1r9 < t2w1l1 && t2w1r9 < t2h1u1 && t2w1r9 < t2h1d1 && t2w1r9 < t2w1rwt1 && t2w1r9 < t2w1lwt1 && t2w1r9 < t2h1uwt1 && t2w1r9 < t2h1dwt1
     && t2w1r9 < t2w1r2 && t2w1r9 < t2w1l2 && t2w1r9 < t2h1u2 && t2w1r9 < t2h1d2 && t2w1r9 < t2w1rwt2 && t2w1r9 < t2w1lwt2 && t2w1r9 < t2h1uwt2 && t2w1r9 < t2h1dwt2 
     && t2w1r9 < t2w1r3 && t2w1r9 < t2w1l3 && t2w1r9 < t2h1u3 && t2w1r9 < t2h1d3 && t2w1r9 < t2w1rwt3 && t2w1r9 < t2w1lwt3 && t2w1r9 < t2h1uwt3 && t2w1r9 < t2h1dwt3
     && t2w1r9 < t2w1r4 && t2w1r9 < t2w1l4 && t2w1r9 < t2h1u4 && t2w1r9 < t2h1d4 && t2w1r9 < t2w1rwt4 && t2w1r9 < t2w1lwt4 && t2w1r9 < t2h1uwt4 && t2w1r9 < t2h1dwt4
     && t2w1r9 < t2w1r5 && t2w1r9 < t2w1l5 && t2w1r9 < t2h1u5 && t2w1r9 < t2h1d5 && t2w1r9 < t2w1rwt5 && t2w1r9 < t2w1lwt5 && t2w1r9 < t2h1uwt5 && t2w1r9 < t2h1dwt5
     && t2w1r9 < t2w1r6 && t2w1r9 < t2w1l6 && t2w1r9 < t2h1u6 && t2w1r9 < t2h1d6 && t2w1r9 < t2w1rwt6 && t2w1r9 < t2w1lwt6 && t2w1r9 < t2h1uwt6 && t2w1r9 < t2h1dwt6
     && t2w1r9 < t2w1r7 && t2w1r9 < t2w1l7 && t2w1r9 < t2h1u7 && t2w1r9 < t2h1d7 && t2w1r9 < t2w1rwt7 && t2w1r9 < t2w1lwt7 && t2w1r9 < t2h1uwt7 && t2w1r9 < t2h1dwt7
     && t2w1r9 < t2w1r8 && t2w1r9 < t2w1l8 && t2w1r9 < t2h1u8 && t2w1r9 < t2h1d8 && t2w1r9 < t2w1rwt8 && t2w1r9 < t2w1lwt8 && t2w1r9 < t2h1uwt8 && t2w1r9 < t2h1dwt8
     && t2w1r9 < t2w1l9 && t2w1r9 < t2h1u9 && t2w1r9 < t2h1d9 && t2w1r9 < t2w1rwt9 && t2w1r9 < t2w1lwt9 && t2w1r9 < t2h1uwt9 && t2w1r9 < t2h1dwt9
     && t2w1r9 < t2w1r10 && t2w1r9 < t2w1l10 && t2w1r9 < t2h1u10 && t2w1r9 < t2h1d10 && t2w1r9 < t2w1rwt10 && t2w1r9 < t2w1lwt10 && t2w1r9 < t2h1uwt10 && t2w1r9 < t2h1dwt10
     && ((loutwr9!=0 && linwr9==0) || (loutwr9==0 && linwr9!=0))){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1r9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1r9+z))*(z0hd9+(vz*t2w1r9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1r9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1r9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1r9+z))*(z0hu9+(vz*t2w1r9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1r9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1r9+y;
  xtest=vx*t2w1r9+x;
  xlimitr=-sqrt(pbwr9-(vz*t2w1r9+z)/pawr9);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr9 > 0){
  i=363;
  }else{
  i=378;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr9!=-1 && t2w1r9 > 0 && t2w1r9 < t1 
     && t2w1r9 < t2w1r && t2w1r9 < t2w1l && t2w1r9 < t2h1u && t2w1r9 < t2h1d && t2w1r9 < t2w1rwt && t2w1r9 < t2w1lwt && t2w1r9 < t2h1uwt && t2w1r9 < t2h1dwt
     && t2w1r9 < t2w1r1 && t2w1r9 < t2w1l1 && t2w1r9 < t2h1u1 && t2w1r9 < t2h1d1 && t2w1r9 < t2w1rwt1 && t2w1r9 < t2w1lwt1 && t2w1r9 < t2h1uwt1 && t2w1r9 < t2h1dwt1
     && t2w1r9 < t2w1r2 && t2w1r9 < t2w1l2 && t2w1r9 < t2h1u2 && t2w1r9 < t2h1d2 && t2w1r9 < t2w1rwt2 && t2w1r9 < t2w1lwt2 && t2w1r9 < t2h1uwt2 && t2w1r9 < t2h1dwt2 
     && t2w1r9 < t2w1r3 && t2w1r9 < t2w1l3 && t2w1r9 < t2h1u3 && t2w1r9 < t2h1d3 && t2w1r9 < t2w1rwt3 && t2w1r9 < t2w1lwt3 && t2w1r9 < t2h1uwt3 && t2w1r9 < t2h1dwt3
     && t2w1r9 < t2w1r4 && t2w1r9 < t2w1l4 && t2w1r9 < t2h1u4 && t2w1r9 < t2h1d4 && t2w1r9 < t2w1rwt4 && t2w1r9 < t2w1lwt4 && t2w1r9 < t2h1uwt4 && t2w1r9 < t2h1dwt4
     && t2w1r9 < t2w1r5 && t2w1r9 < t2w1l5 && t2w1r9 < t2h1u5 && t2w1r9 < t2h1d5 && t2w1r9 < t2w1rwt5 && t2w1r9 < t2w1lwt5 && t2w1r9 < t2h1uwt5 && t2w1r9 < t2h1dwt5
     && t2w1r9 < t2w1r6 && t2w1r9 < t2w1l6 && t2w1r9 < t2h1u6 && t2w1r9 < t2h1d6 && t2w1r9 < t2w1rwt6 && t2w1r9 < t2w1lwt6 && t2w1r9 < t2h1uwt6 && t2w1r9 < t2h1dwt6
     && t2w1r9 < t2w1r7 && t2w1r9 < t2w1l7 && t2w1r9 < t2h1u7 && t2w1r9 < t2h1d7 && t2w1r9 < t2w1rwt7 && t2w1r9 < t2w1lwt7 && t2w1r9 < t2h1uwt7 && t2w1r9 < t2h1dwt7
     && t2w1r9 < t2w1r8 && t2w1r9 < t2w1l8 && t2w1r9 < t2h1u8 && t2w1r9 < t2h1d8 && t2w1r9 < t2w1rwt8 && t2w1r9 < t2w1lwt8 && t2w1r9 < t2h1uwt8 && t2w1r9 < t2h1dwt8
     && t2w1r9 < t2w1l9 && t2w1r9 < t2h1u9 && t2w1r9 < t2h1d9 && t2w1r9 < t2w1rwt9 && t2w1r9 < t2w1lwt9 && t2w1r9 < t2h1uwt9 && t2w1r9 < t2h1dwt9
     && t2w1r9 < t2w1r10 && t2w1r9 < t2w1l10 && t2w1r9 < t2h1u10 && t2w1r9 < t2h1d10 && t2w1r9 < t2w1rwt10 && t2w1r9 < t2w1lwt10 && t2w1r9 < t2h1uwt10 && t2w1r9 < t2h1dwt10
     && (loutwr9==0 && linwr9==0)){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1r9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1r9+z))*(z0hd9+(vz*t2w1r9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1r9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1r9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1r9+z))*(z0hu9+(vz*t2w1r9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1r9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1r9+y;
  xtest=vx*t2w1r9+x;
  xlimitr=-(w2r9+w1r9)*(vz*t2w1r9+z)/l-w1r9;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr9>0){
  i=364;
  }else{
  i=378;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl9!=-1 && t2w1l9 > 0 && t2w1l9 < t1 
      && t2w1l9 < t2w1r && t2w1l9 < t2w1l && t2w1l9 < t2h1u && t2w1l9 < t2h1d && t2w1l9 < t2w1rwt && t2w1l9 < t2w1lwt && t2w1l9 < t2h1uwt && t2w1l9 < t2h1dwt
      && t2w1l9 < t2w1r1 && t2w1l9 < t2w1l1 && t2w1l9 < t2h1u1 && t2w1l9 < t2h1d1 && t2w1l9 < t2w1rwt1 && t2w1l9 < t2w1lwt1 && t2w1l9 < t2h1uwt1 && t2w1l9 < t2h1dwt1
      && t2w1l9 < t2w1r2 && t2w1l9 < t2w1l2 && t2w1l9 < t2h1u2 && t2w1l9 < t2h1d2 && t2w1l9 < t2w1rwt2 && t2w1l9 < t2w1lwt2 && t2w1l9 < t2h1uwt2 && t2w1l9 < t2h1dwt2
      && t2w1l9 < t2w1r3 && t2w1l9 < t2w1l3 && t2w1l9 < t2h1u3 && t2w1l9 < t2h1d3 && t2w1l9 < t2w1rwt3 && t2w1l9 < t2w1lwt3 && t2w1l9 < t2h1uwt3 && t2w1l9 < t2h1dwt3
      && t2w1l9 < t2w1r4 && t2w1l9 < t2w1l4 && t2w1l9 < t2h1u4 && t2w1l9 < t2h1d4 && t2w1l9 < t2w1rwt4 && t2w1l9 < t2w1lwt4 && t2w1l9 < t2h1uwt4 && t2w1l9 < t2h1dwt4
      && t2w1l9 < t2w1r5 && t2w1l9 < t2w1l5 && t2w1l9 < t2h1u5 && t2w1l9 < t2h1d5 && t2w1l9 < t2w1rwt5 && t2w1l9 < t2w1lwt5 && t2w1l9 < t2h1uwt5 && t2w1l9 < t2h1dwt5
      && t2w1l9 < t2w1r6 && t2w1l9 < t2w1l6 && t2w1l9 < t2h1u6 && t2w1l9 < t2h1d6 && t2w1l9 < t2w1rwt6 && t2w1l9 < t2w1lwt6 && t2w1l9 < t2h1uwt6 && t2w1l9 < t2h1dwt6
      && t2w1l9 < t2w1r7 && t2w1l9 < t2w1l7 && t2w1l9 < t2h1u7 && t2w1l9 < t2h1d7 && t2w1l9 < t2w1rwt7 && t2w1l9 < t2w1lwt7 && t2w1l9 < t2h1uwt7 && t2w1l9 < t2h1dwt7
      && t2w1l9 < t2w1r8 && t2w1l9 < t2w1l8 && t2w1l9 < t2h1u8 && t2w1l9 < t2h1d8 && t2w1l9 < t2w1rwt8 && t2w1l9 < t2w1lwt8 && t2w1l9 < t2h1uwt8 && t2w1l9 < t2h1dwt8
      && t2w1l9 < t2w1r9 && t2w1l9 < t2h1u9 && t2w1l9 < t2h1d9 && t2w1l9 < t2w1rwt9 && t2w1l9 < t2w1lwt9 && t2w1l9 < t2h1uwt9 && t2w1l9 < t2h1dwt9
      && t2w1l9 < t2w1r10 && t2w1l9 < t2w1l10 && t2w1l9 < t2h1u10 && t2w1l9 < t2h1d10 && t2w1l9 < t2w1rwt10 && t2w1l9 < t2w1lwt10 && t2w1l9 < t2h1uwt10 && t2w1l9 < t2h1dwt10
      && ((linwl9!=0) && (loutwl9!=0) )){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1l9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1l9+z))*(z0hd9+(vz*t2w1l9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1l9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1l9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1l9+z))*(z0hu9+(vz*t2w1l9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1l9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1l9+y;
  xlimitl=bwl9*sqrt(1-((vz*t2w1l9+z)+z0wl9)*((vz*t2w1l9+z)+z0wl9)/a2wl9);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl9>0){
  i=365;
  }else{
  i=379;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl9!=-1 && t2w1l9 > 0 && t2w1l9 < t1 
      && t2w1l9 < t2w1r && t2w1l9 < t2w1l && t2w1l9 < t2h1u && t2w1l9 < t2h1d && t2w1l9 < t2w1rwt && t2w1l9 < t2w1lwt && t2w1l9 < t2h1uwt && t2w1l9 < t2h1dwt
      && t2w1l9 < t2w1r1 && t2w1l9 < t2w1l1 && t2w1l9 < t2h1u1 && t2w1l9 < t2h1d1 && t2w1l9 < t2w1rwt1 && t2w1l9 < t2w1lwt1 && t2w1l9 < t2h1uwt1 && t2w1l9 < t2h1dwt1
      && t2w1l9 < t2w1r2 && t2w1l9 < t2w1l2 && t2w1l9 < t2h1u2 && t2w1l9 < t2h1d2 && t2w1l9 < t2w1rwt2 && t2w1l9 < t2w1lwt2 && t2w1l9 < t2h1uwt2 && t2w1l9 < t2h1dwt2
      && t2w1l9 < t2w1r3 && t2w1l9 < t2w1l3 && t2w1l9 < t2h1u3 && t2w1l9 < t2h1d3 && t2w1l9 < t2w1rwt3 && t2w1l9 < t2w1lwt3 && t2w1l9 < t2h1uwt3 && t2w1l9 < t2h1dwt3
      && t2w1l9 < t2w1r4 && t2w1l9 < t2w1l4 && t2w1l9 < t2h1u4 && t2w1l9 < t2h1d4 && t2w1l9 < t2w1rwt4 && t2w1l9 < t2w1lwt4 && t2w1l9 < t2h1uwt4 && t2w1l9 < t2h1dwt4
      && t2w1l9 < t2w1r5 && t2w1l9 < t2w1l5 && t2w1l9 < t2h1u5 && t2w1l9 < t2h1d5 && t2w1l9 < t2w1rwt5 && t2w1l9 < t2w1lwt5 && t2w1l9 < t2h1uwt5 && t2w1l9 < t2h1dwt5
      && t2w1l9 < t2w1r6 && t2w1l9 < t2w1l6 && t2w1l9 < t2h1u6 && t2w1l9 < t2h1d6 && t2w1l9 < t2w1rwt6 && t2w1l9 < t2w1lwt6 && t2w1l9 < t2h1uwt6 && t2w1l9 < t2h1dwt6
      && t2w1l9 < t2w1r7 && t2w1l9 < t2w1l7 && t2w1l9 < t2h1u7 && t2w1l9 < t2h1d7 && t2w1l9 < t2w1rwt7 && t2w1l9 < t2w1lwt7 && t2w1l9 < t2h1uwt7 && t2w1l9 < t2h1dwt7
      && t2w1l9 < t2w1r8 && t2w1l9 < t2w1l8 && t2w1l9 < t2h1u8 && t2w1l9 < t2h1d8 && t2w1l9 < t2w1rwt8 && t2w1l9 < t2w1lwt8 && t2w1l9 < t2h1uwt8 && t2w1l9 < t2h1dwt8
      && t2w1l9 < t2w1r9 && t2w1l9 < t2h1u9 && t2w1l9 < t2h1d9 && t2w1l9 < t2w1rwt9 && t2w1l9 < t2w1lwt9 && t2w1l9 < t2h1uwt9 && t2w1l9 < t2h1dwt9
      && t2w1l9 < t2w1r10 && t2w1l9 < t2w1l10 && t2w1l9 < t2h1u10 && t2w1l9 < t2h1d10 && t2w1l9 < t2w1rwt10 && t2w1l9 < t2w1lwt10 && t2w1l9 < t2h1uwt10 && t2w1l9 < t2h1dwt10
      && ((loutwl9!=0 && linwl9==0) || (loutwl9==0 && linwl9!=0))){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1l9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1l9+z))*(z0hd9+(vz*t2w1l9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1l9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1l9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1l9+z))*(z0hu9+(vz*t2w1l9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1l9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1l9+y;
  xlimitl=sqrt(pbwl9-(vz*t2w1l9+z)/pawl9);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl9>0){
  i=366;
  }else{
  i=379;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl9!=-1 && t2w1l9 > 0 && t2w1l9 < t1 
      && t2w1l9 < t2w1r && t2w1l9 < t2w1l && t2w1l9 < t2h1u && t2w1l9 < t2h1d && t2w1l9 < t2w1rwt && t2w1l9 < t2w1lwt && t2w1l9 < t2h1uwt && t2w1l9 < t2h1dwt
      && t2w1l9 < t2w1r1 && t2w1l9 < t2w1l1 && t2w1l9 < t2h1u1 && t2w1l9 < t2h1d1 && t2w1l9 < t2w1rwt1 && t2w1l9 < t2w1lwt1 && t2w1l9 < t2h1uwt1 && t2w1l9 < t2h1dwt1
      && t2w1l9 < t2w1r2 && t2w1l9 < t2w1l2 && t2w1l9 < t2h1u2 && t2w1l9 < t2h1d2 && t2w1l9 < t2w1rwt2 && t2w1l9 < t2w1lwt2 && t2w1l9 < t2h1uwt2 && t2w1l9 < t2h1dwt2
      && t2w1l9 < t2w1r3 && t2w1l9 < t2w1l3 && t2w1l9 < t2h1u3 && t2w1l9 < t2h1d3 && t2w1l9 < t2w1rwt3 && t2w1l9 < t2w1lwt3 && t2w1l9 < t2h1uwt3 && t2w1l9 < t2h1dwt3
      && t2w1l9 < t2w1r4 && t2w1l9 < t2w1l4 && t2w1l9 < t2h1u4 && t2w1l9 < t2h1d4 && t2w1l9 < t2w1rwt4 && t2w1l9 < t2w1lwt4 && t2w1l9 < t2h1uwt4 && t2w1l9 < t2h1dwt4
      && t2w1l9 < t2w1r5 && t2w1l9 < t2w1l5 && t2w1l9 < t2h1u5 && t2w1l9 < t2h1d5 && t2w1l9 < t2w1rwt5 && t2w1l9 < t2w1lwt5 && t2w1l9 < t2h1uwt5 && t2w1l9 < t2h1dwt5
      && t2w1l9 < t2w1r6 && t2w1l9 < t2w1l6 && t2w1l9 < t2h1u6 && t2w1l9 < t2h1d6 && t2w1l9 < t2w1rwt6 && t2w1l9 < t2w1lwt6 && t2w1l9 < t2h1uwt6 && t2w1l9 < t2h1dwt6
      && t2w1l9 < t2w1r7 && t2w1l9 < t2w1l7 && t2w1l9 < t2h1u7 && t2w1l9 < t2h1d7 && t2w1l9 < t2w1rwt7 && t2w1l9 < t2w1lwt7 && t2w1l9 < t2h1uwt7 && t2w1l9 < t2h1dwt7
      && t2w1l9 < t2w1r8 && t2w1l9 < t2w1l8 && t2w1l9 < t2h1u8 && t2w1l9 < t2h1d8 && t2w1l9 < t2w1rwt8 && t2w1l9 < t2w1lwt8 && t2w1l9 < t2h1uwt8 && t2w1l9 < t2h1dwt8
      && t2w1l9 < t2w1r9 && t2w1l9 < t2h1u9 && t2w1l9 < t2h1d9 && t2w1l9 < t2w1rwt9 && t2w1l9 < t2w1lwt9 && t2w1l9 < t2h1uwt9 && t2w1l9 < t2h1dwt9
      && t2w1l9 < t2w1r10 && t2w1l9 < t2w1l10 && t2w1l9 < t2h1u10 && t2w1l9 < t2h1d10 && t2w1l9 < t2w1rwt10 && t2w1l9 < t2w1lwt10 && t2w1l9 < t2h1uwt10 && t2w1l9 < t2h1dwt10
      && (loutwl9==0 && linwl9==0)){
 if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1l9+z)-h1d9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhd9*sqrt(1-((z0hd9+(vz*t2w1l9+z))*(z0hd9+(vz*t2w1l9+z)))/a2hd9);
      }else{
      ylimitd=-sqrt(((vz*t2w1l9+z)-pbhd9)/-pahd9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1l9+z)+h1u9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhu9*sqrt(1-((z0hu9+(vz*t2w1l9+z))*(z0hu9+(vz*t2w1l9+z)))/a2hu9);
     }else{
     ylimitu=sqrt(((vz*t2w1l9+z)-pbhu9)/-pahu9);
    }
    }
  ytest=vy*t2w1l9+y;
  xlimitl=(w2l9-w1l9)*(vz*t2w1l9+z)/l+w1l9;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl9>0){
  i=367;
  }else{
  i=379;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu9!=-1 && t2h1u9 > 0 && t2h1u9 < t1 
  && t2h1u9 < t2w1r && t2h1u9 < t2w1l && t2h1u9 < t2h1u && t2h1u9 < t2h1d && t2h1u9 < t2w1rwt && t2h1u9 < t2w1lwt && t2h1u9 < t2h1uwt && t2h1u9 < t2h1dwt
  && t2h1u9 < t2w1r1 && t2h1u9 < t2w1l1 && t2h1u9 < t2h1u1 && t2h1u9 < t2h1d1 && t2h1u9 < t2w1rwt1 && t2h1u9 < t2w1lwt1 && t2h1u9 < t2h1uwt1 && t2h1u9 < t2h1dwt1
  && t2h1u9 < t2w1r2 && t2h1u9 < t2w1l2 && t2h1u9 < t2h1u2 && t2h1u9 < t2h1d2 && t2h1u9 < t2w1rwt2 && t2h1u9 < t2w1lwt2 && t2h1u9 < t2h1uwt2 && t2h1u9 < t2h1dwt2
  && t2h1u9 < t2w1r3 && t2h1u9 < t2w1l3 && t2h1u9 < t2h1u3 && t2h1u9 < t2h1d3 && t2h1u9 < t2w1rwt3 && t2h1u9 < t2w1lwt3 && t2h1u9 < t2h1uwt3 && t2h1u9 < t2h1dwt3
  && t2h1u9 < t2w1r4 && t2h1u9 < t2w1l4 && t2h1u9 < t2h1u4 && t2h1u9 < t2h1d4 && t2h1u9 < t2w1rwt4 && t2h1u9 < t2w1lwt4 && t2h1u9 < t2h1uwt4 && t2h1u9 < t2h1dwt4
  && t2h1u9 < t2w1r5 && t2h1u9 < t2w1l5 && t2h1u9 < t2h1u5 && t2h1u9 < t2h1d5 && t2h1u9 < t2w1rwt5 && t2h1u9 < t2w1lwt5 && t2h1u9 < t2h1uwt5 && t2h1u9 < t2h1dwt5
  && t2h1u9 < t2w1r6 && t2h1u9 < t2w1l6 && t2h1u9 < t2h1u6 && t2h1u9 < t2h1d6 && t2h1u9 < t2w1rwt6 && t2h1u9 < t2w1lwt6 && t2h1u9 < t2h1uwt6 && t2h1u9 < t2h1dwt6
  && t2h1u9 < t2w1r7 && t2h1u9 < t2w1l7 && t2h1u9 < t2h1u7 && t2h1u9 < t2h1d7 && t2h1u9 < t2w1rwt7 && t2h1u9 < t2w1lwt7 && t2h1u9 < t2h1uwt7 && t2h1u9 < t2h1dwt7
  && t2h1u9 < t2w1r8 && t2h1u9 < t2w1l8 && t2h1u9 < t2h1u8 && t2h1u9 < t2h1d8 && t2h1u9 < t2w1rwt8 && t2h1u9 < t2w1lwt8 && t2h1u9 < t2h1uwt8 && t2h1u9 < t2h1dwt8
  && t2h1u9 < t2w1r9 && t2h1u9 < t2w1l9 && t2h1u9 < t2h1d9 && t2h1u9 < t2w1rwt9 && t2h1u9 < t2w1lwt9 && t2h1u9 < t2h1uwt9 && t2h1u9 < t2h1dwt9
  && t2h1u9 < t2w1r10 && t2h1u9 < t2w1l10 && t2h1u9 < t2h1u10 && t2h1u9 < t2h1d10 && t2h1u9 < t2w1rwt10 && t2h1u9 < t2w1lwt10 && t2h1u9 < t2h1uwt10 && t2h1u9 < t2h1dwt10
  && (louthu9 !=0 && linhu9!=0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1u9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1u9+z))*(z0wr9+(vz*t2h1u9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1u9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1u9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1u9+z))*(z0wl9+(vz*t2h1u9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1u9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1u9+x;
  ylimitu=bhu9*sqrt(1-((vz*t2h1u9+z)+z0hu9)*((vz*t2h1u9+z)+z0hu9)/a2hu9);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu9>0 ){
  i=368;
  }else{
  i=380;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu9!=-1 && t2h1u9 > 0 && t2h1u9 < t1
  && t2h1u9 < t2w1r && t2h1u9 < t2w1l && t2h1u9 < t2h1u && t2h1u9 < t2h1d && t2h1u9 < t2w1rwt && t2h1u9 < t2w1lwt && t2h1u9 < t2h1uwt && t2h1u9 < t2h1dwt
  && t2h1u9 < t2w1r1 && t2h1u9 < t2w1l1 && t2h1u9 < t2h1u1 && t2h1u9 < t2h1d1 && t2h1u9 < t2w1rwt1 && t2h1u9 < t2w1lwt1 && t2h1u9 < t2h1uwt1 && t2h1u9 < t2h1dwt1
  && t2h1u9 < t2w1r2 && t2h1u9 < t2w1l2 && t2h1u9 < t2h1u2 && t2h1u9 < t2h1d2 && t2h1u9 < t2w1rwt2 && t2h1u9 < t2w1lwt2 && t2h1u9 < t2h1uwt2 && t2h1u9 < t2h1dwt2
  && t2h1u9 < t2w1r3 && t2h1u9 < t2w1l3 && t2h1u9 < t2h1u3 && t2h1u9 < t2h1d3 && t2h1u9 < t2w1rwt3 && t2h1u9 < t2w1lwt3 && t2h1u9 < t2h1uwt3 && t2h1u9 < t2h1dwt3
  && t2h1u9 < t2w1r4 && t2h1u9 < t2w1l4 && t2h1u9 < t2h1u4 && t2h1u9 < t2h1d4 && t2h1u9 < t2w1rwt4 && t2h1u9 < t2w1lwt4 && t2h1u9 < t2h1uwt4 && t2h1u9 < t2h1dwt4
  && t2h1u9 < t2w1r5 && t2h1u9 < t2w1l5 && t2h1u9 < t2h1u5 && t2h1u9 < t2h1d5 && t2h1u9 < t2w1rwt5 && t2h1u9 < t2w1lwt5 && t2h1u9 < t2h1uwt5 && t2h1u9 < t2h1dwt5
  && t2h1u9 < t2w1r6 && t2h1u9 < t2w1l6 && t2h1u9 < t2h1u6 && t2h1u9 < t2h1d6 && t2h1u9 < t2w1rwt6 && t2h1u9 < t2w1lwt6 && t2h1u9 < t2h1uwt6 && t2h1u9 < t2h1dwt6
  && t2h1u9 < t2w1r7 && t2h1u9 < t2w1l7 && t2h1u9 < t2h1u7 && t2h1u9 < t2h1d7 && t2h1u9 < t2w1rwt7 && t2h1u9 < t2w1lwt7 && t2h1u9 < t2h1uwt7 && t2h1u9 < t2h1dwt7
  && t2h1u9 < t2w1r8 && t2h1u9 < t2w1l8 && t2h1u9 < t2h1u8 && t2h1u9 < t2h1d8 && t2h1u9 < t2w1rwt8 && t2h1u9 < t2w1lwt8 && t2h1u9 < t2h1uwt8 && t2h1u9 < t2h1dwt8
  && t2h1u9 < t2w1r9 && t2h1u9 < t2w1l9 && t2h1u9 < t2h1d9 && t2h1u9 < t2w1rwt9 && t2h1u9 < t2w1lwt9 && t2h1u9 < t2h1uwt9 && t2h1u9 < t2h1dwt9
  && t2h1u9 < t2w1r10 && t2h1u9 < t2w1l10 && t2h1u9 < t2h1u10 && t2h1u9 < t2h1d10 && t2h1u9 < t2w1rwt10 && t2h1u9 < t2w1lwt10 && t2h1u9 < t2h1uwt10 && t2h1u9 < t2h1dwt10 
  && ((louthu9!=0 && linhu9==0) || (louthu9==0 && linhu9!=0))){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1u9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1u9+z))*(z0wr9+(vz*t2h1u9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1u9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1u9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1u9+z))*(z0wl9+(vz*t2h1u9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1u9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1u9+x;
  ylimitu=sqrt(pbhu9-(vz*t2h1u9+z)/pahu9);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu9>0){
  i=369;
  }else{
  i=380;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu9!=-1 && t2h1u9 > 0 && t2h1u9 < t1
  && t2h1u9 < t2w1r && t2h1u9 < t2w1l && t2h1u9 < t2h1u && t2h1u9 < t2h1d && t2h1u9 < t2w1rwt && t2h1u9 < t2w1lwt && t2h1u9 < t2h1uwt && t2h1u9 < t2h1dwt
  && t2h1u9 < t2w1r1 && t2h1u9 < t2w1l1 && t2h1u9 < t2h1u1 && t2h1u9 < t2h1d1 && t2h1u9 < t2w1rwt1 && t2h1u9 < t2w1lwt1 && t2h1u9 < t2h1uwt1 && t2h1u9 < t2h1dwt1
  && t2h1u9 < t2w1r2 && t2h1u9 < t2w1l2 && t2h1u9 < t2h1u2 && t2h1u9 < t2h1d2 && t2h1u9 < t2w1rwt2 && t2h1u9 < t2w1lwt2 && t2h1u9 < t2h1uwt2 && t2h1u9 < t2h1dwt2
  && t2h1u9 < t2w1r3 && t2h1u9 < t2w1l3 && t2h1u9 < t2h1u3 && t2h1u9 < t2h1d3 && t2h1u9 < t2w1rwt3 && t2h1u9 < t2w1lwt3 && t2h1u9 < t2h1uwt3 && t2h1u9 < t2h1dwt3
  && t2h1u9 < t2w1r4 && t2h1u9 < t2w1l4 && t2h1u9 < t2h1u4 && t2h1u9 < t2h1d4 && t2h1u9 < t2w1rwt4 && t2h1u9 < t2w1lwt4 && t2h1u9 < t2h1uwt4 && t2h1u9 < t2h1dwt4
  && t2h1u9 < t2w1r5 && t2h1u9 < t2w1l5 && t2h1u9 < t2h1u5 && t2h1u9 < t2h1d5 && t2h1u9 < t2w1rwt5 && t2h1u9 < t2w1lwt5 && t2h1u9 < t2h1uwt5 && t2h1u9 < t2h1dwt5
  && t2h1u9 < t2w1r6 && t2h1u9 < t2w1l6 && t2h1u9 < t2h1u6 && t2h1u9 < t2h1d6 && t2h1u9 < t2w1rwt6 && t2h1u9 < t2w1lwt6 && t2h1u9 < t2h1uwt6 && t2h1u9 < t2h1dwt6
  && t2h1u9 < t2w1r7 && t2h1u9 < t2w1l7 && t2h1u9 < t2h1u7 && t2h1u9 < t2h1d7 && t2h1u9 < t2w1rwt7 && t2h1u9 < t2w1lwt7 && t2h1u9 < t2h1uwt7 && t2h1u9 < t2h1dwt7
  && t2h1u9 < t2w1r8 && t2h1u9 < t2w1l8 && t2h1u9 < t2h1u8 && t2h1u9 < t2h1d8 && t2h1u9 < t2w1rwt8 && t2h1u9 < t2w1lwt8 && t2h1u9 < t2h1uwt8 && t2h1u9 < t2h1dwt8
  && t2h1u9 < t2w1r9 && t2h1u9 < t2w1l9 && t2h1u9 < t2h1d9 && t2h1u9 < t2w1rwt9 && t2h1u9 < t2w1lwt9 && t2h1u9 < t2h1uwt9 && t2h1u9 < t2h1dwt9
  && t2h1u9 < t2w1r10 && t2h1u9 < t2w1l10 && t2h1u9 < t2h1u10 && t2h1u9 < t2h1d10 && t2h1u9 < t2w1rwt10 && t2h1u9 < t2w1lwt10 && t2h1u9 < t2h1uwt10 && t2h1u9 < t2h1dwt10
  && (louthu9 == 0 && linhu9 == 0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1u9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1u9+z))*(z0wr9+(vz*t2h1u9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1u9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1u9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1u9+z))*(z0wl9+(vz*t2h1u9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1u9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1u9+x;
  ylimitu=(h2u9-h1u9)*(vz*t2h1u9+z)/l+h1u9;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu9>0 ){
  i=370;
  }else{
  i=380;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd9!=-1 && t2h1d9 > 0 && t2h1d9 < t1 
  && t2h1d9 < t2w1r && t2h1d9 < t2w1l && t2h1d9 < t2h1u && t2h1d9 < t2h1d && t2h1d9 < t2w1rwt && t2h1d9 < t2w1lwt && t2h1d9 < t2h1uwt && t2h1d9 < t2h1dwt
  && t2h1d9 < t2w1r1 && t2h1d9 < t2w1l1 && t2h1d9 < t2h1u1 && t2h1d9 < t2h1d1 && t2h1d9 < t2w1rwt1 && t2h1d9 < t2w1lwt1 && t2h1d9 < t2h1uwt1 && t2h1d9 < t2h1dwt1
  && t2h1d9 < t2w1r2 && t2h1d9 < t2w1l2 && t2h1d9 < t2h1u2 && t2h1d9 < t2h1d2 && t2h1d9 < t2w1rwt2 && t2h1d9 < t2w1lwt2 && t2h1d9 < t2h1uwt2 && t2h1d9 < t2h1dwt2
  && t2h1d9 < t2w1r3 && t2h1d9 < t2w1l3 && t2h1d9 < t2h1u3 && t2h1d9 < t2h1d3 && t2h1d9 < t2w1rwt3 && t2h1d9 < t2w1lwt3 && t2h1d9 < t2h1uwt3 && t2h1d9 < t2h1dwt3
  && t2h1d9 < t2w1r4 && t2h1d9 < t2w1l4 && t2h1d9 < t2h1u4 && t2h1d9 < t2h1d4 && t2h1d9 < t2w1rwt4 && t2h1d9 < t2w1lwt4 && t2h1d9 < t2h1uwt4 && t2h1d9 < t2h1dwt4
  && t2h1d9 < t2w1r5 && t2h1d9 < t2w1l5 && t2h1d9 < t2h1u5 && t2h1d9 < t2h1d5 && t2h1d9 < t2w1rwt5 && t2h1d9 < t2w1lwt5 && t2h1d9 < t2h1uwt5 && t2h1d9 < t2h1dwt5
  && t2h1d9 < t2w1r6 && t2h1d9 < t2w1l6 && t2h1d9 < t2h1u6 && t2h1d9 < t2h1d6 && t2h1d9 < t2w1rwt6 && t2h1d9 < t2w1lwt6 && t2h1d9 < t2h1uwt6 && t2h1d9 < t2h1dwt6
  && t2h1d9 < t2w1r7 && t2h1d9 < t2w1l7 && t2h1d9 < t2h1u7 && t2h1d9 < t2h1d7 && t2h1d9 < t2w1rwt7 && t2h1d9 < t2w1lwt7 && t2h1d9 < t2h1uwt7 && t2h1d9 < t2h1dwt7
  && t2h1d9 < t2w1r8 && t2h1d9 < t2w1l8 && t2h1d9 < t2h1u8 && t2h1d9 < t2h1d8 && t2h1d9 < t2w1rwt8 && t2h1d9 < t2w1lwt8 && t2h1d9 < t2h1uwt8 && t2h1d9 < t2h1dwt8
  && t2h1d9 < t2w1r9 && t2h1d9 < t2w1l9 && t2h1d9 < t2h1u9 && t2h1d9 < t2w1rwt9 && t2h1d9 < t2w1lwt9 && t2h1d9 < t2h1uwt9 && t2h1d9 < t2h1dwt9
  && t2h1d9 < t2w1r10 && t2h1d9 < t2w1l10 && t2h1d9 < t2h1u10 && t2h1d9 < t2h1d10 && t2h1d9 < t2w1rwt10 && t2h1d9 < t2w1lwt10 && t2h1d9 < t2h1uwt10 && t2h1d9 < t2h1dwt10
  && (louthd9 !=0 && linhd9!=0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1d9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1d9+z))*(z0wr9+(vz*t2h1d9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1d9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1d9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1d9+z))*(z0wl9+(vz*t2h1d9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1d9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1d9+x;
  ylimitd=-bhd9*sqrt(1-((vz*t2h1d9+z)+z0hd9)*((vz*t2h1d9+z)+z0hd9)/a2hd9);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd9>0){
  i=371;
  }else{
  i=381;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd9!=-1 && t2h1d9 > 0 && t2h1d9 < t1 
  && t2h1d9 < t2w1r && t2h1d9 < t2w1l && t2h1d9 < t2h1u && t2h1d9 < t2h1d && t2h1d9 < t2w1rwt && t2h1d9 < t2w1lwt && t2h1d9 < t2h1uwt && t2h1d9 < t2h1dwt
  && t2h1d9 < t2w1r1 && t2h1d9 < t2w1l1 && t2h1d9 < t2h1u1 && t2h1d9 < t2h1d1 && t2h1d9 < t2w1rwt1 && t2h1d9 < t2w1lwt1 && t2h1d9 < t2h1uwt1 && t2h1d9 < t2h1dwt1
  && t2h1d9 < t2w1r2 && t2h1d9 < t2w1l2 && t2h1d9 < t2h1u2 && t2h1d9 < t2h1d2 && t2h1d9 < t2w1rwt2 && t2h1d9 < t2w1lwt2 && t2h1d9 < t2h1uwt2 && t2h1d9 < t2h1dwt2
  && t2h1d9 < t2w1r3 && t2h1d9 < t2w1l3 && t2h1d9 < t2h1u3 && t2h1d9 < t2h1d3 && t2h1d9 < t2w1rwt3 && t2h1d9 < t2w1lwt3 && t2h1d9 < t2h1uwt3 && t2h1d9 < t2h1dwt3
  && t2h1d9 < t2w1r4 && t2h1d9 < t2w1l4 && t2h1d9 < t2h1u4 && t2h1d9 < t2h1d4 && t2h1d9 < t2w1rwt4 && t2h1d9 < t2w1lwt4 && t2h1d9 < t2h1uwt4 && t2h1d9 < t2h1dwt4
  && t2h1d9 < t2w1r5 && t2h1d9 < t2w1l5 && t2h1d9 < t2h1u5 && t2h1d9 < t2h1d5 && t2h1d9 < t2w1rwt5 && t2h1d9 < t2w1lwt5 && t2h1d9 < t2h1uwt5 && t2h1d9 < t2h1dwt5
  && t2h1d9 < t2w1r6 && t2h1d9 < t2w1l6 && t2h1d9 < t2h1u6 && t2h1d9 < t2h1d6 && t2h1d9 < t2w1rwt6 && t2h1d9 < t2w1lwt6 && t2h1d9 < t2h1uwt6 && t2h1d9 < t2h1dwt6
  && t2h1d9 < t2w1r7 && t2h1d9 < t2w1l7 && t2h1d9 < t2h1u7 && t2h1d9 < t2h1d7 && t2h1d9 < t2w1rwt7 && t2h1d9 < t2w1lwt7 && t2h1d9 < t2h1uwt7 && t2h1d9 < t2h1dwt7
  && t2h1d9 < t2w1r8 && t2h1d9 < t2w1l8 && t2h1d9 < t2h1u8 && t2h1d9 < t2h1d8 && t2h1d9 < t2w1rwt8 && t2h1d9 < t2w1lwt8 && t2h1d9 < t2h1uwt8 && t2h1d9 < t2h1dwt8
  && t2h1d9 < t2w1r9 && t2h1d9 < t2w1l9 && t2h1d9 < t2h1u9 && t2h1d9 < t2w1rwt9 && t2h1d9 < t2w1lwt9 && t2h1d9 < t2h1uwt9 && t2h1d9 < t2h1dwt9
  && t2h1d9 < t2w1r10 && t2h1d9 < t2w1l10 && t2h1d9 < t2h1u10 && t2h1d9 < t2h1d10 && t2h1d9 < t2w1rwt10 && t2h1d9 < t2w1lwt10 && t2h1d9 < t2h1uwt10 && t2h1d9 < t2h1dwt10
  && ((louthd9 !=0 && linhd9==0) || (louthd9 ==0 && linhd9!=0))){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1d9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1d9+z))*(z0wr9+(vz*t2h1d9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1d9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1d9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1d9+z))*(z0wl9+(vz*t2h1d9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1d9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1d9+x;
  ylimitd=-sqrt(pbhd9-(vz*t2h1d9+z)/pahd9);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd9>0 ){
  i=372;
  }else{
  i=381;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd9!=-1 && t2h1d9 > 0 && t2h1d9 < t1 
  && t2h1d9 < t2w1r && t2h1d9 < t2w1l && t2h1d9 < t2h1u && t2h1d9 < t2h1d && t2h1d9 < t2w1rwt && t2h1d9 < t2w1lwt && t2h1d9 < t2h1uwt && t2h1d9 < t2h1dwt
  && t2h1d9 < t2w1r1 && t2h1d9 < t2w1l1 && t2h1d9 < t2h1u1 && t2h1d9 < t2h1d1 && t2h1d9 < t2w1rwt1 && t2h1d9 < t2w1lwt1 && t2h1d9 < t2h1uwt1 && t2h1d9 < t2h1dwt1
  && t2h1d9 < t2w1r2 && t2h1d9 < t2w1l2 && t2h1d9 < t2h1u2 && t2h1d9 < t2h1d2 && t2h1d9 < t2w1rwt2 && t2h1d9 < t2w1lwt2 && t2h1d9 < t2h1uwt2 && t2h1d9 < t2h1dwt2
  && t2h1d9 < t2w1r3 && t2h1d9 < t2w1l3 && t2h1d9 < t2h1u3 && t2h1d9 < t2h1d3 && t2h1d9 < t2w1rwt3 && t2h1d9 < t2w1lwt3 && t2h1d9 < t2h1uwt3 && t2h1d9 < t2h1dwt3
  && t2h1d9 < t2w1r4 && t2h1d9 < t2w1l4 && t2h1d9 < t2h1u4 && t2h1d9 < t2h1d4 && t2h1d9 < t2w1rwt4 && t2h1d9 < t2w1lwt4 && t2h1d9 < t2h1uwt4 && t2h1d9 < t2h1dwt4
  && t2h1d9 < t2w1r5 && t2h1d9 < t2w1l5 && t2h1d9 < t2h1u5 && t2h1d9 < t2h1d5 && t2h1d9 < t2w1rwt5 && t2h1d9 < t2w1lwt5 && t2h1d9 < t2h1uwt5 && t2h1d9 < t2h1dwt5
  && t2h1d9 < t2w1r6 && t2h1d9 < t2w1l6 && t2h1d9 < t2h1u6 && t2h1d9 < t2h1d6 && t2h1d9 < t2w1rwt6 && t2h1d9 < t2w1lwt6 && t2h1d9 < t2h1uwt6 && t2h1d9 < t2h1dwt6
  && t2h1d9 < t2w1r7 && t2h1d9 < t2w1l7 && t2h1d9 < t2h1u7 && t2h1d9 < t2h1d7 && t2h1d9 < t2w1rwt7 && t2h1d9 < t2w1lwt7 && t2h1d9 < t2h1uwt7 && t2h1d9 < t2h1dwt7
  && t2h1d9 < t2w1r8 && t2h1d9 < t2w1l8 && t2h1d9 < t2h1u8 && t2h1d9 < t2h1d8 && t2h1d9 < t2w1rwt8 && t2h1d9 < t2w1lwt8 && t2h1d9 < t2h1uwt8 && t2h1d9 < t2h1dwt8
  && t2h1d9 < t2w1r9 && t2h1d9 < t2w1l9 && t2h1d9 < t2h1u9 && t2h1d9 < t2w1rwt9 && t2h1d9 < t2w1lwt9 && t2h1d9 < t2h1uwt9 && t2h1d9 < t2h1dwt9
  && t2h1d9 < t2w1r10 && t2h1d9 < t2w1l10 && t2h1d9 < t2h1u10 && t2h1d9 < t2h1d10 && t2h1d9 < t2w1rwt10 && t2h1d9 < t2w1lwt10 && t2h1d9 < t2h1uwt10 && t2h1d9 < t2h1dwt10
  && (louthd9 == 0 && linhd9 == 0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1d9+z)-w1r9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwr9*sqrt(1-((z0wr9+(vz*t2h1d9+z))*(z0wr9+(vz*t2h1d9+z)))/a2wr9);
    }else{
    xlimitr=-sqrt(((vz*t2h1d9+z)-pbwr9)/-pawr9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1d9+z)+w1l9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwl9*sqrt(1-((z0wl9+(vz*t2h1d9+z))*(z0wl9+(vz*t2h1d9+z)))/a2wl9);
      }else{
      xlimitl=sqrt(((vz*t2h1d9+z)-pbwl9)/-pawl9);
      }
   }
  xtest=vx*t2h1d9+x;
  ylimitd=(-h2d9+h1d9)*(vz*t2h1d9+z)/l-h1d9;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd9>0 ){
  i=373;
  }else{
  i=381;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr9==-1 && t2w1r9 > 0 && t2w1r9 < t1 
     && t2w1r9 < t2w1r && t2w1r9 < t2w1l && t2w1r9 < t2h1u && t2w1r9 < t2h1d && t2w1r9 < t2w1rwt && t2w1r9 < t2w1lwt && t2w1r9 < t2h1uwt && t2w1r9 < t2h1dwt
     && t2w1r9 < t2w1r1 && t2w1r9 < t2w1l1 && t2w1r9 < t2h1u1 && t2w1r9 < t2h1d1 && t2w1r9 < t2w1rwt1 && t2w1r9 < t2w1lwt1 && t2w1r9 < t2h1uwt1 && t2w1r9 < t2h1dwt1
     && t2w1r9 < t2w1r2 && t2w1r9 < t2w1l2 && t2w1r9 < t2h1u2 && t2w1r9 < t2h1d2 && t2w1r9 < t2w1rwt2 && t2w1r9 < t2w1lwt2 && t2w1r9 < t2h1uwt2 && t2w1r9 < t2h1dwt2 
     && t2w1r9 < t2w1r3 && t2w1r9 < t2w1l3 && t2w1r9 < t2h1u3 && t2w1r9 < t2h1d3 && t2w1r9 < t2w1rwt3 && t2w1r9 < t2w1lwt3 && t2w1r9 < t2h1uwt3 && t2w1r9 < t2h1dwt3
     && t2w1r9 < t2w1r4 && t2w1r9 < t2w1l4 && t2w1r9 < t2h1u4 && t2w1r9 < t2h1d4 && t2w1r9 < t2w1rwt4 && t2w1r9 < t2w1lwt4 && t2w1r9 < t2h1uwt4 && t2w1r9 < t2h1dwt4
     && t2w1r9 < t2w1r5 && t2w1r9 < t2w1l5 && t2w1r9 < t2h1u5 && t2w1r9 < t2h1d5 && t2w1r9 < t2w1rwt5 && t2w1r9 < t2w1lwt5 && t2w1r9 < t2h1uwt5 && t2w1r9 < t2h1dwt5
     && t2w1r9 < t2w1r6 && t2w1r9 < t2w1l6 && t2w1r9 < t2h1u6 && t2w1r9 < t2h1d6 && t2w1r9 < t2w1rwt6 && t2w1r9 < t2w1lwt6 && t2w1r9 < t2h1uwt6 && t2w1r9 < t2h1dwt6
     && t2w1r9 < t2w1r7 && t2w1r9 < t2w1l7 && t2w1r9 < t2h1u7 && t2w1r9 < t2h1d7 && t2w1r9 < t2w1rwt7 && t2w1r9 < t2w1lwt7 && t2w1r9 < t2h1uwt7 && t2w1r9 < t2h1dwt7
     && t2w1r9 < t2w1r8 && t2w1r9 < t2w1l8 && t2w1r9 < t2h1u8 && t2w1r9 < t2h1d8 && t2w1r9 < t2w1rwt8 && t2w1r9 < t2w1lwt8 && t2w1r9 < t2h1uwt8 && t2w1r9 < t2h1dwt8
     && t2w1r9 < t2w1l9 && t2w1r9 < t2h1u9 && t2w1r9 < t2h1d9 && t2w1r9 < t2w1rwt9 && t2w1r9 < t2w1lwt9 && t2w1r9 < t2h1uwt9 && t2w1r9 < t2h1dwt9
     && t2w1r9 < t2w1r10 && t2w1r9 < t2w1l10 && t2w1r9 < t2h1u10 && t2w1r9 < t2h1d10 && t2w1r9 < t2w1rwt10 && t2w1r9 < t2w1lwt10 && t2w1r9 < t2h1uwt10 && t2w1r9 < t2h1dwt10
     && ((linwr9!=0) && (loutwr9!=0) )) {
  i=374;
  }

  if (mxr9==-1 && t2w1r9 > 0 && t2w1r9 < t1 
     && t2w1r9 < t2w1r && t2w1r9 < t2w1l && t2w1r9 < t2h1u && t2w1r9 < t2h1d && t2w1r9 < t2w1rwt && t2w1r9 < t2w1lwt && t2w1r9 < t2h1uwt && t2w1r9 < t2h1dwt
     && t2w1r9 < t2w1r1 && t2w1r9 < t2w1l1 && t2w1r9 < t2h1u1 && t2w1r9 < t2h1d1 && t2w1r9 < t2w1rwt1 && t2w1r9 < t2w1lwt1 && t2w1r9 < t2h1uwt1 && t2w1r9 < t2h1dwt1
     && t2w1r9 < t2w1r2 && t2w1r9 < t2w1l2 && t2w1r9 < t2h1u2 && t2w1r9 < t2h1d2 && t2w1r9 < t2w1rwt2 && t2w1r9 < t2w1lwt2 && t2w1r9 < t2h1uwt2 && t2w1r9 < t2h1dwt2 
     && t2w1r9 < t2w1r3 && t2w1r9 < t2w1l3 && t2w1r9 < t2h1u3 && t2w1r9 < t2h1d3 && t2w1r9 < t2w1rwt3 && t2w1r9 < t2w1lwt3 && t2w1r9 < t2h1uwt3 && t2w1r9 < t2h1dwt3
     && t2w1r9 < t2w1r4 && t2w1r9 < t2w1l4 && t2w1r9 < t2h1u4 && t2w1r9 < t2h1d4 && t2w1r9 < t2w1rwt4 && t2w1r9 < t2w1lwt4 && t2w1r9 < t2h1uwt4 && t2w1r9 < t2h1dwt4
     && t2w1r9 < t2w1r5 && t2w1r9 < t2w1l5 && t2w1r9 < t2h1u5 && t2w1r9 < t2h1d5 && t2w1r9 < t2w1rwt5 && t2w1r9 < t2w1lwt5 && t2w1r9 < t2h1uwt5 && t2w1r9 < t2h1dwt5
     && t2w1r9 < t2w1r6 && t2w1r9 < t2w1l6 && t2w1r9 < t2h1u6 && t2w1r9 < t2h1d6 && t2w1r9 < t2w1rwt6 && t2w1r9 < t2w1lwt6 && t2w1r9 < t2h1uwt6 && t2w1r9 < t2h1dwt6
     && t2w1r9 < t2w1r7 && t2w1r9 < t2w1l7 && t2w1r9 < t2h1u7 && t2w1r9 < t2h1d7 && t2w1r9 < t2w1rwt7 && t2w1r9 < t2w1lwt7 && t2w1r9 < t2h1uwt7 && t2w1r9 < t2h1dwt7
     && t2w1r9 < t2w1r8 && t2w1r9 < t2w1l8 && t2w1r9 < t2h1u8 && t2w1r9 < t2h1d8 && t2w1r9 < t2w1rwt8 && t2w1r9 < t2w1lwt8 && t2w1r9 < t2h1uwt8 && t2w1r9 < t2h1dwt8
     && t2w1r9 < t2w1l9 && t2w1r9 < t2h1u9 && t2w1r9 < t2h1d9 && t2w1r9 < t2w1rwt9 && t2w1r9 < t2w1lwt9 && t2w1r9 < t2h1uwt9 && t2w1r9 < t2h1dwt9
     && t2w1r9 < t2w1r10 && t2w1r9 < t2w1l10 && t2w1r9 < t2h1u10 && t2w1r9 < t2h1d10 && t2w1r9 < t2w1rwt10 && t2w1r9 < t2w1lwt10 && t2w1r9 < t2h1uwt10 && t2w1r9 < t2h1dwt10
     && ((loutwr9!=0 && linwr9==0) || (loutwr9==0 && linwr9!=0))){
  i=374;
  }

  if (mxr9==-1 && t2w1r9 > 0 && t2w1r9 < t1 
     && t2w1r9 < t2w1r && t2w1r9 < t2w1l && t2w1r9 < t2h1u && t2w1r9 < t2h1d && t2w1r9 < t2w1rwt && t2w1r9 < t2w1lwt && t2w1r9 < t2h1uwt && t2w1r9 < t2h1dwt
     && t2w1r9 < t2w1r1 && t2w1r9 < t2w1l1 && t2w1r9 < t2h1u1 && t2w1r9 < t2h1d1 && t2w1r9 < t2w1rwt1 && t2w1r9 < t2w1lwt1 && t2w1r9 < t2h1uwt1 && t2w1r9 < t2h1dwt1
     && t2w1r9 < t2w1r2 && t2w1r9 < t2w1l2 && t2w1r9 < t2h1u2 && t2w1r9 < t2h1d2 && t2w1r9 < t2w1rwt2 && t2w1r9 < t2w1lwt2 && t2w1r9 < t2h1uwt2 && t2w1r9 < t2h1dwt2 
     && t2w1r9 < t2w1r3 && t2w1r9 < t2w1l3 && t2w1r9 < t2h1u3 && t2w1r9 < t2h1d3 && t2w1r9 < t2w1rwt3 && t2w1r9 < t2w1lwt3 && t2w1r9 < t2h1uwt3 && t2w1r9 < t2h1dwt3
     && t2w1r9 < t2w1r4 && t2w1r9 < t2w1l4 && t2w1r9 < t2h1u4 && t2w1r9 < t2h1d4 && t2w1r9 < t2w1rwt4 && t2w1r9 < t2w1lwt4 && t2w1r9 < t2h1uwt4 && t2w1r9 < t2h1dwt4
     && t2w1r9 < t2w1r5 && t2w1r9 < t2w1l5 && t2w1r9 < t2h1u5 && t2w1r9 < t2h1d5 && t2w1r9 < t2w1rwt5 && t2w1r9 < t2w1lwt5 && t2w1r9 < t2h1uwt5 && t2w1r9 < t2h1dwt5
     && t2w1r9 < t2w1r6 && t2w1r9 < t2w1l6 && t2w1r9 < t2h1u6 && t2w1r9 < t2h1d6 && t2w1r9 < t2w1rwt6 && t2w1r9 < t2w1lwt6 && t2w1r9 < t2h1uwt6 && t2w1r9 < t2h1dwt6
     && t2w1r9 < t2w1r7 && t2w1r9 < t2w1l7 && t2w1r9 < t2h1u7 && t2w1r9 < t2h1d7 && t2w1r9 < t2w1rwt7 && t2w1r9 < t2w1lwt7 && t2w1r9 < t2h1uwt7 && t2w1r9 < t2h1dwt7
     && t2w1r9 < t2w1r8 && t2w1r9 < t2w1l8 && t2w1r9 < t2h1u8 && t2w1r9 < t2h1d8 && t2w1r9 < t2w1rwt8 && t2w1r9 < t2w1lwt8 && t2w1r9 < t2h1uwt8 && t2w1r9 < t2h1dwt8
     && t2w1r9 < t2w1l9 && t2w1r9 < t2h1u9 && t2w1r9 < t2h1d9 && t2w1r9 < t2w1rwt9 && t2w1r9 < t2w1lwt9 && t2w1r9 < t2h1uwt9 && t2w1r9 < t2h1dwt9
     && t2w1r9 < t2w1r10 && t2w1r9 < t2w1l10 && t2w1r9 < t2h1u10 && t2w1r9 < t2h1d10 && t2w1r9 < t2w1rwt10 && t2w1r9 < t2w1lwt10 && t2w1r9 < t2h1uwt10 && t2w1r9 < t2h1dwt10
     && (loutwr9==0 && linwr9==0)){
  i=374;
  }

  if (mxl9==-1 && t2w1l9 > 0 && t2w1l9 < t1 
      && t2w1l9 < t2w1r && t2w1l9 < t2w1l && t2w1l9 < t2h1u && t2w1l9 < t2h1d && t2w1l9 < t2w1rwt && t2w1l9 < t2w1lwt && t2w1l9 < t2h1uwt && t2w1l9 < t2h1dwt
      && t2w1l9 < t2w1r1 && t2w1l9 < t2w1l1 && t2w1l9 < t2h1u1 && t2w1l9 < t2h1d1 && t2w1l9 < t2w1rwt1 && t2w1l9 < t2w1lwt1 && t2w1l9 < t2h1uwt1 && t2w1l9 < t2h1dwt1
      && t2w1l9 < t2w1r2 && t2w1l9 < t2w1l2 && t2w1l9 < t2h1u2 && t2w1l9 < t2h1d2 && t2w1l9 < t2w1rwt2 && t2w1l9 < t2w1lwt2 && t2w1l9 < t2h1uwt2 && t2w1l9 < t2h1dwt2
      && t2w1l9 < t2w1r3 && t2w1l9 < t2w1l3 && t2w1l9 < t2h1u3 && t2w1l9 < t2h1d3 && t2w1l9 < t2w1rwt3 && t2w1l9 < t2w1lwt3 && t2w1l9 < t2h1uwt3 && t2w1l9 < t2h1dwt3
      && t2w1l9 < t2w1r4 && t2w1l9 < t2w1l4 && t2w1l9 < t2h1u4 && t2w1l9 < t2h1d4 && t2w1l9 < t2w1rwt4 && t2w1l9 < t2w1lwt4 && t2w1l9 < t2h1uwt4 && t2w1l9 < t2h1dwt4
      && t2w1l9 < t2w1r5 && t2w1l9 < t2w1l5 && t2w1l9 < t2h1u5 && t2w1l9 < t2h1d5 && t2w1l9 < t2w1rwt5 && t2w1l9 < t2w1lwt5 && t2w1l9 < t2h1uwt5 && t2w1l9 < t2h1dwt5
      && t2w1l9 < t2w1r6 && t2w1l9 < t2w1l6 && t2w1l9 < t2h1u6 && t2w1l9 < t2h1d6 && t2w1l9 < t2w1rwt6 && t2w1l9 < t2w1lwt6 && t2w1l9 < t2h1uwt6 && t2w1l9 < t2h1dwt6
      && t2w1l9 < t2w1r7 && t2w1l9 < t2w1l7 && t2w1l9 < t2h1u7 && t2w1l9 < t2h1d7 && t2w1l9 < t2w1rwt7 && t2w1l9 < t2w1lwt7 && t2w1l9 < t2h1uwt7 && t2w1l9 < t2h1dwt7
      && t2w1l9 < t2w1r8 && t2w1l9 < t2w1l8 && t2w1l9 < t2h1u8 && t2w1l9 < t2h1d8 && t2w1l9 < t2w1rwt8 && t2w1l9 < t2w1lwt8 && t2w1l9 < t2h1uwt8 && t2w1l9 < t2h1dwt8
      && t2w1l9 < t2w1r9 && t2w1l9 < t2h1u9 && t2w1l9 < t2h1d9 && t2w1l9 < t2w1rwt9 && t2w1l9 < t2w1lwt9 && t2w1l9 < t2h1uwt9 && t2w1l9 < t2h1dwt9
      && t2w1l9 < t2w1r10 && t2w1l9 < t2w1l10 && t2w1l9 < t2h1u10 && t2w1l9 < t2h1d10 && t2w1l9 < t2w1rwt10 && t2w1l9 < t2w1lwt10 && t2w1l9 < t2h1uwt10 && t2w1l9 < t2h1dwt10
      && ((linwl9!=0) && (loutwl9!=0) )){
  i=375;
  }

  if (mxl9==-1 && t2w1l9 > 0 && t2w1l9 < t1 
      && t2w1l9 < t2w1r && t2w1l9 < t2w1l && t2w1l9 < t2h1u && t2w1l9 < t2h1d && t2w1l9 < t2w1rwt && t2w1l9 < t2w1lwt && t2w1l9 < t2h1uwt && t2w1l9 < t2h1dwt
      && t2w1l9 < t2w1r1 && t2w1l9 < t2w1l1 && t2w1l9 < t2h1u1 && t2w1l9 < t2h1d1 && t2w1l9 < t2w1rwt1 && t2w1l9 < t2w1lwt1 && t2w1l9 < t2h1uwt1 && t2w1l9 < t2h1dwt1
      && t2w1l9 < t2w1r2 && t2w1l9 < t2w1l2 && t2w1l9 < t2h1u2 && t2w1l9 < t2h1d2 && t2w1l9 < t2w1rwt2 && t2w1l9 < t2w1lwt2 && t2w1l9 < t2h1uwt2 && t2w1l9 < t2h1dwt2
      && t2w1l9 < t2w1r3 && t2w1l9 < t2w1l3 && t2w1l9 < t2h1u3 && t2w1l9 < t2h1d3 && t2w1l9 < t2w1rwt3 && t2w1l9 < t2w1lwt3 && t2w1l9 < t2h1uwt3 && t2w1l9 < t2h1dwt3
      && t2w1l9 < t2w1r4 && t2w1l9 < t2w1l4 && t2w1l9 < t2h1u4 && t2w1l9 < t2h1d4 && t2w1l9 < t2w1rwt4 && t2w1l9 < t2w1lwt4 && t2w1l9 < t2h1uwt4 && t2w1l9 < t2h1dwt4
      && t2w1l9 < t2w1r5 && t2w1l9 < t2w1l5 && t2w1l9 < t2h1u5 && t2w1l9 < t2h1d5 && t2w1l9 < t2w1rwt5 && t2w1l9 < t2w1lwt5 && t2w1l9 < t2h1uwt5 && t2w1l9 < t2h1dwt5
      && t2w1l9 < t2w1r6 && t2w1l9 < t2w1l6 && t2w1l9 < t2h1u6 && t2w1l9 < t2h1d6 && t2w1l9 < t2w1rwt6 && t2w1l9 < t2w1lwt6 && t2w1l9 < t2h1uwt6 && t2w1l9 < t2h1dwt6
      && t2w1l9 < t2w1r7 && t2w1l9 < t2w1l7 && t2w1l9 < t2h1u7 && t2w1l9 < t2h1d7 && t2w1l9 < t2w1rwt7 && t2w1l9 < t2w1lwt7 && t2w1l9 < t2h1uwt7 && t2w1l9 < t2h1dwt7
      && t2w1l9 < t2w1r8 && t2w1l9 < t2w1l8 && t2w1l9 < t2h1u8 && t2w1l9 < t2h1d8 && t2w1l9 < t2w1rwt8 && t2w1l9 < t2w1lwt8 && t2w1l9 < t2h1uwt8 && t2w1l9 < t2h1dwt8
      && t2w1l9 < t2w1r9 && t2w1l9 < t2h1u9 && t2w1l9 < t2h1d9 && t2w1l9 < t2w1rwt9 && t2w1l9 < t2w1lwt9 && t2w1l9 < t2h1uwt9 && t2w1l9 < t2h1dwt9
      && t2w1l9 < t2w1r10 && t2w1l9 < t2w1l10 && t2w1l9 < t2h1u10 && t2w1l9 < t2h1d10 && t2w1l9 < t2w1rwt10 && t2w1l9 < t2w1lwt10 && t2w1l9 < t2h1uwt10 && t2w1l9 < t2h1dwt10
      &&  ((loutwl9!=0 && linwl9==0) || (loutwl9==0 && linwl9!=0))){
  i=375;
  }

  if (mxl9==-1 && t2w1l9 > 0 && t2w1l9 < t1 
      && t2w1l9 < t2w1r && t2w1l9 < t2w1l && t2w1l9 < t2h1u && t2w1l9 < t2h1d && t2w1l9 < t2w1rwt && t2w1l9 < t2w1lwt && t2w1l9 < t2h1uwt && t2w1l9 < t2h1dwt
      && t2w1l9 < t2w1r1 && t2w1l9 < t2w1l1 && t2w1l9 < t2h1u1 && t2w1l9 < t2h1d1 && t2w1l9 < t2w1rwt1 && t2w1l9 < t2w1lwt1 && t2w1l9 < t2h1uwt1 && t2w1l9 < t2h1dwt1
      && t2w1l9 < t2w1r2 && t2w1l9 < t2w1l2 && t2w1l9 < t2h1u2 && t2w1l9 < t2h1d2 && t2w1l9 < t2w1rwt2 && t2w1l9 < t2w1lwt2 && t2w1l9 < t2h1uwt2 && t2w1l9 < t2h1dwt2
      && t2w1l9 < t2w1r3 && t2w1l9 < t2w1l3 && t2w1l9 < t2h1u3 && t2w1l9 < t2h1d3 && t2w1l9 < t2w1rwt3 && t2w1l9 < t2w1lwt3 && t2w1l9 < t2h1uwt3 && t2w1l9 < t2h1dwt3
      && t2w1l9 < t2w1r4 && t2w1l9 < t2w1l4 && t2w1l9 < t2h1u4 && t2w1l9 < t2h1d4 && t2w1l9 < t2w1rwt4 && t2w1l9 < t2w1lwt4 && t2w1l9 < t2h1uwt4 && t2w1l9 < t2h1dwt4
      && t2w1l9 < t2w1r5 && t2w1l9 < t2w1l5 && t2w1l9 < t2h1u5 && t2w1l9 < t2h1d5 && t2w1l9 < t2w1rwt5 && t2w1l9 < t2w1lwt5 && t2w1l9 < t2h1uwt5 && t2w1l9 < t2h1dwt5
      && t2w1l9 < t2w1r6 && t2w1l9 < t2w1l6 && t2w1l9 < t2h1u6 && t2w1l9 < t2h1d6 && t2w1l9 < t2w1rwt6 && t2w1l9 < t2w1lwt6 && t2w1l9 < t2h1uwt6 && t2w1l9 < t2h1dwt6
      && t2w1l9 < t2w1r7 && t2w1l9 < t2w1l7 && t2w1l9 < t2h1u7 && t2w1l9 < t2h1d7 && t2w1l9 < t2w1rwt7 && t2w1l9 < t2w1lwt7 && t2w1l9 < t2h1uwt7 && t2w1l9 < t2h1dwt7
      && t2w1l9 < t2w1r8 && t2w1l9 < t2w1l8 && t2w1l9 < t2h1u8 && t2w1l9 < t2h1d8 && t2w1l9 < t2w1rwt8 && t2w1l9 < t2w1lwt8 && t2w1l9 < t2h1uwt8 && t2w1l9 < t2h1dwt8
      && t2w1l9 < t2w1r9 && t2w1l9 < t2h1u9 && t2w1l9 < t2h1d9 && t2w1l9 < t2w1rwt9 && t2w1l9 < t2w1lwt9 && t2w1l9 < t2h1uwt9 && t2w1l9 < t2h1dwt9
      && t2w1l9 < t2w1r10 && t2w1l9 < t2w1l10 && t2w1l9 < t2h1u10 && t2w1l9 < t2h1d10 && t2w1l9 < t2w1rwt10 && t2w1l9 < t2w1lwt10 && t2w1l9 < t2h1uwt10 && t2w1l9 < t2h1dwt10
      && (loutwl9==0 && linwl9==0)){
  i=375;
  }

  if (myu9==-1 && t2h1u9 > 0 && t2h1u9 < t1 
  && t2h1u9 < t2w1r && t2h1u9 < t2w1l && t2h1u9 < t2h1u && t2h1u9 < t2h1d && t2h1u9 < t2w1rwt && t2h1u9 < t2w1lwt && t2h1u9 < t2h1uwt && t2h1u9 < t2h1dwt
  && t2h1u9 < t2w1r1 && t2h1u9 < t2w1l1 && t2h1u9 < t2h1u1 && t2h1u9 < t2h1d1 && t2h1u9 < t2w1rwt1 && t2h1u9 < t2w1lwt1 && t2h1u9 < t2h1uwt1 && t2h1u9 < t2h1dwt1
  && t2h1u9 < t2w1r2 && t2h1u9 < t2w1l2 && t2h1u9 < t2h1u2 && t2h1u9 < t2h1d2 && t2h1u9 < t2w1rwt2 && t2h1u9 < t2w1lwt2 && t2h1u9 < t2h1uwt2 && t2h1u9 < t2h1dwt2
  && t2h1u9 < t2w1r3 && t2h1u9 < t2w1l3 && t2h1u9 < t2h1u3 && t2h1u9 < t2h1d3 && t2h1u9 < t2w1rwt3 && t2h1u9 < t2w1lwt3 && t2h1u9 < t2h1uwt3 && t2h1u9 < t2h1dwt3
  && t2h1u9 < t2w1r4 && t2h1u9 < t2w1l4 && t2h1u9 < t2h1u4 && t2h1u9 < t2h1d4 && t2h1u9 < t2w1rwt4 && t2h1u9 < t2w1lwt4 && t2h1u9 < t2h1uwt4 && t2h1u9 < t2h1dwt4
  && t2h1u9 < t2w1r5 && t2h1u9 < t2w1l5 && t2h1u9 < t2h1u5 && t2h1u9 < t2h1d5 && t2h1u9 < t2w1rwt5 && t2h1u9 < t2w1lwt5 && t2h1u9 < t2h1uwt5 && t2h1u9 < t2h1dwt5
  && t2h1u9 < t2w1r6 && t2h1u9 < t2w1l6 && t2h1u9 < t2h1u6 && t2h1u9 < t2h1d6 && t2h1u9 < t2w1rwt6 && t2h1u9 < t2w1lwt6 && t2h1u9 < t2h1uwt6 && t2h1u9 < t2h1dwt6
  && t2h1u9 < t2w1r7 && t2h1u9 < t2w1l7 && t2h1u9 < t2h1u7 && t2h1u9 < t2h1d7 && t2h1u9 < t2w1rwt7 && t2h1u9 < t2w1lwt7 && t2h1u9 < t2h1uwt7 && t2h1u9 < t2h1dwt7
  && t2h1u9 < t2w1r8 && t2h1u9 < t2w1l8 && t2h1u9 < t2h1u8 && t2h1u9 < t2h1d8 && t2h1u9 < t2w1rwt8 && t2h1u9 < t2w1lwt8 && t2h1u9 < t2h1uwt8 && t2h1u9 < t2h1dwt8
  && t2h1u9 < t2w1r9 && t2h1u9 < t2w1l9 && t2h1u9 < t2h1d9 && t2h1u9 < t2w1rwt9 && t2h1u9 < t2w1lwt9 && t2h1u9 < t2h1uwt9 && t2h1u9 < t2h1dwt9
  && t2h1u9 < t2w1r10 && t2h1u9 < t2w1l10 && t2h1u9 < t2h1u10 && t2h1u9 < t2h1d10 && t2h1u9 < t2w1rwt10 && t2h1u9 < t2w1lwt10 && t2h1u9 < t2h1uwt10 && t2h1u9 < t2h1dwt10
  && (louthu9 !=0 && linhu9!=0)){
  i=376;
  }

  if (myu9==-1 && t2h1u9 > 0 && t2h1u9 < t1 
  && t2h1u9 < t2w1r && t2h1u9 < t2w1l && t2h1u9 < t2h1u && t2h1u9 < t2h1d && t2h1u9 < t2w1rwt && t2h1u9 < t2w1lwt && t2h1u9 < t2h1uwt && t2h1u9 < t2h1dwt
  && t2h1u9 < t2w1r1 && t2h1u9 < t2w1l1 && t2h1u9 < t2h1u1 && t2h1u9 < t2h1d1 && t2h1u9 < t2w1rwt1 && t2h1u9 < t2w1lwt1 && t2h1u9 < t2h1uwt1 && t2h1u9 < t2h1dwt1
  && t2h1u9 < t2w1r2 && t2h1u9 < t2w1l2 && t2h1u9 < t2h1u2 && t2h1u9 < t2h1d2 && t2h1u9 < t2w1rwt2 && t2h1u9 < t2w1lwt2 && t2h1u9 < t2h1uwt2 && t2h1u9 < t2h1dwt2
  && t2h1u9 < t2w1r3 && t2h1u9 < t2w1l3 && t2h1u9 < t2h1u3 && t2h1u9 < t2h1d3 && t2h1u9 < t2w1rwt3 && t2h1u9 < t2w1lwt3 && t2h1u9 < t2h1uwt3 && t2h1u9 < t2h1dwt3
  && t2h1u9 < t2w1r4 && t2h1u9 < t2w1l4 && t2h1u9 < t2h1u4 && t2h1u9 < t2h1d4 && t2h1u9 < t2w1rwt4 && t2h1u9 < t2w1lwt4 && t2h1u9 < t2h1uwt4 && t2h1u9 < t2h1dwt4
  && t2h1u9 < t2w1r5 && t2h1u9 < t2w1l5 && t2h1u9 < t2h1u5 && t2h1u9 < t2h1d5 && t2h1u9 < t2w1rwt5 && t2h1u9 < t2w1lwt5 && t2h1u9 < t2h1uwt5 && t2h1u9 < t2h1dwt5
  && t2h1u9 < t2w1r6 && t2h1u9 < t2w1l6 && t2h1u9 < t2h1u6 && t2h1u9 < t2h1d6 && t2h1u9 < t2w1rwt6 && t2h1u9 < t2w1lwt6 && t2h1u9 < t2h1uwt6 && t2h1u9 < t2h1dwt6
  && t2h1u9 < t2w1r7 && t2h1u9 < t2w1l7 && t2h1u9 < t2h1u7 && t2h1u9 < t2h1d7 && t2h1u9 < t2w1rwt7 && t2h1u9 < t2w1lwt7 && t2h1u9 < t2h1uwt7 && t2h1u9 < t2h1dwt7
  && t2h1u9 < t2w1r8 && t2h1u9 < t2w1l8 && t2h1u9 < t2h1u8 && t2h1u9 < t2h1d8 && t2h1u9 < t2w1rwt8 && t2h1u9 < t2w1lwt8 && t2h1u9 < t2h1uwt8 && t2h1u9 < t2h1dwt8
  && t2h1u9 < t2w1r9 && t2h1u9 < t2w1l9 && t2h1u9 < t2h1d9 && t2h1u9 < t2w1rwt9 && t2h1u9 < t2w1lwt9 && t2h1u9 < t2h1uwt9 && t2h1u9 < t2h1dwt9
  && t2h1u9 < t2w1r10 && t2h1u9 < t2w1l10 && t2h1u9 < t2h1u10 && t2h1u9 < t2h1d10 && t2h1u9 < t2w1rwt10 && t2h1u9 < t2w1lwt10 && t2h1u9 < t2h1uwt10 && t2h1u9 < t2h1dwt10
  && ((louthu9!=0 && linhu9==0) || (louthu9==0 && linhu9!=0))){
  i=376;
  }

  if (myu9==-1 && t2h1u9 > 0 && t2h1u9 < t1 
  && t2h1u9 < t2w1r && t2h1u9 < t2w1l && t2h1u9 < t2h1u && t2h1u9 < t2h1d && t2h1u9 < t2w1rwt && t2h1u9 < t2w1lwt && t2h1u9 < t2h1uwt && t2h1u9 < t2h1dwt
  && t2h1u9 < t2w1r1 && t2h1u9 < t2w1l1 && t2h1u9 < t2h1u1 && t2h1u9 < t2h1d1 && t2h1u9 < t2w1rwt1 && t2h1u9 < t2w1lwt1 && t2h1u9 < t2h1uwt1 && t2h1u9 < t2h1dwt1
  && t2h1u9 < t2w1r2 && t2h1u9 < t2w1l2 && t2h1u9 < t2h1u2 && t2h1u9 < t2h1d2 && t2h1u9 < t2w1rwt2 && t2h1u9 < t2w1lwt2 && t2h1u9 < t2h1uwt2 && t2h1u9 < t2h1dwt2
  && t2h1u9 < t2w1r3 && t2h1u9 < t2w1l3 && t2h1u9 < t2h1u3 && t2h1u9 < t2h1d3 && t2h1u9 < t2w1rwt3 && t2h1u9 < t2w1lwt3 && t2h1u9 < t2h1uwt3 && t2h1u9 < t2h1dwt3
  && t2h1u9 < t2w1r4 && t2h1u9 < t2w1l4 && t2h1u9 < t2h1u4 && t2h1u9 < t2h1d4 && t2h1u9 < t2w1rwt4 && t2h1u9 < t2w1lwt4 && t2h1u9 < t2h1uwt4 && t2h1u9 < t2h1dwt4
  && t2h1u9 < t2w1r5 && t2h1u9 < t2w1l5 && t2h1u9 < t2h1u5 && t2h1u9 < t2h1d5 && t2h1u9 < t2w1rwt5 && t2h1u9 < t2w1lwt5 && t2h1u9 < t2h1uwt5 && t2h1u9 < t2h1dwt5
  && t2h1u9 < t2w1r6 && t2h1u9 < t2w1l6 && t2h1u9 < t2h1u6 && t2h1u9 < t2h1d6 && t2h1u9 < t2w1rwt6 && t2h1u9 < t2w1lwt6 && t2h1u9 < t2h1uwt6 && t2h1u9 < t2h1dwt6
  && t2h1u9 < t2w1r7 && t2h1u9 < t2w1l7 && t2h1u9 < t2h1u7 && t2h1u9 < t2h1d7 && t2h1u9 < t2w1rwt7 && t2h1u9 < t2w1lwt7 && t2h1u9 < t2h1uwt7 && t2h1u9 < t2h1dwt7
  && t2h1u9 < t2w1r8 && t2h1u9 < t2w1l8 && t2h1u9 < t2h1u8 && t2h1u9 < t2h1d8 && t2h1u9 < t2w1rwt8 && t2h1u9 < t2w1lwt8 && t2h1u9 < t2h1uwt8 && t2h1u9 < t2h1dwt8
  && t2h1u9 < t2w1r9 && t2h1u9 < t2w1l9 && t2h1u9 < t2h1d9 && t2h1u9 < t2w1rwt9 && t2h1u9 < t2w1lwt9 && t2h1u9 < t2h1uwt9 && t2h1u9 < t2h1dwt9
  && t2h1u9 < t2w1r10 && t2h1u9 < t2w1l10 && t2h1u9 < t2h1u10 && t2h1u9 < t2h1d10 && t2h1u9 < t2w1rwt10 && t2h1u9 < t2w1lwt10 && t2h1u9 < t2h1uwt10 && t2h1u9 < t2h1dwt10
  && (louthu9 == 0 && linhu9 == 0)){
  i=376;
  }

  if (myd9==-1 && t2h1d9 > 0 && t2h1d9 < t1 
  && t2h1d9 < t2w1r && t2h1d9 < t2w1l && t2h1d9 < t2h1u && t2h1d9 < t2h1d && t2h1d9 < t2w1rwt && t2h1d9 < t2w1lwt && t2h1d9 < t2h1uwt && t2h1d9 < t2h1dwt
  && t2h1d9 < t2w1r1 && t2h1d9 < t2w1l1 && t2h1d9 < t2h1u1 && t2h1d9 < t2h1d1 && t2h1d9 < t2w1rwt1 && t2h1d9 < t2w1lwt1 && t2h1d9 < t2h1uwt1 && t2h1d9 < t2h1dwt1
  && t2h1d9 < t2w1r2 && t2h1d9 < t2w1l2 && t2h1d9 < t2h1u2 && t2h1d9 < t2h1d2 && t2h1d9 < t2w1rwt2 && t2h1d9 < t2w1lwt2 && t2h1d9 < t2h1uwt2 && t2h1d9 < t2h1dwt2
  && t2h1d9 < t2w1r3 && t2h1d9 < t2w1l3 && t2h1d9 < t2h1u3 && t2h1d9 < t2h1d3 && t2h1d9 < t2w1rwt3 && t2h1d9 < t2w1lwt3 && t2h1d9 < t2h1uwt3 && t2h1d9 < t2h1dwt3
  && t2h1d9 < t2w1r4 && t2h1d9 < t2w1l4 && t2h1d9 < t2h1u4 && t2h1d9 < t2h1d4 && t2h1d9 < t2w1rwt4 && t2h1d9 < t2w1lwt4 && t2h1d9 < t2h1uwt4 && t2h1d9 < t2h1dwt4
  && t2h1d9 < t2w1r5 && t2h1d9 < t2w1l5 && t2h1d9 < t2h1u5 && t2h1d9 < t2h1d5 && t2h1d9 < t2w1rwt5 && t2h1d9 < t2w1lwt5 && t2h1d9 < t2h1uwt5 && t2h1d9 < t2h1dwt5
  && t2h1d9 < t2w1r6 && t2h1d9 < t2w1l6 && t2h1d9 < t2h1u6 && t2h1d9 < t2h1d6 && t2h1d9 < t2w1rwt6 && t2h1d9 < t2w1lwt6 && t2h1d9 < t2h1uwt6 && t2h1d9 < t2h1dwt6
  && t2h1d9 < t2w1r7 && t2h1d9 < t2w1l7 && t2h1d9 < t2h1u7 && t2h1d9 < t2h1d7 && t2h1d9 < t2w1rwt7 && t2h1d9 < t2w1lwt7 && t2h1d9 < t2h1uwt7 && t2h1d9 < t2h1dwt7
  && t2h1d9 < t2w1r8 && t2h1d9 < t2w1l8 && t2h1d9 < t2h1u8 && t2h1d9 < t2h1d8 && t2h1d9 < t2w1rwt8 && t2h1d9 < t2w1lwt8 && t2h1d9 < t2h1uwt8 && t2h1d9 < t2h1dwt8
  && t2h1d9 < t2w1r9 && t2h1d9 < t2w1l9 && t2h1d9 < t2h1u9 && t2h1d9 < t2w1rwt9 && t2h1d9 < t2w1lwt9 && t2h1d9 < t2h1uwt9 && t2h1d9 < t2h1dwt9
  && t2h1d9 < t2w1r10 && t2h1d9 < t2w1l10 && t2h1d9 < t2h1u10 && t2h1d9 < t2h1d10 && t2h1d9 < t2w1rwt10 && t2h1d9 < t2w1lwt10 && t2h1d9 < t2h1uwt10 && t2h1d9 < t2h1dwt10
  && (louthd9 !=0 && linhd9!=0)){
  i=377;
  }

  if (myd9==-1 && t2h1d9 > 0 && t2h1d9 < t1 
  && t2h1d9 < t2w1r && t2h1d9 < t2w1l && t2h1d9 < t2h1u && t2h1d9 < t2h1d && t2h1d9 < t2w1rwt && t2h1d9 < t2w1lwt && t2h1d9 < t2h1uwt && t2h1d9 < t2h1dwt
  && t2h1d9 < t2w1r1 && t2h1d9 < t2w1l1 && t2h1d9 < t2h1u1 && t2h1d9 < t2h1d1 && t2h1d9 < t2w1rwt1 && t2h1d9 < t2w1lwt1 && t2h1d9 < t2h1uwt1 && t2h1d9 < t2h1dwt1
  && t2h1d9 < t2w1r2 && t2h1d9 < t2w1l2 && t2h1d9 < t2h1u2 && t2h1d9 < t2h1d2 && t2h1d9 < t2w1rwt2 && t2h1d9 < t2w1lwt2 && t2h1d9 < t2h1uwt2 && t2h1d9 < t2h1dwt2
  && t2h1d9 < t2w1r3 && t2h1d9 < t2w1l3 && t2h1d9 < t2h1u3 && t2h1d9 < t2h1d3 && t2h1d9 < t2w1rwt3 && t2h1d9 < t2w1lwt3 && t2h1d9 < t2h1uwt3 && t2h1d9 < t2h1dwt3
  && t2h1d9 < t2w1r4 && t2h1d9 < t2w1l4 && t2h1d9 < t2h1u4 && t2h1d9 < t2h1d4 && t2h1d9 < t2w1rwt4 && t2h1d9 < t2w1lwt4 && t2h1d9 < t2h1uwt4 && t2h1d9 < t2h1dwt4
  && t2h1d9 < t2w1r5 && t2h1d9 < t2w1l5 && t2h1d9 < t2h1u5 && t2h1d9 < t2h1d5 && t2h1d9 < t2w1rwt5 && t2h1d9 < t2w1lwt5 && t2h1d9 < t2h1uwt5 && t2h1d9 < t2h1dwt5
  && t2h1d9 < t2w1r6 && t2h1d9 < t2w1l6 && t2h1d9 < t2h1u6 && t2h1d9 < t2h1d6 && t2h1d9 < t2w1rwt6 && t2h1d9 < t2w1lwt6 && t2h1d9 < t2h1uwt6 && t2h1d9 < t2h1dwt6
  && t2h1d9 < t2w1r7 && t2h1d9 < t2w1l7 && t2h1d9 < t2h1u7 && t2h1d9 < t2h1d7 && t2h1d9 < t2w1rwt7 && t2h1d9 < t2w1lwt7 && t2h1d9 < t2h1uwt7 && t2h1d9 < t2h1dwt7
  && t2h1d9 < t2w1r8 && t2h1d9 < t2w1l8 && t2h1d9 < t2h1u8 && t2h1d9 < t2h1d8 && t2h1d9 < t2w1rwt8 && t2h1d9 < t2w1lwt8 && t2h1d9 < t2h1uwt8 && t2h1d9 < t2h1dwt8
  && t2h1d9 < t2w1r9 && t2h1d9 < t2w1l9 && t2h1d9 < t2h1u9 && t2h1d9 < t2w1rwt9 && t2h1d9 < t2w1lwt9 && t2h1d9 < t2h1uwt9 && t2h1d9 < t2h1dwt9
  && t2h1d9 < t2w1r10 && t2h1d9 < t2w1l10 && t2h1d9 < t2h1u10 && t2h1d9 < t2h1d10 && t2h1d9 < t2w1rwt10 && t2h1d9 < t2w1lwt10 && t2h1d9 < t2h1uwt10 && t2h1d9 < t2h1dwt10
  && ((louthd9 !=0 && linhd9==0) || (louthd9 ==0 && linhd9!=0))){
  i=377;
  }

  if (myd9==-1 && t2h1d9 > 0 && t2h1d9 < t1 
  && t2h1d9 < t2w1r && t2h1d9 < t2w1l && t2h1d9 < t2h1u && t2h1d9 < t2h1d && t2h1d9 < t2w1rwt && t2h1d9 < t2w1lwt && t2h1d9 < t2h1uwt && t2h1d9 < t2h1dwt
  && t2h1d9 < t2w1r1 && t2h1d9 < t2w1l1 && t2h1d9 < t2h1u1 && t2h1d9 < t2h1d1 && t2h1d9 < t2w1rwt1 && t2h1d9 < t2w1lwt1 && t2h1d9 < t2h1uwt1 && t2h1d9 < t2h1dwt1
  && t2h1d9 < t2w1r2 && t2h1d9 < t2w1l2 && t2h1d9 < t2h1u2 && t2h1d9 < t2h1d2 && t2h1d9 < t2w1rwt2 && t2h1d9 < t2w1lwt2 && t2h1d9 < t2h1uwt2 && t2h1d9 < t2h1dwt2
  && t2h1d9 < t2w1r3 && t2h1d9 < t2w1l3 && t2h1d9 < t2h1u3 && t2h1d9 < t2h1d3 && t2h1d9 < t2w1rwt3 && t2h1d9 < t2w1lwt3 && t2h1d9 < t2h1uwt3 && t2h1d9 < t2h1dwt3
  && t2h1d9 < t2w1r4 && t2h1d9 < t2w1l4 && t2h1d9 < t2h1u4 && t2h1d9 < t2h1d4 && t2h1d9 < t2w1rwt4 && t2h1d9 < t2w1lwt4 && t2h1d9 < t2h1uwt4 && t2h1d9 < t2h1dwt4
  && t2h1d9 < t2w1r5 && t2h1d9 < t2w1l5 && t2h1d9 < t2h1u5 && t2h1d9 < t2h1d5 && t2h1d9 < t2w1rwt5 && t2h1d9 < t2w1lwt5 && t2h1d9 < t2h1uwt5 && t2h1d9 < t2h1dwt5
  && t2h1d9 < t2w1r6 && t2h1d9 < t2w1l6 && t2h1d9 < t2h1u6 && t2h1d9 < t2h1d6 && t2h1d9 < t2w1rwt6 && t2h1d9 < t2w1lwt6 && t2h1d9 < t2h1uwt6 && t2h1d9 < t2h1dwt6
  && t2h1d9 < t2w1r7 && t2h1d9 < t2w1l7 && t2h1d9 < t2h1u7 && t2h1d9 < t2h1d7 && t2h1d9 < t2w1rwt7 && t2h1d9 < t2w1lwt7 && t2h1d9 < t2h1uwt7 && t2h1d9 < t2h1dwt7
  && t2h1d9 < t2w1r8 && t2h1d9 < t2w1l8 && t2h1d9 < t2h1u8 && t2h1d9 < t2h1d8 && t2h1d9 < t2w1rwt8 && t2h1d9 < t2w1lwt8 && t2h1d9 < t2h1uwt8 && t2h1d9 < t2h1dwt8
  && t2h1d9 < t2w1r9 && t2h1d9 < t2w1l9 && t2h1d9 < t2h1u9 && t2h1d9 < t2w1rwt9 && t2h1d9 < t2w1lwt9 && t2h1d9 < t2h1uwt9 && t2h1d9 < t2h1dwt9
  && t2h1d9 < t2w1r10 && t2h1d9 < t2w1l10 && t2h1d9 < t2h1u10 && t2h1d9 < t2h1d10 && t2h1d9 < t2w1rwt10 && t2h1d9 < t2w1lwt10 && t2h1d9 < t2h1uwt10 && t2h1d9 < t2h1dwt10
  && (louthd9 == 0 && linhd9 == 0)){
  i=377;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW9!=-1 && t2w1rwt9 > 0 && t2w1rwt9 < t1 
  && t2w1rwt9 < t2w1r && t2w1rwt9 < t2w1l && t2w1rwt9 < t2h1u && t2w1rwt9 < t2h1d && t2w1rwt9 <t2w1rwt && t2w1rwt9 <t2w1lwt && t2w1rwt9 < t2h1uwt && t2w1rwt9 < t2h1dwt
  && t2w1rwt9 < t2w1r1 && t2w1rwt9 < t2w1l1 && t2w1rwt9 < t2h1u1 && t2w1rwt9 < t2h1d1 && t2w1rwt9 <t2w1rwt1 && t2w1rwt9 <t2w1lwt1 && t2w1rwt9 < t2h1uwt1 && t2w1rwt9 < t2h1dwt1
  && t2w1rwt9 < t2w1r2 && t2w1rwt9 < t2w1l2 && t2w1rwt9 < t2h1u2 && t2w1rwt9 < t2h1d2 && t2w1rwt9 <t2w1rwt2 && t2w1rwt9 <t2w1lwt2 && t2w1rwt9 < t2h1uwt2 && t2w1rwt9 < t2h1dwt2
  && t2w1rwt9 < t2w1r3 && t2w1rwt9 < t2w1l3 && t2w1rwt9 < t2h1u3 && t2w1rwt9 < t2h1d3 && t2w1rwt9 <t2w1rwt3 && t2w1rwt9 <t2w1lwt3 && t2w1rwt9 < t2h1uwt3 && t2w1rwt9 < t2h1dwt3
  && t2w1rwt9 < t2w1r4 && t2w1rwt9 < t2w1l4 && t2w1rwt9 < t2h1u4 && t2w1rwt9 < t2h1d4 && t2w1rwt9 <t2w1rwt4 && t2w1rwt9 <t2w1lwt4 && t2w1rwt9 < t2h1uwt4 && t2w1rwt9 < t2h1dwt4
  && t2w1rwt9 < t2w1r5 && t2w1rwt9 < t2w1l5 && t2w1rwt9 < t2h1u5 && t2w1rwt9 < t2h1d5 && t2w1rwt9 <t2w1rwt5 && t2w1rwt9 <t2w1lwt5 && t2w1rwt9 < t2h1uwt5 && t2w1rwt9 < t2h1dwt5
  && t2w1rwt9 < t2w1r6 && t2w1rwt9 < t2w1l6 && t2w1rwt9 < t2h1u6 && t2w1rwt9 < t2h1d6 && t2w1rwt9 <t2w1rwt6 && t2w1rwt9 <t2w1lwt6 && t2w1rwt9 < t2h1uwt6 && t2w1rwt9 < t2h1dwt6
  && t2w1rwt9 < t2w1r7 && t2w1rwt9 < t2w1l7 && t2w1rwt9 < t2h1u7 && t2w1rwt9 < t2h1d7 && t2w1rwt9 <t2w1rwt7 && t2w1rwt9 <t2w1lwt7 && t2w1rwt9 < t2h1uwt7 && t2w1rwt9 < t2h1dwt7
  && t2w1rwt9 < t2w1r8 && t2w1rwt9 < t2w1l8 && t2w1rwt9 < t2h1u8 && t2w1rwt9 < t2h1d8 && t2w1rwt9 <t2w1rwt8 && t2w1rwt9 <t2w1lwt8 && t2w1rwt9 < t2h1uwt8 && t2w1rwt9 < t2h1dwt8
  && t2w1rwt9 < t2w1r9 && t2w1rwt9 < t2w1l9 && t2w1rwt9 < t2h1u9 && t2w1rwt9 < t2h1d9 && t2w1rwt9 <t2w1lwt9 && t2w1rwt9 < t2h1uwt9 && t2w1rwt9 < t2h1dwt9
  && t2w1rwt9 < t2w1r10 && t2w1rwt9 < t2w1l10 && t2w1rwt9 < t2h1u10 && t2w1rwt9 < t2h1d10 && t2w1rwt9 <t2w1rwt10 && t2w1rwt9 <t2w1lwt10 && t2w1rwt9 < t2h1uwt10 && t2w1rwt9 < t2h1dwt10
  && ((linwr9!=0) && (loutwr9!=0) )){	
   if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1rwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1rwt9+z))*(z0hd9+(vz*t2w1rwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1rwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1rwt9+z))*(z0hu9+(vz*t2w1rwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1rwt9+y;
  xtest=vx*t2w1rwt9+x;
  xlimitrwt=-bwrwt9*sqrt(1-((vz*t2w1rwt9+z)+z0wr9)*((vz*t2w1rwt9+z)+z0wr9)/a2wrwt9);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW9 > 0){
  i=382;
  }
  else{
  i=394;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW9!=-1 && t2w1rwt9 > 0 && t2w1rwt9 < t1 
  && t2w1rwt9 < t2w1r && t2w1rwt9 < t2w1l && t2w1rwt9 < t2h1u && t2w1rwt9 < t2h1d && t2w1rwt9 <t2w1rwt && t2w1rwt9 <t2w1lwt && t2w1rwt9 < t2h1uwt && t2w1rwt9 < t2h1dwt
  && t2w1rwt9 < t2w1r1 && t2w1rwt9 < t2w1l1 && t2w1rwt9 < t2h1u1 && t2w1rwt9 < t2h1d1 && t2w1rwt9 <t2w1rwt1 && t2w1rwt9 <t2w1lwt1 && t2w1rwt9 < t2h1uwt1 && t2w1rwt9 < t2h1dwt1
  && t2w1rwt9 < t2w1r2 && t2w1rwt9 < t2w1l2 && t2w1rwt9 < t2h1u2 && t2w1rwt9 < t2h1d2 && t2w1rwt9 <t2w1rwt2 && t2w1rwt9 <t2w1lwt2 && t2w1rwt9 < t2h1uwt2 && t2w1rwt9 < t2h1dwt2
  && t2w1rwt9 < t2w1r3 && t2w1rwt9 < t2w1l3 && t2w1rwt9 < t2h1u3 && t2w1rwt9 < t2h1d3 && t2w1rwt9 <t2w1rwt3 && t2w1rwt9 <t2w1lwt3 && t2w1rwt9 < t2h1uwt3 && t2w1rwt9 < t2h1dwt3
  && t2w1rwt9 < t2w1r4 && t2w1rwt9 < t2w1l4 && t2w1rwt9 < t2h1u4 && t2w1rwt9 < t2h1d4 && t2w1rwt9 <t2w1rwt4 && t2w1rwt9 <t2w1lwt4 && t2w1rwt9 < t2h1uwt4 && t2w1rwt9 < t2h1dwt4
  && t2w1rwt9 < t2w1r5 && t2w1rwt9 < t2w1l5 && t2w1rwt9 < t2h1u5 && t2w1rwt9 < t2h1d5 && t2w1rwt9 <t2w1rwt5 && t2w1rwt9 <t2w1lwt5 && t2w1rwt9 < t2h1uwt5 && t2w1rwt9 < t2h1dwt5
  && t2w1rwt9 < t2w1r6 && t2w1rwt9 < t2w1l6 && t2w1rwt9 < t2h1u6 && t2w1rwt9 < t2h1d6 && t2w1rwt9 <t2w1rwt6 && t2w1rwt9 <t2w1lwt6 && t2w1rwt9 < t2h1uwt6 && t2w1rwt9 < t2h1dwt6
  && t2w1rwt9 < t2w1r7 && t2w1rwt9 < t2w1l7 && t2w1rwt9 < t2h1u7 && t2w1rwt9 < t2h1d7 && t2w1rwt9 <t2w1rwt7 && t2w1rwt9 <t2w1lwt7 && t2w1rwt9 < t2h1uwt7 && t2w1rwt9 < t2h1dwt7
  && t2w1rwt9 < t2w1r8 && t2w1rwt9 < t2w1l8 && t2w1rwt9 < t2h1u8 && t2w1rwt9 < t2h1d8 && t2w1rwt9 <t2w1rwt8 && t2w1rwt9 <t2w1lwt8 && t2w1rwt9 < t2h1uwt8 && t2w1rwt9 < t2h1dwt8
  && t2w1rwt9 < t2w1r9 && t2w1rwt9 < t2w1l9 && t2w1rwt9 < t2h1u9 && t2w1rwt9 < t2h1d9 && t2w1rwt9 <t2w1lwt9 && t2w1rwt9 < t2h1uwt9 && t2w1rwt9 < t2h1dwt9
  && t2w1rwt9 < t2w1r10 && t2w1rwt9 < t2w1l10 && t2w1rwt9 < t2h1u10 && t2w1rwt9 < t2h1d10 && t2w1rwt9 <t2w1rwt10 && t2w1rwt9 <t2w1lwt10 && t2w1rwt9 < t2h1uwt10 && t2w1rwt9 < t2h1dwt10
  && ((loutwr9!=0 && linwr9==0) || (loutwr9==0 && linwr9!=0))){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1rwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1rwt9+z))*(z0hd9+(vz*t2w1rwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1rwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1rwt9+z))*(z0hu9+(vz*t2w1rwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1rwt9+y;
  xtest=vx*t2w1rwt9+x;
  xlimitr=-sqrt((pbwrwt9-(vz*t2w1rwt9+z))/pawrwt9);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW9 > 0){
  i=383; 
  }else{
  i=394;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW9!=-1 && t2w1rwt9 > 0 && t2w1rwt9 < t1 
  && t2w1rwt9 < t2w1r && t2w1rwt9 < t2w1l && t2w1rwt9 < t2h1u && t2w1rwt9 < t2h1d && t2w1rwt9 <t2w1rwt && t2w1rwt9 <t2w1lwt && t2w1rwt9 < t2h1uwt && t2w1rwt9 < t2h1dwt
  && t2w1rwt9 < t2w1r1 && t2w1rwt9 < t2w1l1 && t2w1rwt9 < t2h1u1 && t2w1rwt9 < t2h1d1 && t2w1rwt9 <t2w1rwt1 && t2w1rwt9 <t2w1lwt1 && t2w1rwt9 < t2h1uwt1 && t2w1rwt9 < t2h1dwt1
  && t2w1rwt9 < t2w1r2 && t2w1rwt9 < t2w1l2 && t2w1rwt9 < t2h1u2 && t2w1rwt9 < t2h1d2 && t2w1rwt9 <t2w1rwt2 && t2w1rwt9 <t2w1lwt2 && t2w1rwt9 < t2h1uwt2 && t2w1rwt9 < t2h1dwt2
  && t2w1rwt9 < t2w1r3 && t2w1rwt9 < t2w1l3 && t2w1rwt9 < t2h1u3 && t2w1rwt9 < t2h1d3 && t2w1rwt9 <t2w1rwt3 && t2w1rwt9 <t2w1lwt3 && t2w1rwt9 < t2h1uwt3 && t2w1rwt9 < t2h1dwt3
  && t2w1rwt9 < t2w1r4 && t2w1rwt9 < t2w1l4 && t2w1rwt9 < t2h1u4 && t2w1rwt9 < t2h1d4 && t2w1rwt9 <t2w1rwt4 && t2w1rwt9 <t2w1lwt4 && t2w1rwt9 < t2h1uwt4 && t2w1rwt9 < t2h1dwt4
  && t2w1rwt9 < t2w1r5 && t2w1rwt9 < t2w1l5 && t2w1rwt9 < t2h1u5 && t2w1rwt9 < t2h1d5 && t2w1rwt9 <t2w1rwt5 && t2w1rwt9 <t2w1lwt5 && t2w1rwt9 < t2h1uwt5 && t2w1rwt9 < t2h1dwt5
  && t2w1rwt9 < t2w1r6 && t2w1rwt9 < t2w1l6 && t2w1rwt9 < t2h1u6 && t2w1rwt9 < t2h1d6 && t2w1rwt9 <t2w1rwt6 && t2w1rwt9 <t2w1lwt6 && t2w1rwt9 < t2h1uwt6 && t2w1rwt9 < t2h1dwt6
  && t2w1rwt9 < t2w1r7 && t2w1rwt9 < t2w1l7 && t2w1rwt9 < t2h1u7 && t2w1rwt9 < t2h1d7 && t2w1rwt9 <t2w1rwt7 && t2w1rwt9 <t2w1lwt7 && t2w1rwt9 < t2h1uwt7 && t2w1rwt9 < t2h1dwt7
  && t2w1rwt9 < t2w1r8 && t2w1rwt9 < t2w1l8 && t2w1rwt9 < t2h1u8 && t2w1rwt9 < t2h1d8 && t2w1rwt9 <t2w1rwt8 && t2w1rwt9 <t2w1lwt8 && t2w1rwt9 < t2h1uwt8 && t2w1rwt9 < t2h1dwt8
  && t2w1rwt9 < t2w1r9 && t2w1rwt9 < t2w1l9 && t2w1rwt9 < t2h1u9 && t2w1rwt9 < t2h1d9 && t2w1rwt9 <t2w1lwt9 && t2w1rwt9 < t2h1uwt9 && t2w1rwt9 < t2h1dwt9
  && t2w1rwt9 < t2w1r10 && t2w1rwt9 < t2w1l10 && t2w1rwt9 < t2h1u10 && t2w1rwt9 < t2h1d10 && t2w1rwt9 <t2w1rwt10 && t2w1rwt9 <t2w1lwt10 && t2w1rwt9 < t2h1uwt10 && t2w1rwt9 < t2h1dwt10
  && (loutwr9==0 && linwr9==0)){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1rwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1rwt9+z))*(z0hd9+(vz*t2w1rwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1rwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1rwt9+z))*(z0hu9+(vz*t2w1rwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1rwt9+y; 
  xtest=vx*t2w1rwt9+x;
  xlimitr=-(-w2r9+w1r9)*(vz*t2w1rwt9+z)/l-w1rwt9;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW9>0){
  i=384;
  }else{
  i=394;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW9!=-1 && t2w1lwt9 > 0 && t2w1lwt9 < t1 
  && t2w1lwt9 < t2w1r && t2w1lwt9 < t2w1l && t2w1lwt9 < t2h1u && t2w1lwt9 < t2h1d && t2w1lwt9 <t2w1rwt && t2w1lwt9 <t2w1lwt && t2w1lwt9 < t2h1uwt && t2w1lwt9 < t2h1dwt
  && t2w1lwt9 < t2w1r1 && t2w1lwt9 < t2w1l1 && t2w1lwt9 < t2h1u1 && t2w1lwt9 < t2h1d1 && t2w1lwt9 <t2w1rwt1 && t2w1lwt9 <t2w1lwt1 && t2w1lwt9 < t2h1uwt1 && t2w1lwt9 < t2h1dwt1
  && t2w1lwt9 < t2w1r2 && t2w1lwt9 < t2w1l2 && t2w1lwt9 < t2h1u2 && t2w1lwt9 < t2h1d2 && t2w1lwt9 <t2w1rwt2 && t2w1lwt9 <t2w1lwt2 && t2w1lwt9 < t2h1uwt2 && t2w1lwt9 < t2h1dwt2
  && t2w1lwt9 < t2w1r3 && t2w1lwt9 < t2w1l3 && t2w1lwt9 < t2h1u3 && t2w1lwt9 < t2h1d3 && t2w1lwt9 <t2w1rwt3 && t2w1lwt9 <t2w1lwt3 && t2w1lwt9 < t2h1uwt3 && t2w1lwt9 < t2h1dwt3
  && t2w1lwt9 < t2w1r4 && t2w1lwt9 < t2w1l4 && t2w1lwt9 < t2h1u4 && t2w1lwt9 < t2h1d4 && t2w1lwt9 <t2w1rwt4 && t2w1lwt9 <t2w1lwt4 && t2w1lwt9 < t2h1uwt4 && t2w1lwt9 < t2h1dwt4
  && t2w1lwt9 < t2w1r5 && t2w1lwt9 < t2w1l5 && t2w1lwt9 < t2h1u5 && t2w1lwt9 < t2h1d5 && t2w1lwt9 <t2w1rwt5 && t2w1lwt9 <t2w1lwt5 && t2w1lwt9 < t2h1uwt5 && t2w1lwt9 < t2h1dwt5
  && t2w1lwt9 < t2w1r6 && t2w1lwt9 < t2w1l6 && t2w1lwt9 < t2h1u6 && t2w1lwt9 < t2h1d6 && t2w1lwt9 <t2w1rwt6 && t2w1lwt9 <t2w1lwt6 && t2w1lwt9 < t2h1uwt6 && t2w1lwt9 < t2h1dwt6
  && t2w1lwt9 < t2w1r7 && t2w1lwt9 < t2w1l7 && t2w1lwt9 < t2h1u7 && t2w1lwt9 < t2h1d7 && t2w1lwt9 <t2w1rwt7 && t2w1lwt9 <t2w1lwt7 && t2w1lwt9 < t2h1uwt7 && t2w1lwt9 < t2h1dwt7
  && t2w1lwt9 < t2w1r8 && t2w1lwt9 < t2w1l8 && t2w1lwt9 < t2h1u8 && t2w1lwt9 < t2h1d8 && t2w1lwt9 <t2w1rwt8 && t2w1lwt9 <t2w1lwt8 && t2w1lwt9 < t2h1uwt8 && t2w1lwt9 < t2h1dwt8
  && t2w1lwt9 < t2w1r9 && t2w1lwt9 < t2w1l9 && t2w1lwt9 < t2h1u9 && t2w1lwt9 < t2h1d9 && t2w1lwt9 <t2w1rwt9 && t2w1lwt9 < t2h1uwt9 && t2w1lwt9 < t2h1dwt9
  && t2w1lwt9 < t2w1r10 && t2w1lwt9 < t2w1l10 && t2w1lwt9 < t2h1u10 && t2w1lwt9 < t2h1d10 && t2w1lwt9 <t2w1rwt10 && t2w1lwt9 <t2w1lwt10 && t2w1lwt9 < t2h1uwt10 && t2w1lwt9 < t2h1dwt10
  && ((linwl9!=0) && (loutwl9!=0) )){
  if(linhd9==0 && louthd9==0)
   if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1lwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1lwt9+z))*(z0hd9+(vz*t2w1lwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1lwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1lwt9+z))*(z0hu9+(vz*t2w1lwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1lwt9+y;
  xtest=vx*t2w1lwt9+x;
  xlimitlwt=-bwlwt9*sqrt(1-((vz*t2w1lwt9+z)+z0wl9)*((vz*t2w1lwt9+z)+z0wl9)/a2wlwt9);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW9>0){
  i=385;
  }else{
  i=395;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW9!=-1 && t2w1lwt9 > 0 && t2w1lwt9 < t1 
  && t2w1lwt9 < t2w1r && t2w1lwt9 < t2w1l && t2w1lwt9 < t2h1u && t2w1lwt9 < t2h1d && t2w1lwt9 <t2w1rwt && t2w1lwt9 <t2w1lwt && t2w1lwt9 < t2h1uwt && t2w1lwt9 < t2h1dwt
  && t2w1lwt9 < t2w1r1 && t2w1lwt9 < t2w1l1 && t2w1lwt9 < t2h1u1 && t2w1lwt9 < t2h1d1 && t2w1lwt9 <t2w1rwt1 && t2w1lwt9 <t2w1lwt1 && t2w1lwt9 < t2h1uwt1 && t2w1lwt9 < t2h1dwt1
  && t2w1lwt9 < t2w1r2 && t2w1lwt9 < t2w1l2 && t2w1lwt9 < t2h1u2 && t2w1lwt9 < t2h1d2 && t2w1lwt9 <t2w1rwt2 && t2w1lwt9 <t2w1lwt2 && t2w1lwt9 < t2h1uwt2 && t2w1lwt9 < t2h1dwt2
  && t2w1lwt9 < t2w1r3 && t2w1lwt9 < t2w1l3 && t2w1lwt9 < t2h1u3 && t2w1lwt9 < t2h1d3 && t2w1lwt9 <t2w1rwt3 && t2w1lwt9 <t2w1lwt3 && t2w1lwt9 < t2h1uwt3 && t2w1lwt9 < t2h1dwt3
  && t2w1lwt9 < t2w1r4 && t2w1lwt9 < t2w1l4 && t2w1lwt9 < t2h1u4 && t2w1lwt9 < t2h1d4 && t2w1lwt9 <t2w1rwt4 && t2w1lwt9 <t2w1lwt4 && t2w1lwt9 < t2h1uwt4 && t2w1lwt9 < t2h1dwt4
  && t2w1lwt9 < t2w1r5 && t2w1lwt9 < t2w1l5 && t2w1lwt9 < t2h1u5 && t2w1lwt9 < t2h1d5 && t2w1lwt9 <t2w1rwt5 && t2w1lwt9 <t2w1lwt5 && t2w1lwt9 < t2h1uwt5 && t2w1lwt9 < t2h1dwt5
  && t2w1lwt9 < t2w1r6 && t2w1lwt9 < t2w1l6 && t2w1lwt9 < t2h1u6 && t2w1lwt9 < t2h1d6 && t2w1lwt9 <t2w1rwt6 && t2w1lwt9 <t2w1lwt6 && t2w1lwt9 < t2h1uwt6 && t2w1lwt9 < t2h1dwt6
  && t2w1lwt9 < t2w1r7 && t2w1lwt9 < t2w1l7 && t2w1lwt9 < t2h1u7 && t2w1lwt9 < t2h1d7 && t2w1lwt9 <t2w1rwt7 && t2w1lwt9 <t2w1lwt7 && t2w1lwt9 < t2h1uwt7 && t2w1lwt9 < t2h1dwt7
  && t2w1lwt9 < t2w1r8 && t2w1lwt9 < t2w1l8 && t2w1lwt9 < t2h1u8 && t2w1lwt9 < t2h1d8 && t2w1lwt9 <t2w1rwt8 && t2w1lwt9 <t2w1lwt8 && t2w1lwt9 < t2h1uwt8 && t2w1lwt9 < t2h1dwt8
  && t2w1lwt9 < t2w1r9 && t2w1lwt9 < t2w1l9 && t2w1lwt9 < t2h1u9 && t2w1lwt9 < t2h1d9 && t2w1lwt9 <t2w1rwt9 && t2w1lwt9 < t2h1uwt9 && t2w1lwt9 < t2h1dwt9
  && t2w1lwt9 < t2w1r10 && t2w1lwt9 < t2w1l10 && t2w1lwt9 < t2h1u10 && t2w1lwt9 < t2h1d10 && t2w1lwt9 <t2w1rwt10 && t2w1lwt9 <t2w1lwt10 && t2w1lwt9 < t2h1uwt10 && t2w1lwt9 < t2h1dwt10
  && ((loutwl9!=0 && linwl9==0) || (loutwl9==0 && linwl9!=0))){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1lwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1lwt9+z))*(z0hd9+(vz*t2w1lwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1lwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1lwt9+z))*(z0hu9+(vz*t2w1lwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1lwt9+y;
  xtest=vx*t2w1lwt9+x;
  xlimitl=-sqrt((pbwlwt9-(vz*t2w1lwt9+z))/pawlwt9);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW9>0){
  i=386;
  }else{
  i=395;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW9!=-1 && t2w1lwt9 > 0 && t2w1lwt9 < t1 
  && t2w1lwt9 < t2w1r && t2w1lwt9 < t2w1l && t2w1lwt9 < t2h1u && t2w1lwt9 < t2h1d && t2w1lwt9 <t2w1rwt && t2w1lwt9 <t2w1lwt && t2w1lwt9 < t2h1uwt && t2w1lwt9 < t2h1dwt
  && t2w1lwt9 < t2w1r1 && t2w1lwt9 < t2w1l1 && t2w1lwt9 < t2h1u1 && t2w1lwt9 < t2h1d1 && t2w1lwt9 <t2w1rwt1 && t2w1lwt9 <t2w1lwt1 && t2w1lwt9 < t2h1uwt1 && t2w1lwt9 < t2h1dwt1
  && t2w1lwt9 < t2w1r2 && t2w1lwt9 < t2w1l2 && t2w1lwt9 < t2h1u2 && t2w1lwt9 < t2h1d2 && t2w1lwt9 <t2w1rwt2 && t2w1lwt9 <t2w1lwt2 && t2w1lwt9 < t2h1uwt2 && t2w1lwt9 < t2h1dwt2
  && t2w1lwt9 < t2w1r3 && t2w1lwt9 < t2w1l3 && t2w1lwt9 < t2h1u3 && t2w1lwt9 < t2h1d3 && t2w1lwt9 <t2w1rwt3 && t2w1lwt9 <t2w1lwt3 && t2w1lwt9 < t2h1uwt3 && t2w1lwt9 < t2h1dwt3
  && t2w1lwt9 < t2w1r4 && t2w1lwt9 < t2w1l4 && t2w1lwt9 < t2h1u4 && t2w1lwt9 < t2h1d4 && t2w1lwt9 <t2w1rwt4 && t2w1lwt9 <t2w1lwt4 && t2w1lwt9 < t2h1uwt4 && t2w1lwt9 < t2h1dwt4
  && t2w1lwt9 < t2w1r5 && t2w1lwt9 < t2w1l5 && t2w1lwt9 < t2h1u5 && t2w1lwt9 < t2h1d5 && t2w1lwt9 <t2w1rwt5 && t2w1lwt9 <t2w1lwt5 && t2w1lwt9 < t2h1uwt5 && t2w1lwt9 < t2h1dwt5
  && t2w1lwt9 < t2w1r6 && t2w1lwt9 < t2w1l6 && t2w1lwt9 < t2h1u6 && t2w1lwt9 < t2h1d6 && t2w1lwt9 <t2w1rwt6 && t2w1lwt9 <t2w1lwt6 && t2w1lwt9 < t2h1uwt6 && t2w1lwt9 < t2h1dwt6
  && t2w1lwt9 < t2w1r7 && t2w1lwt9 < t2w1l7 && t2w1lwt9 < t2h1u7 && t2w1lwt9 < t2h1d7 && t2w1lwt9 <t2w1rwt7 && t2w1lwt9 <t2w1lwt7 && t2w1lwt9 < t2h1uwt7 && t2w1lwt9 < t2h1dwt7
  && t2w1lwt9 < t2w1r8 && t2w1lwt9 < t2w1l8 && t2w1lwt9 < t2h1u8 && t2w1lwt9 < t2h1d8 && t2w1lwt9 <t2w1rwt8 && t2w1lwt9 <t2w1lwt8 && t2w1lwt9 < t2h1uwt8 && t2w1lwt9 < t2h1dwt8
  && t2w1lwt9 < t2w1r9 && t2w1lwt9 < t2w1l9 && t2w1lwt9 < t2h1u9 && t2w1lwt9 < t2h1d9 && t2w1lwt9 <t2w1rwt9 && t2w1lwt9 < t2h1uwt9 && t2w1lwt9 < t2h1dwt9
  && t2w1lwt9 < t2w1r10 && t2w1lwt9 < t2w1l10 && t2w1lwt9 < t2h1u10 && t2w1lwt9 < t2h1d10 && t2w1lwt9 <t2w1rwt10 && t2w1lwt9 <t2w1lwt10 && t2w1lwt9 < t2h1uwt10 && t2w1lwt9 < t2h1dwt10
  && (loutwl9==0 && linwl9==0)){
  if(linhd9==0 && louthd9==0)
   {
      ylimitd=(-h2d9+h1d9)/l*(vz*t2w1lwt9+z)-h1dwt9;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ylimitd=-bhdwt9*sqrt(1-((z0hd9+(vz*t2w1lwt9+z))*(z0hd9+(vz*t2w1lwt9+z)))/a2hdwt9);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt9+z)-pbhdwt9)/-pahdwt9);
      }
   }
   if(linhu9==0 && louthu9==0)
    {
     ylimitu=(h2u9-h1u9)/l*(vz*t2w1lwt9+z)+h1uwt9;
    }else{
     if(linhu9!=0 && louthu9!=0)
     {
     ylimitu=bhuwt9*sqrt(1-((z0hu9+(vz*t2w1lwt9+z))*(z0hu9+(vz*t2w1lwt9+z)))/a2huwt9);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt9+z)-pbhuwt9)/-pahuwt9);
    }
    }
  ytest=vy*t2w1lwt9+y; 
  xtest=vx*t2w1lwt9+x;
  xlimitl=(w2l9-w1l9)*(vz*t2w1lwt9+z)/l+w1lwt9;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW9>0){
  i=387;
  }else{
  i=395;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW9!=-1 && t2h1uwt9 > 0 && t2h1uwt9 < t1 
  && t2h1uwt9 < t2w1r && t2h1uwt9 < t2w1l && t2h1uwt9 < t2h1u && t2h1uwt9 < t2h1d && t2h1uwt9 < t2w1rwt && t2h1uwt9 < t2w1lwt && t2h1uwt9 < t2h1uwt && t2h1uwt9 < t2h1dwt 
  && t2h1uwt9 < t2w1r1 && t2h1uwt9 < t2w1l1 && t2h1uwt9 < t2h1u1 && t2h1uwt9 < t2h1d1 && t2h1uwt9 < t2w1rwt1 && t2h1uwt9 < t2w1lwt1 && t2h1uwt9 < t2h1uwt1 && t2h1uwt9 < t2h1dwt1
  && t2h1uwt9 < t2w1r2 && t2h1uwt9 < t2w1l2 && t2h1uwt9 < t2h1u2 && t2h1uwt9 < t2h1d2 && t2h1uwt9 < t2w1rwt2 && t2h1uwt9 < t2w1lwt2 && t2h1uwt9 < t2h1uwt2 && t2h1uwt9 < t2h1dwt2
  && t2h1uwt9 < t2w1r3 && t2h1uwt9 < t2w1l3 && t2h1uwt9 < t2h1u3 && t2h1uwt9 < t2h1d3 && t2h1uwt9 < t2w1rwt3 && t2h1uwt9 < t2w1lwt3 && t2h1uwt9 < t2h1uwt3 && t2h1uwt9 < t2h1dwt3
  && t2h1uwt9 < t2w1r4 && t2h1uwt9 < t2w1l4 && t2h1uwt9 < t2h1u4 && t2h1uwt9 < t2h1d4 && t2h1uwt9 < t2w1rwt4 && t2h1uwt9 < t2w1lwt4 && t2h1uwt9 < t2h1uwt4 && t2h1uwt9 < t2h1dwt4
  && t2h1uwt9 < t2w1r5 && t2h1uwt9 < t2w1l5 && t2h1uwt9 < t2h1u5 && t2h1uwt9 < t2h1d5 && t2h1uwt9 < t2w1rwt5 && t2h1uwt9 < t2w1lwt5 && t2h1uwt9 < t2h1uwt5 && t2h1uwt9 < t2h1dwt5
  && t2h1uwt9 < t2w1r6 && t2h1uwt9 < t2w1l6 && t2h1uwt9 < t2h1u6 && t2h1uwt9 < t2h1d6 && t2h1uwt9 < t2w1rwt6 && t2h1uwt9 < t2w1lwt6 && t2h1uwt9 < t2h1uwt6 && t2h1uwt9 < t2h1dwt6
  && t2h1uwt9 < t2w1r7 && t2h1uwt9 < t2w1l7 && t2h1uwt9 < t2h1u7 && t2h1uwt9 < t2h1d7 && t2h1uwt9 < t2w1rwt7 && t2h1uwt9 < t2w1lwt7 && t2h1uwt9 < t2h1uwt7 && t2h1uwt9 < t2h1dwt7
  && t2h1uwt9 < t2w1r8 && t2h1uwt9 < t2w1l8 && t2h1uwt9 < t2h1u8 && t2h1uwt9 < t2h1d8 && t2h1uwt9 < t2w1rwt8 && t2h1uwt9 < t2w1lwt8 && t2h1uwt9 < t2h1uwt8 && t2h1uwt9 < t2h1dwt8
  && t2h1uwt9 < t2w1r9 && t2h1uwt9 < t2w1l9 && t2h1uwt9 < t2h1u9 && t2h1uwt9 < t2h1d9 && t2h1uwt9 < t2w1rwt9 && t2h1uwt9 < t2w1lwt9 && t2h1uwt9 < t2h1dwt9
  && t2h1uwt9 < t2w1r10 && t2h1uwt9 < t2w1l10 && t2h1uwt9 < t2h1u10 && t2h1uwt9 < t2h1d10 && t2h1uwt9 < t2w1rwt10 && t2h1uwt9 < t2w1lwt10 && t2h1uwt9 < t2h1uwt10 && t2h1uwt9 < t2h1dwt10
  && (louthu9 !=0 && linhu9!=0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1uwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1uwt9+z))*(z0wr9+(vz*t2h1uwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1uwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1uwt9+z))*(z0wl9+(vz*t2h1uwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1uwt9+x;
  ytest=vy*t2w1lwt9+y;
  ylimitu=bhuwt9*sqrt(1-((vz*t2h1uwt9+z)+z0hu9)*((vz*t2h1uwt9+z)+z0hu9)/a2huwt9);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW9>0 ){
  i=388;
  }else{
  i=396;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW9!=-1 && t2h1uwt9 > 0 && t2h1uwt9 < t1 
  && t2h1uwt9 < t2w1r && t2h1uwt9 < t2w1l && t2h1uwt9 < t2h1u && t2h1uwt9 < t2h1d && t2h1uwt9 < t2w1rwt && t2h1uwt9 < t2w1lwt && t2h1uwt9 < t2h1uwt && t2h1uwt9 < t2h1dwt 
  && t2h1uwt9 < t2w1r1 && t2h1uwt9 < t2w1l1 && t2h1uwt9 < t2h1u1 && t2h1uwt9 < t2h1d1 && t2h1uwt9 < t2w1rwt1 && t2h1uwt9 < t2w1lwt1 && t2h1uwt9 < t2h1uwt1 && t2h1uwt9 < t2h1dwt1
  && t2h1uwt9 < t2w1r2 && t2h1uwt9 < t2w1l2 && t2h1uwt9 < t2h1u2 && t2h1uwt9 < t2h1d2 && t2h1uwt9 < t2w1rwt2 && t2h1uwt9 < t2w1lwt2 && t2h1uwt9 < t2h1uwt2 && t2h1uwt9 < t2h1dwt2
  && t2h1uwt9 < t2w1r3 && t2h1uwt9 < t2w1l3 && t2h1uwt9 < t2h1u3 && t2h1uwt9 < t2h1d3 && t2h1uwt9 < t2w1rwt3 && t2h1uwt9 < t2w1lwt3 && t2h1uwt9 < t2h1uwt3 && t2h1uwt9 < t2h1dwt3
  && t2h1uwt9 < t2w1r4 && t2h1uwt9 < t2w1l4 && t2h1uwt9 < t2h1u4 && t2h1uwt9 < t2h1d4 && t2h1uwt9 < t2w1rwt4 && t2h1uwt9 < t2w1lwt4 && t2h1uwt9 < t2h1uwt4 && t2h1uwt9 < t2h1dwt4
  && t2h1uwt9 < t2w1r5 && t2h1uwt9 < t2w1l5 && t2h1uwt9 < t2h1u5 && t2h1uwt9 < t2h1d5 && t2h1uwt9 < t2w1rwt5 && t2h1uwt9 < t2w1lwt5 && t2h1uwt9 < t2h1uwt5 && t2h1uwt9 < t2h1dwt5
  && t2h1uwt9 < t2w1r6 && t2h1uwt9 < t2w1l6 && t2h1uwt9 < t2h1u6 && t2h1uwt9 < t2h1d6 && t2h1uwt9 < t2w1rwt6 && t2h1uwt9 < t2w1lwt6 && t2h1uwt9 < t2h1uwt6 && t2h1uwt9 < t2h1dwt6
  && t2h1uwt9 < t2w1r7 && t2h1uwt9 < t2w1l7 && t2h1uwt9 < t2h1u7 && t2h1uwt9 < t2h1d7 && t2h1uwt9 < t2w1rwt7 && t2h1uwt9 < t2w1lwt7 && t2h1uwt9 < t2h1uwt7 && t2h1uwt9 < t2h1dwt7
  && t2h1uwt9 < t2w1r8 && t2h1uwt9 < t2w1l8 && t2h1uwt9 < t2h1u8 && t2h1uwt9 < t2h1d8 && t2h1uwt9 < t2w1rwt8 && t2h1uwt9 < t2w1lwt8 && t2h1uwt9 < t2h1uwt8 && t2h1uwt9 < t2h1dwt8
  && t2h1uwt9 < t2w1r9 && t2h1uwt9 < t2w1l9 && t2h1uwt9 < t2h1u9 && t2h1uwt9 < t2h1d9 && t2h1uwt9 < t2w1rwt9 && t2h1uwt9 < t2w1lwt9 && t2h1uwt9 < t2h1dwt9
  && t2h1uwt9 < t2w1r10 && t2h1uwt9 < t2w1l10 && t2h1uwt9 < t2h1u10 && t2h1uwt9 < t2h1d10 && t2h1uwt9 < t2w1rwt10 && t2h1uwt9 < t2w1lwt10 && t2h1uwt9 < t2h1uwt10 && t2h1uwt9 < t2h1dwt10
  && ((louthu9!=0 && linhu9==0) || (louthu9==0 && linhu9!=0))){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1uwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1uwt9+z))*(z0wr9+(vz*t2h1uwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1uwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1uwt9+z))*(z0wl9+(vz*t2h1uwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1uwt9+x;
  ytest=vy*t2w1lwt9+y;
  ylimitu=sqrt((pbhuwt9-(vz*t2h1uwt9+z))/pahuwt9);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW9>0){
  i=389;
  }else{
  i=396;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW9!=-1 && t2h1uwt9 > 0 && t2h1uwt9 < t1 
  && t2h1uwt9 < t2w1r && t2h1uwt9 < t2w1l && t2h1uwt9 < t2h1u && t2h1uwt9 < t2h1d && t2h1uwt9 < t2w1rwt && t2h1uwt9 < t2w1lwt && t2h1uwt9 < t2h1uwt && t2h1uwt9 < t2h1dwt 
  && t2h1uwt9 < t2w1r1 && t2h1uwt9 < t2w1l1 && t2h1uwt9 < t2h1u1 && t2h1uwt9 < t2h1d1 && t2h1uwt9 < t2w1rwt1 && t2h1uwt9 < t2w1lwt1 && t2h1uwt9 < t2h1uwt1 && t2h1uwt9 < t2h1dwt1
  && t2h1uwt9 < t2w1r2 && t2h1uwt9 < t2w1l2 && t2h1uwt9 < t2h1u2 && t2h1uwt9 < t2h1d2 && t2h1uwt9 < t2w1rwt2 && t2h1uwt9 < t2w1lwt2 && t2h1uwt9 < t2h1uwt2 && t2h1uwt9 < t2h1dwt2
  && t2h1uwt9 < t2w1r3 && t2h1uwt9 < t2w1l3 && t2h1uwt9 < t2h1u3 && t2h1uwt9 < t2h1d3 && t2h1uwt9 < t2w1rwt3 && t2h1uwt9 < t2w1lwt3 && t2h1uwt9 < t2h1uwt3 && t2h1uwt9 < t2h1dwt3
  && t2h1uwt9 < t2w1r4 && t2h1uwt9 < t2w1l4 && t2h1uwt9 < t2h1u4 && t2h1uwt9 < t2h1d4 && t2h1uwt9 < t2w1rwt4 && t2h1uwt9 < t2w1lwt4 && t2h1uwt9 < t2h1uwt4 && t2h1uwt9 < t2h1dwt4
  && t2h1uwt9 < t2w1r5 && t2h1uwt9 < t2w1l5 && t2h1uwt9 < t2h1u5 && t2h1uwt9 < t2h1d5 && t2h1uwt9 < t2w1rwt5 && t2h1uwt9 < t2w1lwt5 && t2h1uwt9 < t2h1uwt5 && t2h1uwt9 < t2h1dwt5
  && t2h1uwt9 < t2w1r6 && t2h1uwt9 < t2w1l6 && t2h1uwt9 < t2h1u6 && t2h1uwt9 < t2h1d6 && t2h1uwt9 < t2w1rwt6 && t2h1uwt9 < t2w1lwt6 && t2h1uwt9 < t2h1uwt6 && t2h1uwt9 < t2h1dwt6
  && t2h1uwt9 < t2w1r7 && t2h1uwt9 < t2w1l7 && t2h1uwt9 < t2h1u7 && t2h1uwt9 < t2h1d7 && t2h1uwt9 < t2w1rwt7 && t2h1uwt9 < t2w1lwt7 && t2h1uwt9 < t2h1uwt7 && t2h1uwt9 < t2h1dwt7
  && t2h1uwt9 < t2w1r8 && t2h1uwt9 < t2w1l8 && t2h1uwt9 < t2h1u8 && t2h1uwt9 < t2h1d8 && t2h1uwt9 < t2w1rwt8 && t2h1uwt9 < t2w1lwt8 && t2h1uwt9 < t2h1uwt8 && t2h1uwt9 < t2h1dwt8
  && t2h1uwt9 < t2w1r9 && t2h1uwt9 < t2w1l9 && t2h1uwt9 < t2h1u9 && t2h1uwt9 < t2h1d9 && t2h1uwt9 < t2w1rwt9 && t2h1uwt9 < t2w1lwt9 && t2h1uwt9 < t2h1dwt9
  && t2h1uwt9 < t2w1r10 && t2h1uwt9 < t2w1l10 && t2h1uwt9 < t2h1u10 && t2h1uwt9 < t2h1d10 && t2h1uwt9 < t2w1rwt10 && t2h1uwt9 < t2w1lwt10 && t2h1uwt9 < t2h1uwt10 && t2h1uwt9 < t2h1dwt10
  && (louthu9 == 0 && linhu9 == 0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1uwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1uwt9+z))*(z0wr9+(vz*t2h1uwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1uwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1uwt9+z))*(z0wl9+(vz*t2h1uwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1uwt9+x;
  ytest=vy*t2w1lwt9+y;
  ylimitu=(h2u9-h1u9)*(vz*t2h1uwt9+z)/l+h1uwt9;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW9>0 ){
  i=390;
  }else{
  i=396;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW9!=-1 && t2h1dwt9 > 0 && t2h1dwt9 < t1 
  && t2h1dwt9 < t2w1r && t2h1dwt9 < t2w1l && t2h1dwt9 < t2h1u && t2h1dwt9 < t2h1d && t2h1dwt9 < t2w1rwt && t2h1dwt9 < t2w1lwt && t2h1dwt9 < t2h1uwt && t2h1dwt9 < t2h1dwt 
  && t2h1dwt9 < t2w1r1 && t2h1dwt9 < t2w1l1 && t2h1dwt9 < t2h1u1 && t2h1dwt9 < t2h1d1 && t2h1dwt9 < t2w1rwt1 && t2h1dwt9 < t2w1lwt1 && t2h1dwt9 < t2h1uwt1 && t2h1dwt9 < t2h1dwt1
  && t2h1dwt9 < t2w1r2 && t2h1dwt9 < t2w1l2 && t2h1dwt9 < t2h1u2 && t2h1dwt9 < t2h1d2 && t2h1dwt9 < t2w1rwt2 && t2h1dwt9 < t2w1lwt2 && t2h1dwt9 < t2h1uwt2 && t2h1dwt9 < t2h1dwt2 
  && t2h1dwt9 < t2w1r3 && t2h1dwt9 < t2w1l3 && t2h1dwt9 < t2h1u3 && t2h1dwt9 < t2h1d3 && t2h1dwt9 < t2w1rwt3 && t2h1dwt9 < t2w1lwt3 && t2h1dwt9 < t2h1uwt3 && t2h1dwt9 < t2h1dwt3
  && t2h1dwt9 < t2w1r4 && t2h1dwt9 < t2w1l4 && t2h1dwt9 < t2h1u4 && t2h1dwt9 < t2h1d4 && t2h1dwt9 < t2w1rwt4 && t2h1dwt9 < t2w1lwt4 && t2h1dwt9 < t2h1uwt4 && t2h1dwt9 < t2h1dwt4
  && t2h1dwt9 < t2w1r5 && t2h1dwt9 < t2w1l5 && t2h1dwt9 < t2h1u5 && t2h1dwt9 < t2h1d5 && t2h1dwt9 < t2w1rwt5 && t2h1dwt9 < t2w1lwt5 && t2h1dwt9 < t2h1uwt5 && t2h1dwt9 < t2h1dwt5
  && t2h1dwt9 < t2w1r6 && t2h1dwt9 < t2w1l6 && t2h1dwt9 < t2h1u6 && t2h1dwt9 < t2h1d6 && t2h1dwt9 < t2w1rwt6 && t2h1dwt9 < t2w1lwt6 && t2h1dwt9 < t2h1uwt6 && t2h1dwt9 < t2h1dwt6
  && t2h1dwt9 < t2w1r7 && t2h1dwt9 < t2w1l7 && t2h1dwt9 < t2h1u7 && t2h1dwt9 < t2h1d7 && t2h1dwt9 < t2w1rwt7 && t2h1dwt9 < t2w1lwt7 && t2h1dwt9 < t2h1uwt7 && t2h1dwt9 < t2h1dwt7 
  && t2h1dwt9 < t2w1r8 && t2h1dwt9 < t2w1l8 && t2h1dwt9 < t2h1u8 && t2h1dwt9 < t2h1d8 && t2h1dwt9 < t2w1rwt8 && t2h1dwt9 < t2w1lwt8 && t2h1dwt9 < t2h1uwt8 && t2h1dwt9 < t2h1dwt8
  && t2h1dwt9 < t2w1r9 && t2h1dwt9 < t2w1l9 && t2h1dwt9 < t2h1u9 && t2h1dwt9 < t2h1d9 && t2h1dwt9 < t2w1rwt9 && t2h1dwt9 < t2w1lwt9 && t2h1dwt9 < t2h1uwt9 
  && t2h1dwt9 < t2w1r10 && t2h1dwt9 < t2w1l10 && t2h1dwt9 < t2h1u10 && t2h1dwt9 < t2h1d10 && t2h1dwt9 < t2w1rwt10 && t2h1dwt9 < t2w1lwt10 && t2h1dwt9 < t2h1uwt10 && t2h1dwt9 < t2h1dwt10  
  && (louthd9 !=0 && linhd9!=0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1dwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1dwt9+z))*(z0wr9+(vz*t2h1dwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1dwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1dwt9+z))*(z0wl9+(vz*t2h1dwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1dwt9+x;
  ytest=vy*t2w1lwt9+y;
  ylimitd=-bhdwt9*sqrt(1-((vz*t2h1dwt9+z)+z0hd9)*((vz*t2h1dwt9+z)+z0hd9)/a2hdwt9);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW9>0){
  i=391;
  }else{
  i=397;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW9!=-1 && t2h1dwt9 > 0 && t2h1dwt9 < t1 
  && t2h1dwt9 < t2w1r && t2h1dwt9 < t2w1l && t2h1dwt9 < t2h1u && t2h1dwt9 < t2h1d && t2h1dwt9 < t2w1rwt && t2h1dwt9 < t2w1lwt && t2h1dwt9 < t2h1uwt && t2h1dwt9 < t2h1dwt 
  && t2h1dwt9 < t2w1r1 && t2h1dwt9 < t2w1l1 && t2h1dwt9 < t2h1u1 && t2h1dwt9 < t2h1d1 && t2h1dwt9 < t2w1rwt1 && t2h1dwt9 < t2w1lwt1 && t2h1dwt9 < t2h1uwt1 && t2h1dwt9 < t2h1dwt1
  && t2h1dwt9 < t2w1r2 && t2h1dwt9 < t2w1l2 && t2h1dwt9 < t2h1u2 && t2h1dwt9 < t2h1d2 && t2h1dwt9 < t2w1rwt2 && t2h1dwt9 < t2w1lwt2 && t2h1dwt9 < t2h1uwt2 && t2h1dwt9 < t2h1dwt2 
  && t2h1dwt9 < t2w1r3 && t2h1dwt9 < t2w1l3 && t2h1dwt9 < t2h1u3 && t2h1dwt9 < t2h1d3 && t2h1dwt9 < t2w1rwt3 && t2h1dwt9 < t2w1lwt3 && t2h1dwt9 < t2h1uwt3 && t2h1dwt9 < t2h1dwt3
  && t2h1dwt9 < t2w1r4 && t2h1dwt9 < t2w1l4 && t2h1dwt9 < t2h1u4 && t2h1dwt9 < t2h1d4 && t2h1dwt9 < t2w1rwt4 && t2h1dwt9 < t2w1lwt4 && t2h1dwt9 < t2h1uwt4 && t2h1dwt9 < t2h1dwt4
  && t2h1dwt9 < t2w1r5 && t2h1dwt9 < t2w1l5 && t2h1dwt9 < t2h1u5 && t2h1dwt9 < t2h1d5 && t2h1dwt9 < t2w1rwt5 && t2h1dwt9 < t2w1lwt5 && t2h1dwt9 < t2h1uwt5 && t2h1dwt9 < t2h1dwt5
  && t2h1dwt9 < t2w1r6 && t2h1dwt9 < t2w1l6 && t2h1dwt9 < t2h1u6 && t2h1dwt9 < t2h1d6 && t2h1dwt9 < t2w1rwt6 && t2h1dwt9 < t2w1lwt6 && t2h1dwt9 < t2h1uwt6 && t2h1dwt9 < t2h1dwt6
  && t2h1dwt9 < t2w1r7 && t2h1dwt9 < t2w1l7 && t2h1dwt9 < t2h1u7 && t2h1dwt9 < t2h1d7 && t2h1dwt9 < t2w1rwt7 && t2h1dwt9 < t2w1lwt7 && t2h1dwt9 < t2h1uwt7 && t2h1dwt9 < t2h1dwt7 
  && t2h1dwt9 < t2w1r8 && t2h1dwt9 < t2w1l8 && t2h1dwt9 < t2h1u8 && t2h1dwt9 < t2h1d8 && t2h1dwt9 < t2w1rwt8 && t2h1dwt9 < t2w1lwt8 && t2h1dwt9 < t2h1uwt8 && t2h1dwt9 < t2h1dwt8
  && t2h1dwt9 < t2w1r9 && t2h1dwt9 < t2w1l9 && t2h1dwt9 < t2h1u9 && t2h1dwt9 < t2h1d9 && t2h1dwt9 < t2w1rwt9 && t2h1dwt9 < t2w1lwt9 && t2h1dwt9 < t2h1uwt9 
  && t2h1dwt9 < t2w1r10 && t2h1dwt9 < t2w1l10 && t2h1dwt9 < t2h1u10 && t2h1dwt9 < t2h1d10 && t2h1dwt9 < t2w1rwt10 && t2h1dwt9 < t2w1lwt10 && t2h1dwt9 < t2h1uwt10 && t2h1dwt9 < t2h1dwt10
  && ((louthd9 !=0 && linhd9==0) || (louthd9 ==0 && linhd9!=0))){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1dwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1dwt9+z))*(z0wr9+(vz*t2h1dwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
     xlimitl=(w2l9-w1l9)/l*(vz*t2h1dwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1dwt9+z))*(z0wl9+(vz*t2h1dwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1dwt9+x;
  ytest=vy*t2w1lwt9+y;
  ylimitd=-sqrt((pbhdwt9-(vz*t2h1dwt9+z))/pahdwt9);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW9>0 ){
  i=392;
  }else{
  i=397;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW9!=-1 && t2h1dwt9 > 0 && t2h1dwt9 < t1 
  && t2h1dwt9 < t2w1r && t2h1dwt9 < t2w1l && t2h1dwt9 < t2h1u && t2h1dwt9 < t2h1d && t2h1dwt9 < t2w1rwt && t2h1dwt9 < t2w1lwt && t2h1dwt9 < t2h1uwt && t2h1dwt9 < t2h1dwt 
  && t2h1dwt9 < t2w1r1 && t2h1dwt9 < t2w1l1 && t2h1dwt9 < t2h1u1 && t2h1dwt9 < t2h1d1 && t2h1dwt9 < t2w1rwt1 && t2h1dwt9 < t2w1lwt1 && t2h1dwt9 < t2h1uwt1 && t2h1dwt9 < t2h1dwt1
  && t2h1dwt9 < t2w1r2 && t2h1dwt9 < t2w1l2 && t2h1dwt9 < t2h1u2 && t2h1dwt9 < t2h1d2 && t2h1dwt9 < t2w1rwt2 && t2h1dwt9 < t2w1lwt2 && t2h1dwt9 < t2h1uwt2 && t2h1dwt9 < t2h1dwt2 
  && t2h1dwt9 < t2w1r3 && t2h1dwt9 < t2w1l3 && t2h1dwt9 < t2h1u3 && t2h1dwt9 < t2h1d3 && t2h1dwt9 < t2w1rwt3 && t2h1dwt9 < t2w1lwt3 && t2h1dwt9 < t2h1uwt3 && t2h1dwt9 < t2h1dwt3
  && t2h1dwt9 < t2w1r4 && t2h1dwt9 < t2w1l4 && t2h1dwt9 < t2h1u4 && t2h1dwt9 < t2h1d4 && t2h1dwt9 < t2w1rwt4 && t2h1dwt9 < t2w1lwt4 && t2h1dwt9 < t2h1uwt4 && t2h1dwt9 < t2h1dwt4
  && t2h1dwt9 < t2w1r5 && t2h1dwt9 < t2w1l5 && t2h1dwt9 < t2h1u5 && t2h1dwt9 < t2h1d5 && t2h1dwt9 < t2w1rwt5 && t2h1dwt9 < t2w1lwt5 && t2h1dwt9 < t2h1uwt5 && t2h1dwt9 < t2h1dwt5
  && t2h1dwt9 < t2w1r6 && t2h1dwt9 < t2w1l6 && t2h1dwt9 < t2h1u6 && t2h1dwt9 < t2h1d6 && t2h1dwt9 < t2w1rwt6 && t2h1dwt9 < t2w1lwt6 && t2h1dwt9 < t2h1uwt6 && t2h1dwt9 < t2h1dwt6
  && t2h1dwt9 < t2w1r7 && t2h1dwt9 < t2w1l7 && t2h1dwt9 < t2h1u7 && t2h1dwt9 < t2h1d7 && t2h1dwt9 < t2w1rwt7 && t2h1dwt9 < t2w1lwt7 && t2h1dwt9 < t2h1uwt7 && t2h1dwt9 < t2h1dwt7 
  && t2h1dwt9 < t2w1r8 && t2h1dwt9 < t2w1l8 && t2h1dwt9 < t2h1u8 && t2h1dwt9 < t2h1d8 && t2h1dwt9 < t2w1rwt8 && t2h1dwt9 < t2w1lwt8 && t2h1dwt9 < t2h1uwt8 && t2h1dwt9 < t2h1dwt8
  && t2h1dwt9 < t2w1r9 && t2h1dwt9 < t2w1l9 && t2h1dwt9 < t2h1u9 && t2h1dwt9 < t2h1d9 && t2h1dwt9 < t2w1rwt9 && t2h1dwt9 < t2w1lwt9 && t2h1dwt9 < t2h1uwt9 
  && t2h1dwt9 < t2w1r10 && t2h1dwt9 < t2w1l10 && t2h1dwt9 < t2h1u10 && t2h1dwt9 < t2h1d10 && t2h1dwt9 < t2w1rwt10 && t2h1dwt9 < t2w1lwt10 && t2h1dwt9 < t2h1uwt10 && t2h1dwt9 < t2h1dwt10
  && (louthd9 == 0 && linhd9 == 0)){
  if(linwr9==0 && loutwr9==0)
  {
    xlimitr=(-w2r9+w1r9)/l*(vz*t2h1dwt9+z)-w1rwt9;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xlimitr=-bwrwt9*sqrt(1-((z0wr9+(vz*t2h1dwt9+z))*(z0wr9+(vz*t2h1dwt9+z)))/a2wrwt9);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt9+z)-pbwrwt9)/-pawrwt9);
    }
  }
  if(linwl9==0 && loutwl9 == 0)
   {
      xlimitl=(w2l9-w1l9)/l*(vz*t2h1dwt9+z)+w1lwt9;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xlimitl=bwlwt9*sqrt(1-((z0wl9+(vz*t2h1dwt9+z))*(z0wl9+(vz*t2h1dwt9+z)))/a2wlwt9);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt9+z)-pbwlwt9)/-pawlwt9);
      }
   }
  xtest=vx*t2h1dwt9+x;
  ytest=vy*t2w1lwt9+y;
  ylimitd=(-h2d9+h1d9)*(vz*t2h1dwt9+z)/l-h1dwt9;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW9>0 ){
  i=393;
  }else{
  i=397;
  }
  }


  if (mxrOW9==-1 && t2w1rwt9 > 0 && t2w1rwt9 < t1 
  && t2w1rwt9 < t2w1r && t2w1rwt9 < t2w1l && t2w1rwt9 < t2h1u && t2w1rwt9 < t2h1d && t2w1rwt9 <t2w1rwt && t2w1rwt9 <t2w1lwt && t2w1rwt9 < t2h1uwt && t2w1rwt9 < t2h1dwt
  && t2w1rwt9 < t2w1r1 && t2w1rwt9 < t2w1l1 && t2w1rwt9 < t2h1u1 && t2w1rwt9 < t2h1d1 && t2w1rwt9 <t2w1rwt1 && t2w1rwt9 <t2w1lwt1 && t2w1rwt9 < t2h1uwt1 && t2w1rwt9 < t2h1dwt1
  && t2w1rwt9 < t2w1r2 && t2w1rwt9 < t2w1l2 && t2w1rwt9 < t2h1u2 && t2w1rwt9 < t2h1d2 && t2w1rwt9 <t2w1rwt2 && t2w1rwt9 <t2w1lwt2 && t2w1rwt9 < t2h1uwt2 && t2w1rwt9 < t2h1dwt2
  && t2w1rwt9 < t2w1r3 && t2w1rwt9 < t2w1l3 && t2w1rwt9 < t2h1u3 && t2w1rwt9 < t2h1d3 && t2w1rwt9 <t2w1rwt3 && t2w1rwt9 <t2w1lwt3 && t2w1rwt9 < t2h1uwt3 && t2w1rwt9 < t2h1dwt3
  && t2w1rwt9 < t2w1r4 && t2w1rwt9 < t2w1l4 && t2w1rwt9 < t2h1u4 && t2w1rwt9 < t2h1d4 && t2w1rwt9 <t2w1rwt4 && t2w1rwt9 <t2w1lwt4 && t2w1rwt9 < t2h1uwt4 && t2w1rwt9 < t2h1dwt4
  && t2w1rwt9 < t2w1r5 && t2w1rwt9 < t2w1l5 && t2w1rwt9 < t2h1u5 && t2w1rwt9 < t2h1d5 && t2w1rwt9 <t2w1rwt5 && t2w1rwt9 <t2w1lwt5 && t2w1rwt9 < t2h1uwt5 && t2w1rwt9 < t2h1dwt5
  && t2w1rwt9 < t2w1r6 && t2w1rwt9 < t2w1l6 && t2w1rwt9 < t2h1u6 && t2w1rwt9 < t2h1d6 && t2w1rwt9 <t2w1rwt6 && t2w1rwt9 <t2w1lwt6 && t2w1rwt9 < t2h1uwt6 && t2w1rwt9 < t2h1dwt6
  && t2w1rwt9 < t2w1r7 && t2w1rwt9 < t2w1l7 && t2w1rwt9 < t2h1u7 && t2w1rwt9 < t2h1d7 && t2w1rwt9 <t2w1rwt7 && t2w1rwt9 <t2w1lwt7 && t2w1rwt9 < t2h1uwt7 && t2w1rwt9 < t2h1dwt7
  && t2w1rwt9 < t2w1r8 && t2w1rwt9 < t2w1l8 && t2w1rwt9 < t2h1u8 && t2w1rwt9 < t2h1d8 && t2w1rwt9 <t2w1rwt8 && t2w1rwt9 <t2w1lwt8 && t2w1rwt9 < t2h1uwt8 && t2w1rwt9 < t2h1dwt8
  && t2w1rwt9 < t2w1r9 && t2w1rwt9 < t2w1l9 && t2w1rwt9 < t2h1u9 && t2w1rwt9 < t2h1d9 && t2w1rwt9 <t2w1lwt9 && t2w1rwt9 < t2h1uwt9 && t2w1rwt9 < t2h1dwt9
  && t2w1rwt9 < t2w1r10 && t2w1rwt9 < t2w1l10 && t2w1rwt9 < t2h1u10 && t2w1rwt9 < t2h1d10 && t2w1rwt9 <t2w1rwt10 && t2w1rwt9 <t2w1lwt10 && t2w1rwt9 < t2h1uwt10 && t2w1rwt9 < t2h1dwt10
  && ((linwr9!=0) && (loutwr9!=0) )){
  i=398;
  }

  if (mxrOW9==-1 && t2w1rwt9 > 0 && t2w1rwt9 < t1 
  && t2w1rwt9 < t2w1r && t2w1rwt9 < t2w1l && t2w1rwt9 < t2h1u && t2w1rwt9 < t2h1d && t2w1rwt9 <t2w1rwt && t2w1rwt9 <t2w1lwt && t2w1rwt9 < t2h1uwt && t2w1rwt9 < t2h1dwt
  && t2w1rwt9 < t2w1r1 && t2w1rwt9 < t2w1l1 && t2w1rwt9 < t2h1u1 && t2w1rwt9 < t2h1d1 && t2w1rwt9 <t2w1rwt1 && t2w1rwt9 <t2w1lwt1 && t2w1rwt9 < t2h1uwt1 && t2w1rwt9 < t2h1dwt1
  && t2w1rwt9 < t2w1r2 && t2w1rwt9 < t2w1l2 && t2w1rwt9 < t2h1u2 && t2w1rwt9 < t2h1d2 && t2w1rwt9 <t2w1rwt2 && t2w1rwt9 <t2w1lwt2 && t2w1rwt9 < t2h1uwt2 && t2w1rwt9 < t2h1dwt2
  && t2w1rwt9 < t2w1r3 && t2w1rwt9 < t2w1l3 && t2w1rwt9 < t2h1u3 && t2w1rwt9 < t2h1d3 && t2w1rwt9 <t2w1rwt3 && t2w1rwt9 <t2w1lwt3 && t2w1rwt9 < t2h1uwt3 && t2w1rwt9 < t2h1dwt3
  && t2w1rwt9 < t2w1r4 && t2w1rwt9 < t2w1l4 && t2w1rwt9 < t2h1u4 && t2w1rwt9 < t2h1d4 && t2w1rwt9 <t2w1rwt4 && t2w1rwt9 <t2w1lwt4 && t2w1rwt9 < t2h1uwt4 && t2w1rwt9 < t2h1dwt4
  && t2w1rwt9 < t2w1r5 && t2w1rwt9 < t2w1l5 && t2w1rwt9 < t2h1u5 && t2w1rwt9 < t2h1d5 && t2w1rwt9 <t2w1rwt5 && t2w1rwt9 <t2w1lwt5 && t2w1rwt9 < t2h1uwt5 && t2w1rwt9 < t2h1dwt5
  && t2w1rwt9 < t2w1r6 && t2w1rwt9 < t2w1l6 && t2w1rwt9 < t2h1u6 && t2w1rwt9 < t2h1d6 && t2w1rwt9 <t2w1rwt6 && t2w1rwt9 <t2w1lwt6 && t2w1rwt9 < t2h1uwt6 && t2w1rwt9 < t2h1dwt6
  && t2w1rwt9 < t2w1r7 && t2w1rwt9 < t2w1l7 && t2w1rwt9 < t2h1u7 && t2w1rwt9 < t2h1d7 && t2w1rwt9 <t2w1rwt7 && t2w1rwt9 <t2w1lwt7 && t2w1rwt9 < t2h1uwt7 && t2w1rwt9 < t2h1dwt7
  && t2w1rwt9 < t2w1r8 && t2w1rwt9 < t2w1l8 && t2w1rwt9 < t2h1u8 && t2w1rwt9 < t2h1d8 && t2w1rwt9 <t2w1rwt8 && t2w1rwt9 <t2w1lwt8 && t2w1rwt9 < t2h1uwt8 && t2w1rwt9 < t2h1dwt8
  && t2w1rwt9 < t2w1r9 && t2w1rwt9 < t2w1l9 && t2w1rwt9 < t2h1u9 && t2w1rwt9 < t2h1d9 && t2w1rwt9 <t2w1lwt9 && t2w1rwt9 < t2h1uwt9 && t2w1rwt9 < t2h1dwt9
  && t2w1rwt9 < t2w1r10 && t2w1rwt9 < t2w1l10 && t2w1rwt9 < t2h1u10 && t2w1rwt9 < t2h1d10 && t2w1rwt9 <t2w1rwt10 && t2w1rwt9 <t2w1lwt10 && t2w1rwt9 < t2h1uwt10 && t2w1rwt9 < t2h1dwt10
  && ((loutwr9!=0 && linwr9==0) || (loutwr9==0 && linwr9!=0))){
  i=398;
  }

  if (mxrOW9==-1 && t2w1rwt9 > 0 && t2w1rwt9 < t1 
  && t2w1rwt9 < t2w1r && t2w1rwt9 < t2w1l && t2w1rwt9 < t2h1u && t2w1rwt9 < t2h1d && t2w1rwt9 <t2w1rwt && t2w1rwt9 <t2w1lwt && t2w1rwt9 < t2h1uwt && t2w1rwt9 < t2h1dwt
  && t2w1rwt9 < t2w1r1 && t2w1rwt9 < t2w1l1 && t2w1rwt9 < t2h1u1 && t2w1rwt9 < t2h1d1 && t2w1rwt9 <t2w1rwt1 && t2w1rwt9 <t2w1lwt1 && t2w1rwt9 < t2h1uwt1 && t2w1rwt9 < t2h1dwt1
  && t2w1rwt9 < t2w1r2 && t2w1rwt9 < t2w1l2 && t2w1rwt9 < t2h1u2 && t2w1rwt9 < t2h1d2 && t2w1rwt9 <t2w1rwt2 && t2w1rwt9 <t2w1lwt2 && t2w1rwt9 < t2h1uwt2 && t2w1rwt9 < t2h1dwt2
  && t2w1rwt9 < t2w1r3 && t2w1rwt9 < t2w1l3 && t2w1rwt9 < t2h1u3 && t2w1rwt9 < t2h1d3 && t2w1rwt9 <t2w1rwt3 && t2w1rwt9 <t2w1lwt3 && t2w1rwt9 < t2h1uwt3 && t2w1rwt9 < t2h1dwt3
  && t2w1rwt9 < t2w1r4 && t2w1rwt9 < t2w1l4 && t2w1rwt9 < t2h1u4 && t2w1rwt9 < t2h1d4 && t2w1rwt9 <t2w1rwt4 && t2w1rwt9 <t2w1lwt4 && t2w1rwt9 < t2h1uwt4 && t2w1rwt9 < t2h1dwt4
  && t2w1rwt9 < t2w1r5 && t2w1rwt9 < t2w1l5 && t2w1rwt9 < t2h1u5 && t2w1rwt9 < t2h1d5 && t2w1rwt9 <t2w1rwt5 && t2w1rwt9 <t2w1lwt5 && t2w1rwt9 < t2h1uwt5 && t2w1rwt9 < t2h1dwt5
  && t2w1rwt9 < t2w1r6 && t2w1rwt9 < t2w1l6 && t2w1rwt9 < t2h1u6 && t2w1rwt9 < t2h1d6 && t2w1rwt9 <t2w1rwt6 && t2w1rwt9 <t2w1lwt6 && t2w1rwt9 < t2h1uwt6 && t2w1rwt9 < t2h1dwt6
  && t2w1rwt9 < t2w1r7 && t2w1rwt9 < t2w1l7 && t2w1rwt9 < t2h1u7 && t2w1rwt9 < t2h1d7 && t2w1rwt9 <t2w1rwt7 && t2w1rwt9 <t2w1lwt7 && t2w1rwt9 < t2h1uwt7 && t2w1rwt9 < t2h1dwt7
  && t2w1rwt9 < t2w1r8 && t2w1rwt9 < t2w1l8 && t2w1rwt9 < t2h1u8 && t2w1rwt9 < t2h1d8 && t2w1rwt9 <t2w1rwt8 && t2w1rwt9 <t2w1lwt8 && t2w1rwt9 < t2h1uwt8 && t2w1rwt9 < t2h1dwt8
  && t2w1rwt9 < t2w1r9 && t2w1rwt9 < t2w1l9 && t2w1rwt9 < t2h1u9 && t2w1rwt9 < t2h1d9 && t2w1rwt9 <t2w1lwt9 && t2w1rwt9 < t2h1uwt9 && t2w1rwt9 < t2h1dwt9
  && t2w1rwt9 < t2w1r10 && t2w1rwt9 < t2w1l10 && t2w1rwt9 < t2h1u10 && t2w1rwt9 < t2h1d10 && t2w1rwt9 <t2w1rwt10 && t2w1rwt9 <t2w1lwt10 && t2w1rwt9 < t2h1uwt10 && t2w1rwt9 < t2h1dwt10
  && (loutwr9==0 && linwr9==0)){
  i=398;
  }

  if (mxlOW9==-1 && t2w1lwt9 > 0 && t2w1lwt9 < t1 
  && t2w1lwt9 < t2w1r && t2w1lwt9 < t2w1l && t2w1lwt9 < t2h1u && t2w1lwt9 < t2h1d && t2w1lwt9 <t2w1rwt && t2w1lwt9 <t2w1lwt && t2w1lwt9 < t2h1uwt && t2w1lwt9 < t2h1dwt
  && t2w1lwt9 < t2w1r1 && t2w1lwt9 < t2w1l1 && t2w1lwt9 < t2h1u1 && t2w1lwt9 < t2h1d1 && t2w1lwt9 <t2w1rwt1 && t2w1lwt9 <t2w1lwt1 && t2w1lwt9 < t2h1uwt1 && t2w1lwt9 < t2h1dwt1
  && t2w1lwt9 < t2w1r2 && t2w1lwt9 < t2w1l2 && t2w1lwt9 < t2h1u2 && t2w1lwt9 < t2h1d2 && t2w1lwt9 <t2w1rwt2 && t2w1lwt9 <t2w1lwt2 && t2w1lwt9 < t2h1uwt2 && t2w1lwt9 < t2h1dwt2
  && t2w1lwt9 < t2w1r3 && t2w1lwt9 < t2w1l3 && t2w1lwt9 < t2h1u3 && t2w1lwt9 < t2h1d3 && t2w1lwt9 <t2w1rwt3 && t2w1lwt9 <t2w1lwt3 && t2w1lwt9 < t2h1uwt3 && t2w1lwt9 < t2h1dwt3
  && t2w1lwt9 < t2w1r4 && t2w1lwt9 < t2w1l4 && t2w1lwt9 < t2h1u4 && t2w1lwt9 < t2h1d4 && t2w1lwt9 <t2w1rwt4 && t2w1lwt9 <t2w1lwt4 && t2w1lwt9 < t2h1uwt4 && t2w1lwt9 < t2h1dwt4
  && t2w1lwt9 < t2w1r5 && t2w1lwt9 < t2w1l5 && t2w1lwt9 < t2h1u5 && t2w1lwt9 < t2h1d5 && t2w1lwt9 <t2w1rwt5 && t2w1lwt9 <t2w1lwt5 && t2w1lwt9 < t2h1uwt5 && t2w1lwt9 < t2h1dwt5
  && t2w1lwt9 < t2w1r6 && t2w1lwt9 < t2w1l6 && t2w1lwt9 < t2h1u6 && t2w1lwt9 < t2h1d6 && t2w1lwt9 <t2w1rwt6 && t2w1lwt9 <t2w1lwt6 && t2w1lwt9 < t2h1uwt6 && t2w1lwt9 < t2h1dwt6
  && t2w1lwt9 < t2w1r7 && t2w1lwt9 < t2w1l7 && t2w1lwt9 < t2h1u7 && t2w1lwt9 < t2h1d7 && t2w1lwt9 <t2w1rwt7 && t2w1lwt9 <t2w1lwt7 && t2w1lwt9 < t2h1uwt7 && t2w1lwt9 < t2h1dwt7
  && t2w1lwt9 < t2w1r8 && t2w1lwt9 < t2w1l8 && t2w1lwt9 < t2h1u8 && t2w1lwt9 < t2h1d8 && t2w1lwt9 <t2w1rwt8 && t2w1lwt9 <t2w1lwt8 && t2w1lwt9 < t2h1uwt8 && t2w1lwt9 < t2h1dwt8
  && t2w1lwt9 < t2w1r9 && t2w1lwt9 < t2w1l9 && t2w1lwt9 < t2h1u9 && t2w1lwt9 < t2h1d9 && t2w1lwt9 <t2w1rwt9 && t2w1lwt9 < t2h1uwt9 && t2w1lwt9 < t2h1dwt9
  && t2w1lwt9 < t2w1r10 && t2w1lwt9 < t2w1l10 && t2w1lwt9 < t2h1u10 && t2w1lwt9 < t2h1d10 && t2w1lwt9 <t2w1rwt10 && t2w1lwt9 <t2w1lwt10 && t2w1lwt9 < t2h1uwt10 && t2w1lwt9 < t2h1dwt10
  && ((linwl9!=0) && (loutwl9!=0) )){
  i=399;
  }

  if (mxlOW9==-1 && t2w1lwt9 > 0 && t2w1lwt9 < t1 
  && t2w1lwt9 < t2w1r && t2w1lwt9 < t2w1l && t2w1lwt9 < t2h1u && t2w1lwt9 < t2h1d && t2w1lwt9 <t2w1rwt && t2w1lwt9 <t2w1lwt && t2w1lwt9 < t2h1uwt && t2w1lwt9 < t2h1dwt
  && t2w1lwt9 < t2w1r1 && t2w1lwt9 < t2w1l1 && t2w1lwt9 < t2h1u1 && t2w1lwt9 < t2h1d1 && t2w1lwt9 <t2w1rwt1 && t2w1lwt9 <t2w1lwt1 && t2w1lwt9 < t2h1uwt1 && t2w1lwt9 < t2h1dwt1
  && t2w1lwt9 < t2w1r2 && t2w1lwt9 < t2w1l2 && t2w1lwt9 < t2h1u2 && t2w1lwt9 < t2h1d2 && t2w1lwt9 <t2w1rwt2 && t2w1lwt9 <t2w1lwt2 && t2w1lwt9 < t2h1uwt2 && t2w1lwt9 < t2h1dwt2
  && t2w1lwt9 < t2w1r3 && t2w1lwt9 < t2w1l3 && t2w1lwt9 < t2h1u3 && t2w1lwt9 < t2h1d3 && t2w1lwt9 <t2w1rwt3 && t2w1lwt9 <t2w1lwt3 && t2w1lwt9 < t2h1uwt3 && t2w1lwt9 < t2h1dwt3
  && t2w1lwt9 < t2w1r4 && t2w1lwt9 < t2w1l4 && t2w1lwt9 < t2h1u4 && t2w1lwt9 < t2h1d4 && t2w1lwt9 <t2w1rwt4 && t2w1lwt9 <t2w1lwt4 && t2w1lwt9 < t2h1uwt4 && t2w1lwt9 < t2h1dwt4
  && t2w1lwt9 < t2w1r5 && t2w1lwt9 < t2w1l5 && t2w1lwt9 < t2h1u5 && t2w1lwt9 < t2h1d5 && t2w1lwt9 <t2w1rwt5 && t2w1lwt9 <t2w1lwt5 && t2w1lwt9 < t2h1uwt5 && t2w1lwt9 < t2h1dwt5
  && t2w1lwt9 < t2w1r6 && t2w1lwt9 < t2w1l6 && t2w1lwt9 < t2h1u6 && t2w1lwt9 < t2h1d6 && t2w1lwt9 <t2w1rwt6 && t2w1lwt9 <t2w1lwt6 && t2w1lwt9 < t2h1uwt6 && t2w1lwt9 < t2h1dwt6
  && t2w1lwt9 < t2w1r7 && t2w1lwt9 < t2w1l7 && t2w1lwt9 < t2h1u7 && t2w1lwt9 < t2h1d7 && t2w1lwt9 <t2w1rwt7 && t2w1lwt9 <t2w1lwt7 && t2w1lwt9 < t2h1uwt7 && t2w1lwt9 < t2h1dwt7
  && t2w1lwt9 < t2w1r8 && t2w1lwt9 < t2w1l8 && t2w1lwt9 < t2h1u8 && t2w1lwt9 < t2h1d8 && t2w1lwt9 <t2w1rwt8 && t2w1lwt9 <t2w1lwt8 && t2w1lwt9 < t2h1uwt8 && t2w1lwt9 < t2h1dwt8
  && t2w1lwt9 < t2w1r9 && t2w1lwt9 < t2w1l9 && t2w1lwt9 < t2h1u9 && t2w1lwt9 < t2h1d9 && t2w1lwt9 <t2w1rwt9 && t2w1lwt9 < t2h1uwt9 && t2w1lwt9 < t2h1dwt9
  && t2w1lwt9 < t2w1r10 && t2w1lwt9 < t2w1l10 && t2w1lwt9 < t2h1u10 && t2w1lwt9 < t2h1d10 && t2w1lwt9 <t2w1rwt10 && t2w1lwt9 <t2w1lwt10 && t2w1lwt9 < t2h1uwt10 && t2w1lwt9 < t2h1dwt10
  && ((loutwl9!=0 && linwl9==0) || (loutwl9==0 && linwl9!=0))){
  i=399;
  }

  if (mxlOW9==-1 && t2w1lwt9 > 0 && t2w1lwt9 < t1 
  && t2w1lwt9 < t2w1r && t2w1lwt9 < t2w1l && t2w1lwt9 < t2h1u && t2w1lwt9 < t2h1d && t2w1lwt9 <t2w1rwt && t2w1lwt9 <t2w1lwt && t2w1lwt9 < t2h1uwt && t2w1lwt9 < t2h1dwt
  && t2w1lwt9 < t2w1r1 && t2w1lwt9 < t2w1l1 && t2w1lwt9 < t2h1u1 && t2w1lwt9 < t2h1d1 && t2w1lwt9 <t2w1rwt1 && t2w1lwt9 <t2w1lwt1 && t2w1lwt9 < t2h1uwt1 && t2w1lwt9 < t2h1dwt1
  && t2w1lwt9 < t2w1r2 && t2w1lwt9 < t2w1l2 && t2w1lwt9 < t2h1u2 && t2w1lwt9 < t2h1d2 && t2w1lwt9 <t2w1rwt2 && t2w1lwt9 <t2w1lwt2 && t2w1lwt9 < t2h1uwt2 && t2w1lwt9 < t2h1dwt2
  && t2w1lwt9 < t2w1r3 && t2w1lwt9 < t2w1l3 && t2w1lwt9 < t2h1u3 && t2w1lwt9 < t2h1d3 && t2w1lwt9 <t2w1rwt3 && t2w1lwt9 <t2w1lwt3 && t2w1lwt9 < t2h1uwt3 && t2w1lwt9 < t2h1dwt3
  && t2w1lwt9 < t2w1r4 && t2w1lwt9 < t2w1l4 && t2w1lwt9 < t2h1u4 && t2w1lwt9 < t2h1d4 && t2w1lwt9 <t2w1rwt4 && t2w1lwt9 <t2w1lwt4 && t2w1lwt9 < t2h1uwt4 && t2w1lwt9 < t2h1dwt4
  && t2w1lwt9 < t2w1r5 && t2w1lwt9 < t2w1l5 && t2w1lwt9 < t2h1u5 && t2w1lwt9 < t2h1d5 && t2w1lwt9 <t2w1rwt5 && t2w1lwt9 <t2w1lwt5 && t2w1lwt9 < t2h1uwt5 && t2w1lwt9 < t2h1dwt5
  && t2w1lwt9 < t2w1r6 && t2w1lwt9 < t2w1l6 && t2w1lwt9 < t2h1u6 && t2w1lwt9 < t2h1d6 && t2w1lwt9 <t2w1rwt6 && t2w1lwt9 <t2w1lwt6 && t2w1lwt9 < t2h1uwt6 && t2w1lwt9 < t2h1dwt6
  && t2w1lwt9 < t2w1r7 && t2w1lwt9 < t2w1l7 && t2w1lwt9 < t2h1u7 && t2w1lwt9 < t2h1d7 && t2w1lwt9 <t2w1rwt7 && t2w1lwt9 <t2w1lwt7 && t2w1lwt9 < t2h1uwt7 && t2w1lwt9 < t2h1dwt7
  && t2w1lwt9 < t2w1r8 && t2w1lwt9 < t2w1l8 && t2w1lwt9 < t2h1u8 && t2w1lwt9 < t2h1d8 && t2w1lwt9 <t2w1rwt8 && t2w1lwt9 <t2w1lwt8 && t2w1lwt9 < t2h1uwt8 && t2w1lwt9 < t2h1dwt8
  && t2w1lwt9 < t2w1r9 && t2w1lwt9 < t2w1l9 && t2w1lwt9 < t2h1u9 && t2w1lwt9 < t2h1d9 && t2w1lwt9 <t2w1rwt9 && t2w1lwt9 < t2h1uwt9 && t2w1lwt9 < t2h1dwt9
  && t2w1lwt9 < t2w1r10 && t2w1lwt9 < t2w1l10 && t2w1lwt9 < t2h1u10 && t2w1lwt9 < t2h1d10 && t2w1lwt9 <t2w1rwt10 && t2w1lwt9 <t2w1lwt10 && t2w1lwt9 < t2h1uwt10 && t2w1lwt9 < t2h1dwt10
  && (loutwl9==0 && linwl9==0)){
  i=399;}

  if (myuOW9==-1 && t2h1uwt9 > 0 && t2h1uwt9 < t1 
  && t2h1uwt9 < t2w1r && t2h1uwt9 < t2w1l && t2h1uwt9 < t2h1u && t2h1uwt9 < t2h1d && t2h1uwt9 < t2w1rwt && t2h1uwt9 < t2w1lwt && t2h1uwt9 < t2h1uwt && t2h1uwt9 < t2h1dwt 
  && t2h1uwt9 < t2w1r1 && t2h1uwt9 < t2w1l1 && t2h1uwt9 < t2h1u1 && t2h1uwt9 < t2h1d1 && t2h1uwt9 < t2w1rwt1 && t2h1uwt9 < t2w1lwt1 && t2h1uwt9 < t2h1uwt1 && t2h1uwt9 < t2h1dwt1
  && t2h1uwt9 < t2w1r2 && t2h1uwt9 < t2w1l2 && t2h1uwt9 < t2h1u2 && t2h1uwt9 < t2h1d2 && t2h1uwt9 < t2w1rwt2 && t2h1uwt9 < t2w1lwt2 && t2h1uwt9 < t2h1uwt2 && t2h1uwt9 < t2h1dwt2
  && t2h1uwt9 < t2w1r3 && t2h1uwt9 < t2w1l3 && t2h1uwt9 < t2h1u3 && t2h1uwt9 < t2h1d3 && t2h1uwt9 < t2w1rwt3 && t2h1uwt9 < t2w1lwt3 && t2h1uwt9 < t2h1uwt3 && t2h1uwt9 < t2h1dwt3
  && t2h1uwt9 < t2w1r4 && t2h1uwt9 < t2w1l4 && t2h1uwt9 < t2h1u4 && t2h1uwt9 < t2h1d4 && t2h1uwt9 < t2w1rwt4 && t2h1uwt9 < t2w1lwt4 && t2h1uwt9 < t2h1uwt4 && t2h1uwt9 < t2h1dwt4
  && t2h1uwt9 < t2w1r5 && t2h1uwt9 < t2w1l5 && t2h1uwt9 < t2h1u5 && t2h1uwt9 < t2h1d5 && t2h1uwt9 < t2w1rwt5 && t2h1uwt9 < t2w1lwt5 && t2h1uwt9 < t2h1uwt5 && t2h1uwt9 < t2h1dwt5
  && t2h1uwt9 < t2w1r6 && t2h1uwt9 < t2w1l6 && t2h1uwt9 < t2h1u6 && t2h1uwt9 < t2h1d6 && t2h1uwt9 < t2w1rwt6 && t2h1uwt9 < t2w1lwt6 && t2h1uwt9 < t2h1uwt6 && t2h1uwt9 < t2h1dwt6
  && t2h1uwt9 < t2w1r7 && t2h1uwt9 < t2w1l7 && t2h1uwt9 < t2h1u7 && t2h1uwt9 < t2h1d7 && t2h1uwt9 < t2w1rwt7 && t2h1uwt9 < t2w1lwt7 && t2h1uwt9 < t2h1uwt7 && t2h1uwt9 < t2h1dwt7
  && t2h1uwt9 < t2w1r8 && t2h1uwt9 < t2w1l8 && t2h1uwt9 < t2h1u8 && t2h1uwt9 < t2h1d8 && t2h1uwt9 < t2w1rwt8 && t2h1uwt9 < t2w1lwt8 && t2h1uwt9 < t2h1uwt8 && t2h1uwt9 < t2h1dwt8
  && t2h1uwt9 < t2w1r9 && t2h1uwt9 < t2w1l9 && t2h1uwt9 < t2h1u9 && t2h1uwt9 < t2h1d9 && t2h1uwt9 < t2w1rwt9 && t2h1uwt9 < t2w1lwt9 && t2h1uwt9 < t2h1dwt9
  && t2h1uwt9 < t2w1r10 && t2h1uwt9 < t2w1l10 && t2h1uwt9 < t2h1u10 && t2h1uwt9 < t2h1d10 && t2h1uwt9 < t2w1rwt10 && t2h1uwt9 < t2w1lwt10 && t2h1uwt9 < t2h1uwt10 && t2h1uwt9 < t2h1dwt10
  && (louthu9 !=0 && linhu9!=0)){
  i=400;
  }

  if (myuOW9==-1 && t2h1uwt9 > 0 && t2h1uwt9 < t1 
  && t2h1uwt9 < t2w1r && t2h1uwt9 < t2w1l && t2h1uwt9 < t2h1u && t2h1uwt9 < t2h1d && t2h1uwt9 < t2w1rwt && t2h1uwt9 < t2w1lwt && t2h1uwt9 < t2h1uwt && t2h1uwt9 < t2h1dwt 
  && t2h1uwt9 < t2w1r1 && t2h1uwt9 < t2w1l1 && t2h1uwt9 < t2h1u1 && t2h1uwt9 < t2h1d1 && t2h1uwt9 < t2w1rwt1 && t2h1uwt9 < t2w1lwt1 && t2h1uwt9 < t2h1uwt1 && t2h1uwt9 < t2h1dwt1
  && t2h1uwt9 < t2w1r2 && t2h1uwt9 < t2w1l2 && t2h1uwt9 < t2h1u2 && t2h1uwt9 < t2h1d2 && t2h1uwt9 < t2w1rwt2 && t2h1uwt9 < t2w1lwt2 && t2h1uwt9 < t2h1uwt2 && t2h1uwt9 < t2h1dwt2
  && t2h1uwt9 < t2w1r3 && t2h1uwt9 < t2w1l3 && t2h1uwt9 < t2h1u3 && t2h1uwt9 < t2h1d3 && t2h1uwt9 < t2w1rwt3 && t2h1uwt9 < t2w1lwt3 && t2h1uwt9 < t2h1uwt3 && t2h1uwt9 < t2h1dwt3
  && t2h1uwt9 < t2w1r4 && t2h1uwt9 < t2w1l4 && t2h1uwt9 < t2h1u4 && t2h1uwt9 < t2h1d4 && t2h1uwt9 < t2w1rwt4 && t2h1uwt9 < t2w1lwt4 && t2h1uwt9 < t2h1uwt4 && t2h1uwt9 < t2h1dwt4
  && t2h1uwt9 < t2w1r5 && t2h1uwt9 < t2w1l5 && t2h1uwt9 < t2h1u5 && t2h1uwt9 < t2h1d5 && t2h1uwt9 < t2w1rwt5 && t2h1uwt9 < t2w1lwt5 && t2h1uwt9 < t2h1uwt5 && t2h1uwt9 < t2h1dwt5
  && t2h1uwt9 < t2w1r6 && t2h1uwt9 < t2w1l6 && t2h1uwt9 < t2h1u6 && t2h1uwt9 < t2h1d6 && t2h1uwt9 < t2w1rwt6 && t2h1uwt9 < t2w1lwt6 && t2h1uwt9 < t2h1uwt6 && t2h1uwt9 < t2h1dwt6
  && t2h1uwt9 < t2w1r7 && t2h1uwt9 < t2w1l7 && t2h1uwt9 < t2h1u7 && t2h1uwt9 < t2h1d7 && t2h1uwt9 < t2w1rwt7 && t2h1uwt9 < t2w1lwt7 && t2h1uwt9 < t2h1uwt7 && t2h1uwt9 < t2h1dwt7
  && t2h1uwt9 < t2w1r8 && t2h1uwt9 < t2w1l8 && t2h1uwt9 < t2h1u8 && t2h1uwt9 < t2h1d8 && t2h1uwt9 < t2w1rwt8 && t2h1uwt9 < t2w1lwt8 && t2h1uwt9 < t2h1uwt8 && t2h1uwt9 < t2h1dwt8
  && t2h1uwt9 < t2w1r9 && t2h1uwt9 < t2w1l9 && t2h1uwt9 < t2h1u9 && t2h1uwt9 < t2h1d9 && t2h1uwt9 < t2w1rwt9 && t2h1uwt9 < t2w1lwt9 && t2h1uwt9 < t2h1dwt9
  && t2h1uwt9 < t2w1r10 && t2h1uwt9 < t2w1l10 && t2h1uwt9 < t2h1u10 && t2h1uwt9 < t2h1d10 && t2h1uwt9 < t2w1rwt10 && t2h1uwt9 < t2w1lwt10 && t2h1uwt9 < t2h1uwt10 && t2h1uwt9 < t2h1dwt10
  && ((louthu9!=0 && linhu9==0) || (louthu9==0 && linhu9!=0))){
  i=400;
  }

  if (myuOW9==-1 && t2h1uwt9 > 0 && t2h1uwt9 < t1 
  && t2h1uwt9 < t2w1r && t2h1uwt9 < t2w1l && t2h1uwt9 < t2h1u && t2h1uwt9 < t2h1d && t2h1uwt9 < t2w1rwt && t2h1uwt9 < t2w1lwt && t2h1uwt9 < t2h1uwt && t2h1uwt9 < t2h1dwt 
  && t2h1uwt9 < t2w1r1 && t2h1uwt9 < t2w1l1 && t2h1uwt9 < t2h1u1 && t2h1uwt9 < t2h1d1 && t2h1uwt9 < t2w1rwt1 && t2h1uwt9 < t2w1lwt1 && t2h1uwt9 < t2h1uwt1 && t2h1uwt9 < t2h1dwt1
  && t2h1uwt9 < t2w1r2 && t2h1uwt9 < t2w1l2 && t2h1uwt9 < t2h1u2 && t2h1uwt9 < t2h1d2 && t2h1uwt9 < t2w1rwt2 && t2h1uwt9 < t2w1lwt2 && t2h1uwt9 < t2h1uwt2 && t2h1uwt9 < t2h1dwt2
  && t2h1uwt9 < t2w1r3 && t2h1uwt9 < t2w1l3 && t2h1uwt9 < t2h1u3 && t2h1uwt9 < t2h1d3 && t2h1uwt9 < t2w1rwt3 && t2h1uwt9 < t2w1lwt3 && t2h1uwt9 < t2h1uwt3 && t2h1uwt9 < t2h1dwt3
  && t2h1uwt9 < t2w1r4 && t2h1uwt9 < t2w1l4 && t2h1uwt9 < t2h1u4 && t2h1uwt9 < t2h1d4 && t2h1uwt9 < t2w1rwt4 && t2h1uwt9 < t2w1lwt4 && t2h1uwt9 < t2h1uwt4 && t2h1uwt9 < t2h1dwt4
  && t2h1uwt9 < t2w1r5 && t2h1uwt9 < t2w1l5 && t2h1uwt9 < t2h1u5 && t2h1uwt9 < t2h1d5 && t2h1uwt9 < t2w1rwt5 && t2h1uwt9 < t2w1lwt5 && t2h1uwt9 < t2h1uwt5 && t2h1uwt9 < t2h1dwt5
  && t2h1uwt9 < t2w1r6 && t2h1uwt9 < t2w1l6 && t2h1uwt9 < t2h1u6 && t2h1uwt9 < t2h1d6 && t2h1uwt9 < t2w1rwt6 && t2h1uwt9 < t2w1lwt6 && t2h1uwt9 < t2h1uwt6 && t2h1uwt9 < t2h1dwt6
  && t2h1uwt9 < t2w1r7 && t2h1uwt9 < t2w1l7 && t2h1uwt9 < t2h1u7 && t2h1uwt9 < t2h1d7 && t2h1uwt9 < t2w1rwt7 && t2h1uwt9 < t2w1lwt7 && t2h1uwt9 < t2h1uwt7 && t2h1uwt9 < t2h1dwt7
  && t2h1uwt9 < t2w1r8 && t2h1uwt9 < t2w1l8 && t2h1uwt9 < t2h1u8 && t2h1uwt9 < t2h1d8 && t2h1uwt9 < t2w1rwt8 && t2h1uwt9 < t2w1lwt8 && t2h1uwt9 < t2h1uwt8 && t2h1uwt9 < t2h1dwt8
  && t2h1uwt9 < t2w1r9 && t2h1uwt9 < t2w1l9 && t2h1uwt9 < t2h1u9 && t2h1uwt9 < t2h1d9 && t2h1uwt9 < t2w1rwt9 && t2h1uwt9 < t2w1lwt9 && t2h1uwt9 < t2h1dwt9
  && t2h1uwt9 < t2w1r10 && t2h1uwt9 < t2w1l10 && t2h1uwt9 < t2h1u10 && t2h1uwt9 < t2h1d10 && t2h1uwt9 < t2w1rwt10 && t2h1uwt9 < t2w1lwt10 && t2h1uwt9 < t2h1uwt10 && t2h1uwt9 < t2h1dwt10
  && (louthu9 == 0 && linhu9 == 0)){
  i=400;
  }

  if (mydOW9==-1 && t2h1dwt9 > 0 && t2h1dwt9 < t1 
  && t2h1dwt9 < t2w1r && t2h1dwt9 < t2w1l && t2h1dwt9 < t2h1u && t2h1dwt9 < t2h1d && t2h1dwt9 < t2w1rwt && t2h1dwt9 < t2w1lwt && t2h1dwt9 < t2h1uwt && t2h1dwt9 < t2h1dwt 
  && t2h1dwt9 < t2w1r1 && t2h1dwt9 < t2w1l1 && t2h1dwt9 < t2h1u1 && t2h1dwt9 < t2h1d1 && t2h1dwt9 < t2w1rwt1 && t2h1dwt9 < t2w1lwt1 && t2h1dwt9 < t2h1uwt1 && t2h1dwt9 < t2h1dwt1
  && t2h1dwt9 < t2w1r2 && t2h1dwt9 < t2w1l2 && t2h1dwt9 < t2h1u2 && t2h1dwt9 < t2h1d2 && t2h1dwt9 < t2w1rwt2 && t2h1dwt9 < t2w1lwt2 && t2h1dwt9 < t2h1uwt2 && t2h1dwt9 < t2h1dwt2 
  && t2h1dwt9 < t2w1r3 && t2h1dwt9 < t2w1l3 && t2h1dwt9 < t2h1u3 && t2h1dwt9 < t2h1d3 && t2h1dwt9 < t2w1rwt3 && t2h1dwt9 < t2w1lwt3 && t2h1dwt9 < t2h1uwt3 && t2h1dwt9 < t2h1dwt3
  && t2h1dwt9 < t2w1r4 && t2h1dwt9 < t2w1l4 && t2h1dwt9 < t2h1u4 && t2h1dwt9 < t2h1d4 && t2h1dwt9 < t2w1rwt4 && t2h1dwt9 < t2w1lwt4 && t2h1dwt9 < t2h1uwt4 && t2h1dwt9 < t2h1dwt4
  && t2h1dwt9 < t2w1r5 && t2h1dwt9 < t2w1l5 && t2h1dwt9 < t2h1u5 && t2h1dwt9 < t2h1d5 && t2h1dwt9 < t2w1rwt5 && t2h1dwt9 < t2w1lwt5 && t2h1dwt9 < t2h1uwt5 && t2h1dwt9 < t2h1dwt5
  && t2h1dwt9 < t2w1r6 && t2h1dwt9 < t2w1l6 && t2h1dwt9 < t2h1u6 && t2h1dwt9 < t2h1d6 && t2h1dwt9 < t2w1rwt6 && t2h1dwt9 < t2w1lwt6 && t2h1dwt9 < t2h1uwt6 && t2h1dwt9 < t2h1dwt6
  && t2h1dwt9 < t2w1r7 && t2h1dwt9 < t2w1l7 && t2h1dwt9 < t2h1u7 && t2h1dwt9 < t2h1d7 && t2h1dwt9 < t2w1rwt7 && t2h1dwt9 < t2w1lwt7 && t2h1dwt9 < t2h1uwt7 && t2h1dwt9 < t2h1dwt7 
  && t2h1dwt9 < t2w1r8 && t2h1dwt9 < t2w1l8 && t2h1dwt9 < t2h1u8 && t2h1dwt9 < t2h1d8 && t2h1dwt9 < t2w1rwt8 && t2h1dwt9 < t2w1lwt8 && t2h1dwt9 < t2h1uwt8 && t2h1dwt9 < t2h1dwt8
  && t2h1dwt9 < t2w1r9 && t2h1dwt9 < t2w1l9 && t2h1dwt9 < t2h1u9 && t2h1dwt9 < t2h1d9 && t2h1dwt9 < t2w1rwt9 && t2h1dwt9 < t2w1lwt9 && t2h1dwt9 < t2h1uwt9 
  && t2h1dwt9 < t2w1r10 && t2h1dwt9 < t2w1l10 && t2h1dwt9 < t2h1u10 && t2h1dwt9 < t2h1d10 && t2h1dwt9 < t2w1rwt10 && t2h1dwt9 < t2w1lwt10 && t2h1dwt9 < t2h1uwt10 && t2h1dwt9 < t2h1dwt10  
  && (louthd9 !=0 && linhd9!=0)){
  i=401;
  }

  if (mydOW9==-1 && t2h1dwt9 > 0 && t2h1dwt9 < t1 
  && t2h1dwt9 < t2w1r && t2h1dwt9 < t2w1l && t2h1dwt9 < t2h1u && t2h1dwt9 < t2h1d && t2h1dwt9 < t2w1rwt && t2h1dwt9 < t2w1lwt && t2h1dwt9 < t2h1uwt && t2h1dwt9 < t2h1dwt 
  && t2h1dwt9 < t2w1r1 && t2h1dwt9 < t2w1l1 && t2h1dwt9 < t2h1u1 && t2h1dwt9 < t2h1d1 && t2h1dwt9 < t2w1rwt1 && t2h1dwt9 < t2w1lwt1 && t2h1dwt9 < t2h1uwt1 && t2h1dwt9 < t2h1dwt1
  && t2h1dwt9 < t2w1r2 && t2h1dwt9 < t2w1l2 && t2h1dwt9 < t2h1u2 && t2h1dwt9 < t2h1d2 && t2h1dwt9 < t2w1rwt2 && t2h1dwt9 < t2w1lwt2 && t2h1dwt9 < t2h1uwt2 && t2h1dwt9 < t2h1dwt2 
  && t2h1dwt9 < t2w1r3 && t2h1dwt9 < t2w1l3 && t2h1dwt9 < t2h1u3 && t2h1dwt9 < t2h1d3 && t2h1dwt9 < t2w1rwt3 && t2h1dwt9 < t2w1lwt3 && t2h1dwt9 < t2h1uwt3 && t2h1dwt9 < t2h1dwt3
  && t2h1dwt9 < t2w1r4 && t2h1dwt9 < t2w1l4 && t2h1dwt9 < t2h1u4 && t2h1dwt9 < t2h1d4 && t2h1dwt9 < t2w1rwt4 && t2h1dwt9 < t2w1lwt4 && t2h1dwt9 < t2h1uwt4 && t2h1dwt9 < t2h1dwt4
  && t2h1dwt9 < t2w1r5 && t2h1dwt9 < t2w1l5 && t2h1dwt9 < t2h1u5 && t2h1dwt9 < t2h1d5 && t2h1dwt9 < t2w1rwt5 && t2h1dwt9 < t2w1lwt5 && t2h1dwt9 < t2h1uwt5 && t2h1dwt9 < t2h1dwt5
  && t2h1dwt9 < t2w1r6 && t2h1dwt9 < t2w1l6 && t2h1dwt9 < t2h1u6 && t2h1dwt9 < t2h1d6 && t2h1dwt9 < t2w1rwt6 && t2h1dwt9 < t2w1lwt6 && t2h1dwt9 < t2h1uwt6 && t2h1dwt9 < t2h1dwt6
  && t2h1dwt9 < t2w1r7 && t2h1dwt9 < t2w1l7 && t2h1dwt9 < t2h1u7 && t2h1dwt9 < t2h1d7 && t2h1dwt9 < t2w1rwt7 && t2h1dwt9 < t2w1lwt7 && t2h1dwt9 < t2h1uwt7 && t2h1dwt9 < t2h1dwt7 
  && t2h1dwt9 < t2w1r8 && t2h1dwt9 < t2w1l8 && t2h1dwt9 < t2h1u8 && t2h1dwt9 < t2h1d8 && t2h1dwt9 < t2w1rwt8 && t2h1dwt9 < t2w1lwt8 && t2h1dwt9 < t2h1uwt8 && t2h1dwt9 < t2h1dwt8
  && t2h1dwt9 < t2w1r9 && t2h1dwt9 < t2w1l9 && t2h1dwt9 < t2h1u9 && t2h1dwt9 < t2h1d9 && t2h1dwt9 < t2w1rwt9 && t2h1dwt9 < t2w1lwt9 && t2h1dwt9 < t2h1uwt9 
  && t2h1dwt9 < t2w1r10 && t2h1dwt9 < t2w1l10 && t2h1dwt9 < t2h1u10 && t2h1dwt9 < t2h1d10 && t2h1dwt9 < t2w1rwt10 && t2h1dwt9 < t2w1lwt10 && t2h1dwt9 < t2h1uwt10 && t2h1dwt9 < t2h1dwt10
  && ((louthd9 !=0 && linhd9==0) || (louthd9 ==0 && linhd9!=0))){
  i=401;
  }

  if (mydOW9==-1 && t2h1dwt9 > 0 && t2h1dwt9 < t1 
  && t2h1dwt9 < t2w1r && t2h1dwt9 < t2w1l && t2h1dwt9 < t2h1u && t2h1dwt9 < t2h1d && t2h1dwt9 < t2w1rwt && t2h1dwt9 < t2w1lwt && t2h1dwt9 < t2h1uwt && t2h1dwt9 < t2h1dwt 
  && t2h1dwt9 < t2w1r1 && t2h1dwt9 < t2w1l1 && t2h1dwt9 < t2h1u1 && t2h1dwt9 < t2h1d1 && t2h1dwt9 < t2w1rwt1 && t2h1dwt9 < t2w1lwt1 && t2h1dwt9 < t2h1uwt1 && t2h1dwt9 < t2h1dwt1
  && t2h1dwt9 < t2w1r2 && t2h1dwt9 < t2w1l2 && t2h1dwt9 < t2h1u2 && t2h1dwt9 < t2h1d2 && t2h1dwt9 < t2w1rwt2 && t2h1dwt9 < t2w1lwt2 && t2h1dwt9 < t2h1uwt2 && t2h1dwt9 < t2h1dwt2 
  && t2h1dwt9 < t2w1r3 && t2h1dwt9 < t2w1l3 && t2h1dwt9 < t2h1u3 && t2h1dwt9 < t2h1d3 && t2h1dwt9 < t2w1rwt3 && t2h1dwt9 < t2w1lwt3 && t2h1dwt9 < t2h1uwt3 && t2h1dwt9 < t2h1dwt3
  && t2h1dwt9 < t2w1r4 && t2h1dwt9 < t2w1l4 && t2h1dwt9 < t2h1u4 && t2h1dwt9 < t2h1d4 && t2h1dwt9 < t2w1rwt4 && t2h1dwt9 < t2w1lwt4 && t2h1dwt9 < t2h1uwt4 && t2h1dwt9 < t2h1dwt4
  && t2h1dwt9 < t2w1r5 && t2h1dwt9 < t2w1l5 && t2h1dwt9 < t2h1u5 && t2h1dwt9 < t2h1d5 && t2h1dwt9 < t2w1rwt5 && t2h1dwt9 < t2w1lwt5 && t2h1dwt9 < t2h1uwt5 && t2h1dwt9 < t2h1dwt5
  && t2h1dwt9 < t2w1r6 && t2h1dwt9 < t2w1l6 && t2h1dwt9 < t2h1u6 && t2h1dwt9 < t2h1d6 && t2h1dwt9 < t2w1rwt6 && t2h1dwt9 < t2w1lwt6 && t2h1dwt9 < t2h1uwt6 && t2h1dwt9 < t2h1dwt6
  && t2h1dwt9 < t2w1r7 && t2h1dwt9 < t2w1l7 && t2h1dwt9 < t2h1u7 && t2h1dwt9 < t2h1d7 && t2h1dwt9 < t2w1rwt7 && t2h1dwt9 < t2w1lwt7 && t2h1dwt9 < t2h1uwt7 && t2h1dwt9 < t2h1dwt7 
  && t2h1dwt9 < t2w1r8 && t2h1dwt9 < t2w1l8 && t2h1dwt9 < t2h1u8 && t2h1dwt9 < t2h1d8 && t2h1dwt9 < t2w1rwt8 && t2h1dwt9 < t2w1lwt8 && t2h1dwt9 < t2h1uwt8 && t2h1dwt9 < t2h1dwt8
  && t2h1dwt9 < t2w1r9 && t2h1dwt9 < t2w1l9 && t2h1dwt9 < t2h1u9 && t2h1dwt9 < t2h1d9 && t2h1dwt9 < t2w1rwt9 && t2h1dwt9 < t2w1lwt9 && t2h1dwt9 < t2h1uwt9 
  && t2h1dwt9 < t2w1r10 && t2h1dwt9 < t2w1l10 && t2h1dwt9 < t2h1u10 && t2h1dwt9 < t2h1d10 && t2h1dwt9 < t2w1rwt10 && t2h1dwt9 < t2w1lwt10 && t2h1dwt9 < t2h1uwt10 && t2h1dwt9 < t2h1dwt10
  && (louthd9 == 0 && linhd9 == 0)){ 
  i=401;
  }


  if (mxr10!=-1 && t2w1r10 > 0 && t2w1r10 < t1 
     && t2w1r10 < t2w1r && t2w1r10 < t2w1l && t2w1r10 < t2h1u && t2w1r10 < t2h1d && t2w1r10 < t2w1rwt && t2w1r10 < t2w1lwt && t2w1r10 < t2h1uwt && t2w1r10 < t2h1dwt
     && t2w1r10 < t2w1r1 && t2w1r10 < t2w1l1 && t2w1r10 < t2h1u1 && t2w1r10 < t2h1d1 && t2w1r10 < t2w1rwt1 && t2w1r10 < t2w1lwt1 && t2w1r10 < t2h1uwt1 && t2w1r10 < t2h1dwt1
     && t2w1r10 < t2w1r2 && t2w1r10 < t2w1l2 && t2w1r10 < t2h1u2 && t2w1r10 < t2h1d2 && t2w1r10 < t2w1rwt2 && t2w1r10 < t2w1lwt2 && t2w1r10 < t2h1uwt2 && t2w1r10 < t2h1dwt2 
     && t2w1r10 < t2w1r3 && t2w1r10 < t2w1l3 && t2w1r10 < t2h1u3 && t2w1r10 < t2h1d3 && t2w1r10 < t2w1rwt3 && t2w1r10 < t2w1lwt3 && t2w1r10 < t2h1uwt3 && t2w1r10 < t2h1dwt3
     && t2w1r10 < t2w1r4 && t2w1r10 < t2w1l4 && t2w1r10 < t2h1u4 && t2w1r10 < t2h1d4 && t2w1r10 < t2w1rwt4 && t2w1r10 < t2w1lwt4 && t2w1r10 < t2h1uwt4 && t2w1r10 < t2h1dwt4
     && t2w1r10 < t2w1r5 && t2w1r10 < t2w1l5 && t2w1r10 < t2h1u5 && t2w1r10 < t2h1d5 && t2w1r10 < t2w1rwt5 && t2w1r10 < t2w1lwt5 && t2w1r10 < t2h1uwt5 && t2w1r10 < t2h1dwt5
     && t2w1r10 < t2w1r6 && t2w1r10 < t2w1l6 && t2w1r10 < t2h1u6 && t2w1r10 < t2h1d6 && t2w1r10 < t2w1rwt6 && t2w1r10 < t2w1lwt6 && t2w1r10 < t2h1uwt6 && t2w1r10 < t2h1dwt6
     && t2w1r10 < t2w1r7 && t2w1r10 < t2w1l7 && t2w1r10 < t2h1u7 && t2w1r10 < t2h1d7 && t2w1r10 < t2w1rwt7 && t2w1r10 < t2w1lwt7 && t2w1r10 < t2h1uwt7 && t2w1r10 < t2h1dwt7
     && t2w1r10 < t2w1r8 && t2w1r10 < t2w1l8 && t2w1r10 < t2h1u8 && t2w1r10 < t2h1d8 && t2w1r10 < t2w1rwt8 && t2w1r10 < t2w1lwt8 && t2w1r10 < t2h1uwt8 && t2w1r10 < t2h1dwt8
     && t2w1r10 < t2w1r9 && t2w1r10 < t2w1l9 && t2w1r10 < t2h1u9 && t2w1r10 < t2h1d9 && t2w1r10 < t2w1rwt9 && t2w1r10 < t2w1lwt9 && t2w1r10 < t2h1uwt9 && t2w1r10 < t2h1dwt9
     && t2w1r10 < t2w1l10 && t2w1r10 < t2h1u10 && t2w1r10 < t2h1d10 && t2w1r10 < t2w1rwt10 && t2w1r10 < t2w1lwt10 && t2w1r10 < t2h1uwt10 && t2w1r10 < t2h1dwt10
     && ((linwr10!=0) && (loutwr10!=0) )) {	
    if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1r10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1r10+z))*(z0hd10+(vz*t2w1r10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1r10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1r10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1r10+z))*(z0hu10+(vz*t2w1r10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1r10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1r10+y;
  xlimitr=bwr10*sqrt(1-((vz*t2w1r10+z)+z0wr10)*((vz*t2w1r10+z)+z0wr10)/a2wr10);
  xtest=vx*t2w1r10+x;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=-xlimitr && mxr10 > 0){
  i=402;
  }else{
  i=418;
  }
  }

													/* neutron interacts with the parabolic right INNER wall - comments are analog to inner elliptic right wall */

  if (mxr10!=-1 && t2w1r10 > 0 && t2w1r10 < t1 
     && t2w1r10 < t2w1r && t2w1r10 < t2w1l && t2w1r10 < t2h1u && t2w1r10 < t2h1d && t2w1r10 < t2w1rwt && t2w1r10 < t2w1lwt && t2w1r10 < t2h1uwt && t2w1r10 < t2h1dwt
     && t2w1r10 < t2w1r1 && t2w1r10 < t2w1l1 && t2w1r10 < t2h1u1 && t2w1r10 < t2h1d1 && t2w1r10 < t2w1rwt1 && t2w1r10 < t2w1lwt1 && t2w1r10 < t2h1uwt1 && t2w1r10 < t2h1dwt1
     && t2w1r10 < t2w1r2 && t2w1r10 < t2w1l2 && t2w1r10 < t2h1u2 && t2w1r10 < t2h1d2 && t2w1r10 < t2w1rwt2 && t2w1r10 < t2w1lwt2 && t2w1r10 < t2h1uwt2 && t2w1r10 < t2h1dwt2 
     && t2w1r10 < t2w1r3 && t2w1r10 < t2w1l3 && t2w1r10 < t2h1u3 && t2w1r10 < t2h1d3 && t2w1r10 < t2w1rwt3 && t2w1r10 < t2w1lwt3 && t2w1r10 < t2h1uwt3 && t2w1r10 < t2h1dwt3
     && t2w1r10 < t2w1r4 && t2w1r10 < t2w1l4 && t2w1r10 < t2h1u4 && t2w1r10 < t2h1d4 && t2w1r10 < t2w1rwt4 && t2w1r10 < t2w1lwt4 && t2w1r10 < t2h1uwt4 && t2w1r10 < t2h1dwt4
     && t2w1r10 < t2w1r5 && t2w1r10 < t2w1l5 && t2w1r10 < t2h1u5 && t2w1r10 < t2h1d5 && t2w1r10 < t2w1rwt5 && t2w1r10 < t2w1lwt5 && t2w1r10 < t2h1uwt5 && t2w1r10 < t2h1dwt5
     && t2w1r10 < t2w1r6 && t2w1r10 < t2w1l6 && t2w1r10 < t2h1u6 && t2w1r10 < t2h1d6 && t2w1r10 < t2w1rwt6 && t2w1r10 < t2w1lwt6 && t2w1r10 < t2h1uwt6 && t2w1r10 < t2h1dwt6
     && t2w1r10 < t2w1r7 && t2w1r10 < t2w1l7 && t2w1r10 < t2h1u7 && t2w1r10 < t2h1d7 && t2w1r10 < t2w1rwt7 && t2w1r10 < t2w1lwt7 && t2w1r10 < t2h1uwt7 && t2w1r10 < t2h1dwt7
     && t2w1r10 < t2w1r8 && t2w1r10 < t2w1l8 && t2w1r10 < t2h1u8 && t2w1r10 < t2h1d8 && t2w1r10 < t2w1rwt8 && t2w1r10 < t2w1lwt8 && t2w1r10 < t2h1uwt8 && t2w1r10 < t2h1dwt8
     && t2w1r10 < t2w1r9 && t2w1r10 < t2w1l9 && t2w1r10 < t2h1u9 && t2w1r10 < t2h1d9 && t2w1r10 < t2w1rwt9 && t2w1r10 < t2w1lwt9 && t2w1r10 < t2h1uwt9 && t2w1r10 < t2h1dwt9
     && t2w1r10 < t2w1l10 && t2w1r10 < t2h1u10 && t2w1r10 < t2h1d10 && t2w1r10 < t2w1rwt10 && t2w1r10 < t2w1lwt10 && t2w1r10 < t2h1uwt10 && t2w1r10 < t2h1dwt10
     && ((loutwr10!=0 && linwr10==0) || (loutwr10==0 && linwr10!=0))){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1r10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1r10+z))*(z0hd10+(vz*t2w1r10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1r10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1r10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1r10+z))*(z0hu10+(vz*t2w1r10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1r10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1r10+y;
  xtest=vx*t2w1r10+x;
  xlimitr=-sqrt(pbwr10-(vz*t2w1r10+z)/pawr10);
  if (ytest>ylimitd && ytest<ylimitu && x>=xlimitr && mxr10 > 0){
  i=403;
  }else{
  i=418;}
  }

													/* neutron interacts with the straight right INNER wall - comments are analog to inner elliptic right wall*/

  if (mxr10!=-1 && t2w1r10 > 0 && t2w1r10 < t1 
     && t2w1r10 < t2w1r && t2w1r10 < t2w1l && t2w1r10 < t2h1u && t2w1r10 < t2h1d && t2w1r10 < t2w1rwt && t2w1r10 < t2w1lwt && t2w1r10 < t2h1uwt && t2w1r10 < t2h1dwt
     && t2w1r10 < t2w1r1 && t2w1r10 < t2w1l1 && t2w1r10 < t2h1u1 && t2w1r10 < t2h1d1 && t2w1r10 < t2w1rwt1 && t2w1r10 < t2w1lwt1 && t2w1r10 < t2h1uwt1 && t2w1r10 < t2h1dwt1
     && t2w1r10 < t2w1r2 && t2w1r10 < t2w1l2 && t2w1r10 < t2h1u2 && t2w1r10 < t2h1d2 && t2w1r10 < t2w1rwt2 && t2w1r10 < t2w1lwt2 && t2w1r10 < t2h1uwt2 && t2w1r10 < t2h1dwt2 
     && t2w1r10 < t2w1r3 && t2w1r10 < t2w1l3 && t2w1r10 < t2h1u3 && t2w1r10 < t2h1d3 && t2w1r10 < t2w1rwt3 && t2w1r10 < t2w1lwt3 && t2w1r10 < t2h1uwt3 && t2w1r10 < t2h1dwt3
     && t2w1r10 < t2w1r4 && t2w1r10 < t2w1l4 && t2w1r10 < t2h1u4 && t2w1r10 < t2h1d4 && t2w1r10 < t2w1rwt4 && t2w1r10 < t2w1lwt4 && t2w1r10 < t2h1uwt4 && t2w1r10 < t2h1dwt4
     && t2w1r10 < t2w1r5 && t2w1r10 < t2w1l5 && t2w1r10 < t2h1u5 && t2w1r10 < t2h1d5 && t2w1r10 < t2w1rwt5 && t2w1r10 < t2w1lwt5 && t2w1r10 < t2h1uwt5 && t2w1r10 < t2h1dwt5
     && t2w1r10 < t2w1r6 && t2w1r10 < t2w1l6 && t2w1r10 < t2h1u6 && t2w1r10 < t2h1d6 && t2w1r10 < t2w1rwt6 && t2w1r10 < t2w1lwt6 && t2w1r10 < t2h1uwt6 && t2w1r10 < t2h1dwt6
     && t2w1r10 < t2w1r7 && t2w1r10 < t2w1l7 && t2w1r10 < t2h1u7 && t2w1r10 < t2h1d7 && t2w1r10 < t2w1rwt7 && t2w1r10 < t2w1lwt7 && t2w1r10 < t2h1uwt7 && t2w1r10 < t2h1dwt7
     && t2w1r10 < t2w1r8 && t2w1r10 < t2w1l8 && t2w1r10 < t2h1u8 && t2w1r10 < t2h1d8 && t2w1r10 < t2w1rwt8 && t2w1r10 < t2w1lwt8 && t2w1r10 < t2h1uwt8 && t2w1r10 < t2h1dwt8
     && t2w1r10 < t2w1r9 && t2w1r10 < t2w1l9 && t2w1r10 < t2h1u9 && t2w1r10 < t2h1d9 && t2w1r10 < t2w1rwt9 && t2w1r10 < t2w1lwt9 && t2w1r10 < t2h1uwt9 && t2w1r10 < t2h1dwt9
     && t2w1r10 < t2w1l10 && t2w1r10 < t2h1u10 && t2w1r10 < t2h1d10 && t2w1r10 < t2w1rwt10 && t2w1r10 < t2w1lwt10 && t2w1r10 < t2h1uwt10 && t2w1r10 < t2h1dwt10
     && (loutwr10==0 && linwr10==0)){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1r10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1r10+z))*(z0hd10+(vz*t2w1r10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1r10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1r10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1r10+z))*(z0hu10+(vz*t2w1r10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1r10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1r10+y;
  xtest=vx*t2w1r10+x;
  xlimitr=-(w2r10+w1r10)*(vz*t2w1r10+z)/l-w1r10;
  if (ytest>=ylimitd && ytest<=ylimitu && x>=xlimitr && mxr10>0){
  i=404;
  }else{
  i=418;
  }
  }

													/* neutron interacts with the elliptic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl10!=-1 && t2w1l10 > 0 && t2w1l10 < t1 
      && t2w1l10 < t2w1r && t2w1l10 < t2w1l && t2w1l10 < t2h1u && t2w1l10 < t2h1d && t2w1l10 < t2w1rwt && t2w1l10 < t2w1lwt && t2w1l10 < t2h1uwt && t2w1l10 < t2h1dwt
      && t2w1l10 < t2w1r1 && t2w1l10 < t2w1l1 && t2w1l10 < t2h1u1 && t2w1l10 < t2h1d1 && t2w1l10 < t2w1rwt1 && t2w1l10 < t2w1lwt1 && t2w1l10 < t2h1uwt1 && t2w1l10 < t2h1dwt1
      && t2w1l10 < t2w1r2 && t2w1l10 < t2w1l2 && t2w1l10 < t2h1u2 && t2w1l10 < t2h1d2 && t2w1l10 < t2w1rwt2 && t2w1l10 < t2w1lwt2 && t2w1l10 < t2h1uwt2 && t2w1l10 < t2h1dwt2
      && t2w1l10 < t2w1r3 && t2w1l10 < t2w1l3 && t2w1l10 < t2h1u3 && t2w1l10 < t2h1d3 && t2w1l10 < t2w1rwt3 && t2w1l10 < t2w1lwt3 && t2w1l10 < t2h1uwt3 && t2w1l10 < t2h1dwt3
      && t2w1l10 < t2w1r4 && t2w1l10 < t2w1l4 && t2w1l10 < t2h1u4 && t2w1l10 < t2h1d4 && t2w1l10 < t2w1rwt4 && t2w1l10 < t2w1lwt4 && t2w1l10 < t2h1uwt4 && t2w1l10 < t2h1dwt4
      && t2w1l10 < t2w1r5 && t2w1l10 < t2w1l5 && t2w1l10 < t2h1u5 && t2w1l10 < t2h1d5 && t2w1l10 < t2w1rwt5 && t2w1l10 < t2w1lwt5 && t2w1l10 < t2h1uwt5 && t2w1l10 < t2h1dwt5
      && t2w1l10 < t2w1r6 && t2w1l10 < t2w1l6 && t2w1l10 < t2h1u6 && t2w1l10 < t2h1d6 && t2w1l10 < t2w1rwt6 && t2w1l10 < t2w1lwt6 && t2w1l10 < t2h1uwt6 && t2w1l10 < t2h1dwt6
      && t2w1l10 < t2w1r7 && t2w1l10 < t2w1l7 && t2w1l10 < t2h1u7 && t2w1l10 < t2h1d7 && t2w1l10 < t2w1rwt7 && t2w1l10 < t2w1lwt7 && t2w1l10 < t2h1uwt7 && t2w1l10 < t2h1dwt7
      && t2w1l10 < t2w1r8 && t2w1l10 < t2w1l8 && t2w1l10 < t2h1u8 && t2w1l10 < t2h1d8 && t2w1l10 < t2w1rwt8 && t2w1l10 < t2w1lwt8 && t2w1l10 < t2h1uwt8 && t2w1l10 < t2h1dwt8
      && t2w1l10 < t2w1r9 && t2w1l10 < t2w1l9 && t2w1l10 < t2h1u9 && t2w1l10 < t2h1d9 && t2w1l10 < t2w1rwt9 && t2w1l10 < t2w1lwt9 && t2w1l10 < t2h1uwt9 && t2w1l10 < t2h1dwt9
      && t2w1l10 < t2w1r10 && t2w1l10 < t2h1u10 && t2w1l10 < t2h1d10 && t2w1l10 < t2w1rwt10 && t2w1l10 < t2w1lwt10 && t2w1l10 < t2h1uwt10 && t2w1l10 < t2h1dwt10
      && ((linwl10!=0) && (loutwl10!=0) )){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1l10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1l10+z))*(z0hd10+(vz*t2w1l10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1l10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1l10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1l10+z))*(z0hu10+(vz*t2w1l10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1l10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1l10+y;
  xlimitl=bwl10*sqrt(1-((vz*t2w1l10+z)+z0wl10)*((vz*t2w1l10+z)+z0wl10)/a2wl10);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl10>0){
  i=405;
  }else{
  i=419;
  }
  }

													/* neutron interacts with the parabolic left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl10!=-1 && t2w1l10 > 0 && t2w1l10 < t1 
      && t2w1l10 < t2w1r && t2w1l10 < t2w1l && t2w1l10 < t2h1u && t2w1l10 < t2h1d && t2w1l10 < t2w1rwt && t2w1l10 < t2w1lwt && t2w1l10 < t2h1uwt && t2w1l10 < t2h1dwt
      && t2w1l10 < t2w1r1 && t2w1l10 < t2w1l1 && t2w1l10 < t2h1u1 && t2w1l10 < t2h1d1 && t2w1l10 < t2w1rwt1 && t2w1l10 < t2w1lwt1 && t2w1l10 < t2h1uwt1 && t2w1l10 < t2h1dwt1
      && t2w1l10 < t2w1r2 && t2w1l10 < t2w1l2 && t2w1l10 < t2h1u2 && t2w1l10 < t2h1d2 && t2w1l10 < t2w1rwt2 && t2w1l10 < t2w1lwt2 && t2w1l10 < t2h1uwt2 && t2w1l10 < t2h1dwt2
      && t2w1l10 < t2w1r3 && t2w1l10 < t2w1l3 && t2w1l10 < t2h1u3 && t2w1l10 < t2h1d3 && t2w1l10 < t2w1rwt3 && t2w1l10 < t2w1lwt3 && t2w1l10 < t2h1uwt3 && t2w1l10 < t2h1dwt3
      && t2w1l10 < t2w1r4 && t2w1l10 < t2w1l4 && t2w1l10 < t2h1u4 && t2w1l10 < t2h1d4 && t2w1l10 < t2w1rwt4 && t2w1l10 < t2w1lwt4 && t2w1l10 < t2h1uwt4 && t2w1l10 < t2h1dwt4
      && t2w1l10 < t2w1r5 && t2w1l10 < t2w1l5 && t2w1l10 < t2h1u5 && t2w1l10 < t2h1d5 && t2w1l10 < t2w1rwt5 && t2w1l10 < t2w1lwt5 && t2w1l10 < t2h1uwt5 && t2w1l10 < t2h1dwt5
      && t2w1l10 < t2w1r6 && t2w1l10 < t2w1l6 && t2w1l10 < t2h1u6 && t2w1l10 < t2h1d6 && t2w1l10 < t2w1rwt6 && t2w1l10 < t2w1lwt6 && t2w1l10 < t2h1uwt6 && t2w1l10 < t2h1dwt6
      && t2w1l10 < t2w1r7 && t2w1l10 < t2w1l7 && t2w1l10 < t2h1u7 && t2w1l10 < t2h1d7 && t2w1l10 < t2w1rwt7 && t2w1l10 < t2w1lwt7 && t2w1l10 < t2h1uwt7 && t2w1l10 < t2h1dwt7
      && t2w1l10 < t2w1r8 && t2w1l10 < t2w1l8 && t2w1l10 < t2h1u8 && t2w1l10 < t2h1d8 && t2w1l10 < t2w1rwt8 && t2w1l10 < t2w1lwt8 && t2w1l10 < t2h1uwt8 && t2w1l10 < t2h1dwt8
      && t2w1l10 < t2w1r9 && t2w1l10 < t2w1l9 && t2w1l10 < t2h1u9 && t2w1l10 < t2h1d9 && t2w1l10 < t2w1rwt9 && t2w1l10 < t2w1lwt9 && t2w1l10 < t2h1uwt9 && t2w1l10 < t2h1dwt9
      && t2w1l10 < t2w1r10 && t2w1l10 < t2h1u10 && t2w1l10 < t2h1d10 && t2w1l10 < t2w1rwt10 && t2w1l10 < t2w1lwt10 && t2w1l10 < t2h1uwt10 && t2w1l10 < t2h1dwt10
      && ((loutwl10!=0 && linwl10==0) || (loutwl10==0 && linwl10!=0))){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1l10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1l10+z))*(z0hd10+(vz*t2w1l10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1l10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1l10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1l10+z))*(z0hu10+(vz*t2w1l10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1l10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1l10+y;
  xlimitl=sqrt(pbwl10-(vz*t2w1l10+z)/pawl10);
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl10>0){
  i=406;
  }else{
  i=419;
  }
  }

														/* neutron interacts with the straight left INNER wall - comments are analog to inner elliptic right wall*/

  if (mxl10!=-1 && t2w1l10 > 0 && t2w1l10 < t1 
      && t2w1l10 < t2w1r && t2w1l10 < t2w1l && t2w1l10 < t2h1u && t2w1l10 < t2h1d && t2w1l10 < t2w1rwt && t2w1l10 < t2w1lwt && t2w1l10 < t2h1uwt && t2w1l10 < t2h1dwt
      && t2w1l10 < t2w1r1 && t2w1l10 < t2w1l1 && t2w1l10 < t2h1u1 && t2w1l10 < t2h1d1 && t2w1l10 < t2w1rwt1 && t2w1l10 < t2w1lwt1 && t2w1l10 < t2h1uwt1 && t2w1l10 < t2h1dwt1
      && t2w1l10 < t2w1r2 && t2w1l10 < t2w1l2 && t2w1l10 < t2h1u2 && t2w1l10 < t2h1d2 && t2w1l10 < t2w1rwt2 && t2w1l10 < t2w1lwt2 && t2w1l10 < t2h1uwt2 && t2w1l10 < t2h1dwt2
      && t2w1l10 < t2w1r3 && t2w1l10 < t2w1l3 && t2w1l10 < t2h1u3 && t2w1l10 < t2h1d3 && t2w1l10 < t2w1rwt3 && t2w1l10 < t2w1lwt3 && t2w1l10 < t2h1uwt3 && t2w1l10 < t2h1dwt3
      && t2w1l10 < t2w1r4 && t2w1l10 < t2w1l4 && t2w1l10 < t2h1u4 && t2w1l10 < t2h1d4 && t2w1l10 < t2w1rwt4 && t2w1l10 < t2w1lwt4 && t2w1l10 < t2h1uwt4 && t2w1l10 < t2h1dwt4
      && t2w1l10 < t2w1r5 && t2w1l10 < t2w1l5 && t2w1l10 < t2h1u5 && t2w1l10 < t2h1d5 && t2w1l10 < t2w1rwt5 && t2w1l10 < t2w1lwt5 && t2w1l10 < t2h1uwt5 && t2w1l10 < t2h1dwt5
      && t2w1l10 < t2w1r6 && t2w1l10 < t2w1l6 && t2w1l10 < t2h1u6 && t2w1l10 < t2h1d6 && t2w1l10 < t2w1rwt6 && t2w1l10 < t2w1lwt6 && t2w1l10 < t2h1uwt6 && t2w1l10 < t2h1dwt6
      && t2w1l10 < t2w1r7 && t2w1l10 < t2w1l7 && t2w1l10 < t2h1u7 && t2w1l10 < t2h1d7 && t2w1l10 < t2w1rwt7 && t2w1l10 < t2w1lwt7 && t2w1l10 < t2h1uwt7 && t2w1l10 < t2h1dwt7
      && t2w1l10 < t2w1r8 && t2w1l10 < t2w1l8 && t2w1l10 < t2h1u8 && t2w1l10 < t2h1d8 && t2w1l10 < t2w1rwt8 && t2w1l10 < t2w1lwt8 && t2w1l10 < t2h1uwt8 && t2w1l10 < t2h1dwt8
      && t2w1l10 < t2w1r9 && t2w1l10 < t2w1l9 && t2w1l10 < t2h1u9 && t2w1l10 < t2h1d9 && t2w1l10 < t2w1rwt9 && t2w1l10 < t2w1lwt9 && t2w1l10 < t2h1uwt9 && t2w1l10 < t2h1dwt9
      && t2w1l10 < t2w1r10 && t2w1l10 < t2h1u10 && t2w1l10 < t2h1d10 && t2w1l10 < t2w1rwt10 && t2w1l10 < t2w1lwt10 && t2w1l10 < t2h1uwt10 && t2w1l10 < t2h1dwt10
      && (loutwl10==0 && linwl10==0)){
 if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1l10+z)-h1d10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhd10*sqrt(1-((z0hd10+(vz*t2w1l10+z))*(z0hd10+(vz*t2w1l10+z)))/a2hd10);
      }else{
      ylimitd=-sqrt(((vz*t2w1l10+z)-pbhd10)/-pahd10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1l10+z)+h1u10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhu10*sqrt(1-((z0hu10+(vz*t2w1l10+z))*(z0hu10+(vz*t2w1l10+z)))/a2hu10);
     }else{
     ylimitu=sqrt(((vz*t2w1l10+z)-pbhu10)/-pahu10);
    }
    }
  ytest=vy*t2w1l10+y;
  xlimitl=(w2l10-w1l10)*(vz*t2w1l10+z)/l+w1l10;
  if (ytest>=ylimitd && ytest<=ylimitu && x<=xlimitl && mxl10>0){
  i=407;
  }else{
  i=419;
  }
  }

														/* neutron interacts with the elliptic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu10!=-1 && t2h1u10 > 0 && t2h1u10 < t1 
  && t2h1u10 < t2w1r && t2h1u10 < t2w1l && t2h1u10 < t2h1u && t2h1u10 < t2h1d && t2h1u10 < t2w1rwt && t2h1u10 < t2w1lwt && t2h1u10 < t2h1uwt && t2h1u10 < t2h1dwt
  && t2h1u10 < t2w1r1 && t2h1u10 < t2w1l1 && t2h1u10 < t2h1u1 && t2h1u10 < t2h1d1 && t2h1u10 < t2w1rwt1 && t2h1u10 < t2w1lwt1 && t2h1u10 < t2h1uwt1 && t2h1u10 < t2h1dwt1
  && t2h1u10 < t2w1r2 && t2h1u10 < t2w1l2 && t2h1u10 < t2h1u2 && t2h1u10 < t2h1d2 && t2h1u10 < t2w1rwt2 && t2h1u10 < t2w1lwt2 && t2h1u10 < t2h1uwt2 && t2h1u10 < t2h1dwt2
  && t2h1u10 < t2w1r3 && t2h1u10 < t2w1l3 && t2h1u10 < t2h1u3 && t2h1u10 < t2h1d3 && t2h1u10 < t2w1rwt3 && t2h1u10 < t2w1lwt3 && t2h1u10 < t2h1uwt3 && t2h1u10 < t2h1dwt3
  && t2h1u10 < t2w1r4 && t2h1u10 < t2w1l4 && t2h1u10 < t2h1u4 && t2h1u10 < t2h1d4 && t2h1u10 < t2w1rwt4 && t2h1u10 < t2w1lwt4 && t2h1u10 < t2h1uwt4 && t2h1u10 < t2h1dwt4
  && t2h1u10 < t2w1r5 && t2h1u10 < t2w1l5 && t2h1u10 < t2h1u5 && t2h1u10 < t2h1d5 && t2h1u10 < t2w1rwt5 && t2h1u10 < t2w1lwt5 && t2h1u10 < t2h1uwt5 && t2h1u10 < t2h1dwt5
  && t2h1u10 < t2w1r6 && t2h1u10 < t2w1l6 && t2h1u10 < t2h1u6 && t2h1u10 < t2h1d6 && t2h1u10 < t2w1rwt6 && t2h1u10 < t2w1lwt6 && t2h1u10 < t2h1uwt6 && t2h1u10 < t2h1dwt6
  && t2h1u10 < t2w1r7 && t2h1u10 < t2w1l7 && t2h1u10 < t2h1u7 && t2h1u10 < t2h1d7 && t2h1u10 < t2w1rwt7 && t2h1u10 < t2w1lwt7 && t2h1u10 < t2h1uwt7 && t2h1u10 < t2h1dwt7
  && t2h1u10 < t2w1r8 && t2h1u10 < t2w1l8 && t2h1u10 < t2h1u8 && t2h1u10 < t2h1d8 && t2h1u10 < t2w1rwt8 && t2h1u10 < t2w1lwt8 && t2h1u10 < t2h1uwt8 && t2h1u10 < t2h1dwt8
  && t2h1u10 < t2w1r9 && t2h1u10 < t2w1l9 && t2h1u10 < t2h1u9 && t2h1u10 < t2h1d9 && t2h1u10 < t2w1rwt9 && t2h1u10 < t2w1lwt9 && t2h1u10 < t2h1uwt9 && t2h1u10 < t2h1dwt9
  && t2h1u10 < t2w1r10 && t2h1u10 < t2w1l10 && t2h1u10 < t2h1d10 && t2h1u10 < t2w1rwt10 && t2h1u10 < t2w1lwt10 && t2h1u10 < t2h1uwt10 && t2h1u10 < t2h1dwt10
  && (louthu10 !=0 && linhu10!=0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1u10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1u10+z))*(z0wr10+(vz*t2h1u10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1u10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1u10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1u10+z))*(z0wl10+(vz*t2h1u10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1u10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1u10+x;
  ylimitu=bhu10*sqrt(1-((vz*t2h1u10+z)+z0hu10)*((vz*t2h1u10+z)+z0hu10)/a2hu10);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu10>0 ){
  i=408;
  }else{
  i=420;
  }
  }
	
														/* neutron interacts with the parabolic top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu10!=-1 && t2h1u10 > 0 && t2h1u10 < t1
  && t2h1u10 < t2w1r && t2h1u10 < t2w1l && t2h1u10 < t2h1u && t2h1u10 < t2h1d && t2h1u10 < t2w1rwt && t2h1u10 < t2w1lwt && t2h1u10 < t2h1uwt && t2h1u10 < t2h1dwt
  && t2h1u10 < t2w1r1 && t2h1u10 < t2w1l1 && t2h1u10 < t2h1u1 && t2h1u10 < t2h1d1 && t2h1u10 < t2w1rwt1 && t2h1u10 < t2w1lwt1 && t2h1u10 < t2h1uwt1 && t2h1u10 < t2h1dwt1
  && t2h1u10 < t2w1r2 && t2h1u10 < t2w1l2 && t2h1u10 < t2h1u2 && t2h1u10 < t2h1d2 && t2h1u10 < t2w1rwt2 && t2h1u10 < t2w1lwt2 && t2h1u10 < t2h1uwt2 && t2h1u10 < t2h1dwt2
  && t2h1u10 < t2w1r3 && t2h1u10 < t2w1l3 && t2h1u10 < t2h1u3 && t2h1u10 < t2h1d3 && t2h1u10 < t2w1rwt3 && t2h1u10 < t2w1lwt3 && t2h1u10 < t2h1uwt3 && t2h1u10 < t2h1dwt3
  && t2h1u10 < t2w1r4 && t2h1u10 < t2w1l4 && t2h1u10 < t2h1u4 && t2h1u10 < t2h1d4 && t2h1u10 < t2w1rwt4 && t2h1u10 < t2w1lwt4 && t2h1u10 < t2h1uwt4 && t2h1u10 < t2h1dwt4
  && t2h1u10 < t2w1r5 && t2h1u10 < t2w1l5 && t2h1u10 < t2h1u5 && t2h1u10 < t2h1d5 && t2h1u10 < t2w1rwt5 && t2h1u10 < t2w1lwt5 && t2h1u10 < t2h1uwt5 && t2h1u10 < t2h1dwt5
  && t2h1u10 < t2w1r6 && t2h1u10 < t2w1l6 && t2h1u10 < t2h1u6 && t2h1u10 < t2h1d6 && t2h1u10 < t2w1rwt6 && t2h1u10 < t2w1lwt6 && t2h1u10 < t2h1uwt6 && t2h1u10 < t2h1dwt6
  && t2h1u10 < t2w1r7 && t2h1u10 < t2w1l7 && t2h1u10 < t2h1u7 && t2h1u10 < t2h1d7 && t2h1u10 < t2w1rwt7 && t2h1u10 < t2w1lwt7 && t2h1u10 < t2h1uwt7 && t2h1u10 < t2h1dwt7
  && t2h1u10 < t2w1r8 && t2h1u10 < t2w1l8 && t2h1u10 < t2h1u8 && t2h1u10 < t2h1d8 && t2h1u10 < t2w1rwt8 && t2h1u10 < t2w1lwt8 && t2h1u10 < t2h1uwt8 && t2h1u10 < t2h1dwt8
  && t2h1u10 < t2w1r9 && t2h1u10 < t2w1l9 && t2h1u10 < t2h1u9 && t2h1u10 < t2h1d9 && t2h1u10 < t2w1rwt9 && t2h1u10 < t2w1lwt9 && t2h1u10 < t2h1uwt9 && t2h1u10 < t2h1dwt9
  && t2h1u10 < t2w1r10 && t2h1u10 < t2w1l10 && t2h1u10 < t2h1d10 && t2h1u10 < t2w1rwt10 && t2h1u10 < t2w1lwt10 && t2h1u10 < t2h1uwt10 && t2h1u10 < t2h1dwt10 
  && ((louthu10!=0 && linhu10==0) || (louthu10==0 && linhu10!=0))){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1u10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1u10+z))*(z0wr10+(vz*t2h1u10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1u10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1u10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1u10+z))*(z0wl10+(vz*t2h1u10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1u10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1u10+x;
  ylimitu=sqrt(pbhu10-(vz*t2h1u10+z)/pahu10);
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu10>0){
  i=409;
  }else{
  i=420;
  }
  }


															/* neutron interacts with the straight top INNER wall - comments are analog to inner elliptic right wall*/

  if (myu10!=-1 && t2h1u10 > 0 && t2h1u10 < t1
  && t2h1u10 < t2w1r && t2h1u10 < t2w1l && t2h1u10 < t2h1u && t2h1u10 < t2h1d && t2h1u10 < t2w1rwt && t2h1u10 < t2w1lwt && t2h1u10 < t2h1uwt && t2h1u10 < t2h1dwt
  && t2h1u10 < t2w1r1 && t2h1u10 < t2w1l1 && t2h1u10 < t2h1u1 && t2h1u10 < t2h1d1 && t2h1u10 < t2w1rwt1 && t2h1u10 < t2w1lwt1 && t2h1u10 < t2h1uwt1 && t2h1u10 < t2h1dwt1
  && t2h1u10 < t2w1r2 && t2h1u10 < t2w1l2 && t2h1u10 < t2h1u2 && t2h1u10 < t2h1d2 && t2h1u10 < t2w1rwt2 && t2h1u10 < t2w1lwt2 && t2h1u10 < t2h1uwt2 && t2h1u10 < t2h1dwt2
  && t2h1u10 < t2w1r3 && t2h1u10 < t2w1l3 && t2h1u10 < t2h1u3 && t2h1u10 < t2h1d3 && t2h1u10 < t2w1rwt3 && t2h1u10 < t2w1lwt3 && t2h1u10 < t2h1uwt3 && t2h1u10 < t2h1dwt3
  && t2h1u10 < t2w1r4 && t2h1u10 < t2w1l4 && t2h1u10 < t2h1u4 && t2h1u10 < t2h1d4 && t2h1u10 < t2w1rwt4 && t2h1u10 < t2w1lwt4 && t2h1u10 < t2h1uwt4 && t2h1u10 < t2h1dwt4
  && t2h1u10 < t2w1r5 && t2h1u10 < t2w1l5 && t2h1u10 < t2h1u5 && t2h1u10 < t2h1d5 && t2h1u10 < t2w1rwt5 && t2h1u10 < t2w1lwt5 && t2h1u10 < t2h1uwt5 && t2h1u10 < t2h1dwt5
  && t2h1u10 < t2w1r6 && t2h1u10 < t2w1l6 && t2h1u10 < t2h1u6 && t2h1u10 < t2h1d6 && t2h1u10 < t2w1rwt6 && t2h1u10 < t2w1lwt6 && t2h1u10 < t2h1uwt6 && t2h1u10 < t2h1dwt6
  && t2h1u10 < t2w1r7 && t2h1u10 < t2w1l7 && t2h1u10 < t2h1u7 && t2h1u10 < t2h1d7 && t2h1u10 < t2w1rwt7 && t2h1u10 < t2w1lwt7 && t2h1u10 < t2h1uwt7 && t2h1u10 < t2h1dwt7
  && t2h1u10 < t2w1r8 && t2h1u10 < t2w1l8 && t2h1u10 < t2h1u8 && t2h1u10 < t2h1d8 && t2h1u10 < t2w1rwt8 && t2h1u10 < t2w1lwt8 && t2h1u10 < t2h1uwt8 && t2h1u10 < t2h1dwt8
  && t2h1u10 < t2w1r9 && t2h1u10 < t2w1l9 && t2h1u10 < t2h1u9 && t2h1u10 < t2h1d9 && t2h1u10 < t2w1rwt9 && t2h1u10 < t2w1lwt9 && t2h1u10 < t2h1uwt9 && t2h1u10 < t2h1dwt9
  && t2h1u10 < t2w1r10 && t2h1u10 < t2w1l10 && t2h1u10 < t2h1d10 && t2h1u10 < t2w1rwt10 && t2h1u10 < t2w1lwt10 && t2h1u10 < t2h1uwt10 && t2h1u10 < t2h1dwt10
  && (louthu10 == 0 && linhu10 == 0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1u10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1u10+z))*(z0wr10+(vz*t2h1u10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1u10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1u10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1u10+z))*(z0wl10+(vz*t2h1u10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1u10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1u10+x;
  ylimitu=(h2u10-h1u10)*(vz*t2h1u10+z)/l+h1u10;
  if (xtest>=xlimitr && xtest<=xlimitl && y<=ylimitu && myu10>0 ){
  i=410;
  }else{
  i=420;
  }
  }

															/* neutron interacts with the elliptic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd10!=-1 && t2h1d10 > 0 && t2h1d10 < t1 
  && t2h1d10 < t2w1r && t2h1d10 < t2w1l && t2h1d10 < t2h1u && t2h1d10 < t2h1d && t2h1d10 < t2w1rwt && t2h1d10 < t2w1lwt && t2h1d10 < t2h1uwt && t2h1d10 < t2h1dwt
  && t2h1d10 < t2w1r1 && t2h1d10 < t2w1l1 && t2h1d10 < t2h1u1 && t2h1d10 < t2h1d1 && t2h1d10 < t2w1rwt1 && t2h1d10 < t2w1lwt1 && t2h1d10 < t2h1uwt1 && t2h1d10 < t2h1dwt1
  && t2h1d10 < t2w1r2 && t2h1d10 < t2w1l2 && t2h1d10 < t2h1u2 && t2h1d10 < t2h1d2 && t2h1d10 < t2w1rwt2 && t2h1d10 < t2w1lwt2 && t2h1d10 < t2h1uwt2 && t2h1d10 < t2h1dwt2
  && t2h1d10 < t2w1r3 && t2h1d10 < t2w1l3 && t2h1d10 < t2h1u3 && t2h1d10 < t2h1d3 && t2h1d10 < t2w1rwt3 && t2h1d10 < t2w1lwt3 && t2h1d10 < t2h1uwt3 && t2h1d10 < t2h1dwt3
  && t2h1d10 < t2w1r4 && t2h1d10 < t2w1l4 && t2h1d10 < t2h1u4 && t2h1d10 < t2h1d4 && t2h1d10 < t2w1rwt4 && t2h1d10 < t2w1lwt4 && t2h1d10 < t2h1uwt4 && t2h1d10 < t2h1dwt4
  && t2h1d10 < t2w1r5 && t2h1d10 < t2w1l5 && t2h1d10 < t2h1u5 && t2h1d10 < t2h1d5 && t2h1d10 < t2w1rwt5 && t2h1d10 < t2w1lwt5 && t2h1d10 < t2h1uwt5 && t2h1d10 < t2h1dwt5
  && t2h1d10 < t2w1r6 && t2h1d10 < t2w1l6 && t2h1d10 < t2h1u6 && t2h1d10 < t2h1d6 && t2h1d10 < t2w1rwt6 && t2h1d10 < t2w1lwt6 && t2h1d10 < t2h1uwt6 && t2h1d10 < t2h1dwt6
  && t2h1d10 < t2w1r7 && t2h1d10 < t2w1l7 && t2h1d10 < t2h1u7 && t2h1d10 < t2h1d7 && t2h1d10 < t2w1rwt7 && t2h1d10 < t2w1lwt7 && t2h1d10 < t2h1uwt7 && t2h1d10 < t2h1dwt7
  && t2h1d10 < t2w1r8 && t2h1d10 < t2w1l8 && t2h1d10 < t2h1u8 && t2h1d10 < t2h1d8 && t2h1d10 < t2w1rwt8 && t2h1d10 < t2w1lwt8 && t2h1d10 < t2h1uwt8 && t2h1d10 < t2h1dwt8
  && t2h1d10 < t2w1r9 && t2h1d10 < t2w1l9 && t2h1d10 < t2h1u9 && t2h1d10 < t2h1d9 && t2h1d10 < t2w1rwt9 && t2h1d10 < t2w1lwt9 && t2h1d10 < t2h1uwt9 && t2h1d10 < t2h1dwt9
  && t2h1d10 < t2w1r10 && t2h1d10 < t2w1l10 && t2h1d10 < t2h1u10 && t2h1d10 < t2w1rwt10 && t2h1d10 < t2w1lwt10 && t2h1d10 < t2h1uwt10 && t2h1d10 < t2h1dwt10
  && (louthd10 !=0 && linhd10!=0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1d10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1d10+z))*(z0wr10+(vz*t2h1d10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1d10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1d10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1d10+z))*(z0wl10+(vz*t2h1d10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1d10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1d10+x;
  ylimitd=-bhd10*sqrt(1-((vz*t2h1d10+z)+z0hd10)*((vz*t2h1d10+z)+z0hd10)/a2hd10);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd10>0){
  i=411;
  }else{
  i=421;
  }
  }

															/* neutron interacts with the parabolic down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd10!=-1 && t2h1d10 > 0 && t2h1d10 < t1 
  && t2h1d10 < t2w1r && t2h1d10 < t2w1l && t2h1d10 < t2h1u && t2h1d10 < t2h1d && t2h1d10 < t2w1rwt && t2h1d10 < t2w1lwt && t2h1d10 < t2h1uwt && t2h1d10 < t2h1dwt
  && t2h1d10 < t2w1r1 && t2h1d10 < t2w1l1 && t2h1d10 < t2h1u1 && t2h1d10 < t2h1d1 && t2h1d10 < t2w1rwt1 && t2h1d10 < t2w1lwt1 && t2h1d10 < t2h1uwt1 && t2h1d10 < t2h1dwt1
  && t2h1d10 < t2w1r2 && t2h1d10 < t2w1l2 && t2h1d10 < t2h1u2 && t2h1d10 < t2h1d2 && t2h1d10 < t2w1rwt2 && t2h1d10 < t2w1lwt2 && t2h1d10 < t2h1uwt2 && t2h1d10 < t2h1dwt2
  && t2h1d10 < t2w1r3 && t2h1d10 < t2w1l3 && t2h1d10 < t2h1u3 && t2h1d10 < t2h1d3 && t2h1d10 < t2w1rwt3 && t2h1d10 < t2w1lwt3 && t2h1d10 < t2h1uwt3 && t2h1d10 < t2h1dwt3
  && t2h1d10 < t2w1r4 && t2h1d10 < t2w1l4 && t2h1d10 < t2h1u4 && t2h1d10 < t2h1d4 && t2h1d10 < t2w1rwt4 && t2h1d10 < t2w1lwt4 && t2h1d10 < t2h1uwt4 && t2h1d10 < t2h1dwt4
  && t2h1d10 < t2w1r5 && t2h1d10 < t2w1l5 && t2h1d10 < t2h1u5 && t2h1d10 < t2h1d5 && t2h1d10 < t2w1rwt5 && t2h1d10 < t2w1lwt5 && t2h1d10 < t2h1uwt5 && t2h1d10 < t2h1dwt5
  && t2h1d10 < t2w1r6 && t2h1d10 < t2w1l6 && t2h1d10 < t2h1u6 && t2h1d10 < t2h1d6 && t2h1d10 < t2w1rwt6 && t2h1d10 < t2w1lwt6 && t2h1d10 < t2h1uwt6 && t2h1d10 < t2h1dwt6
  && t2h1d10 < t2w1r7 && t2h1d10 < t2w1l7 && t2h1d10 < t2h1u7 && t2h1d10 < t2h1d7 && t2h1d10 < t2w1rwt7 && t2h1d10 < t2w1lwt7 && t2h1d10 < t2h1uwt7 && t2h1d10 < t2h1dwt7
  && t2h1d10 < t2w1r8 && t2h1d10 < t2w1l8 && t2h1d10 < t2h1u8 && t2h1d10 < t2h1d8 && t2h1d10 < t2w1rwt8 && t2h1d10 < t2w1lwt8 && t2h1d10 < t2h1uwt8 && t2h1d10 < t2h1dwt8
  && t2h1d10 < t2w1r9 && t2h1d10 < t2w1l9 && t2h1d10 < t2h1u9 && t2h1d10 < t2h1d9 && t2h1d10 < t2w1rwt9 && t2h1d10 < t2w1lwt9 && t2h1d10 < t2h1uwt9 && t2h1d10 < t2h1dwt9
  && t2h1d10 < t2w1r10 && t2h1d10 < t2w1l10 && t2h1d10 < t2h1u10 && t2h1d10 < t2w1rwt10 && t2h1d10 < t2w1lwt10 && t2h1d10 < t2h1uwt10 && t2h1d10 < t2h1dwt10
  && ((louthd10 !=0 && linhd10==0) || (louthd10 ==0 && linhd10!=0))){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1d10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1d10+z))*(z0wr10+(vz*t2h1d10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1d10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1d10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1d10+z))*(z0wl10+(vz*t2h1d10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1d10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1d10+x;
  ylimitd=-sqrt(pbhd10-(vz*t2h1d10+z)/pahd10);
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd10>0 ){
  i=412;
  }else{
  i=421;
  }
  }

															/* neutron interacts with the straight down INNER wall - comments are analog to inner elliptic right wall*/

  if (myd10!=-1 && t2h1d10 > 0 && t2h1d10 < t1 
  && t2h1d10 < t2w1r && t2h1d10 < t2w1l && t2h1d10 < t2h1u && t2h1d10 < t2h1d && t2h1d10 < t2w1rwt && t2h1d10 < t2w1lwt && t2h1d10 < t2h1uwt && t2h1d10 < t2h1dwt
  && t2h1d10 < t2w1r1 && t2h1d10 < t2w1l1 && t2h1d10 < t2h1u1 && t2h1d10 < t2h1d1 && t2h1d10 < t2w1rwt1 && t2h1d10 < t2w1lwt1 && t2h1d10 < t2h1uwt1 && t2h1d10 < t2h1dwt1
  && t2h1d10 < t2w1r2 && t2h1d10 < t2w1l2 && t2h1d10 < t2h1u2 && t2h1d10 < t2h1d2 && t2h1d10 < t2w1rwt2 && t2h1d10 < t2w1lwt2 && t2h1d10 < t2h1uwt2 && t2h1d10 < t2h1dwt2
  && t2h1d10 < t2w1r3 && t2h1d10 < t2w1l3 && t2h1d10 < t2h1u3 && t2h1d10 < t2h1d3 && t2h1d10 < t2w1rwt3 && t2h1d10 < t2w1lwt3 && t2h1d10 < t2h1uwt3 && t2h1d10 < t2h1dwt3
  && t2h1d10 < t2w1r4 && t2h1d10 < t2w1l4 && t2h1d10 < t2h1u4 && t2h1d10 < t2h1d4 && t2h1d10 < t2w1rwt4 && t2h1d10 < t2w1lwt4 && t2h1d10 < t2h1uwt4 && t2h1d10 < t2h1dwt4
  && t2h1d10 < t2w1r5 && t2h1d10 < t2w1l5 && t2h1d10 < t2h1u5 && t2h1d10 < t2h1d5 && t2h1d10 < t2w1rwt5 && t2h1d10 < t2w1lwt5 && t2h1d10 < t2h1uwt5 && t2h1d10 < t2h1dwt5
  && t2h1d10 < t2w1r6 && t2h1d10 < t2w1l6 && t2h1d10 < t2h1u6 && t2h1d10 < t2h1d6 && t2h1d10 < t2w1rwt6 && t2h1d10 < t2w1lwt6 && t2h1d10 < t2h1uwt6 && t2h1d10 < t2h1dwt6
  && t2h1d10 < t2w1r7 && t2h1d10 < t2w1l7 && t2h1d10 < t2h1u7 && t2h1d10 < t2h1d7 && t2h1d10 < t2w1rwt7 && t2h1d10 < t2w1lwt7 && t2h1d10 < t2h1uwt7 && t2h1d10 < t2h1dwt7
  && t2h1d10 < t2w1r8 && t2h1d10 < t2w1l8 && t2h1d10 < t2h1u8 && t2h1d10 < t2h1d8 && t2h1d10 < t2w1rwt8 && t2h1d10 < t2w1lwt8 && t2h1d10 < t2h1uwt8 && t2h1d10 < t2h1dwt8
  && t2h1d10 < t2w1r9 && t2h1d10 < t2w1l9 && t2h1d10 < t2h1u9 && t2h1d10 < t2h1d9 && t2h1d10 < t2w1rwt9 && t2h1d10 < t2w1lwt9 && t2h1d10 < t2h1uwt9 && t2h1d10 < t2h1dwt9
  && t2h1d10 < t2w1r10 && t2h1d10 < t2w1l10 && t2h1d10 < t2h1u10 && t2h1d10 < t2w1rwt10 && t2h1d10 < t2w1lwt10 && t2h1d10 < t2h1uwt10 && t2h1d10 < t2h1dwt10
  && (louthd10 == 0 && linhd10 == 0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1d10+z)-w1r10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwr10*sqrt(1-((z0wr10+(vz*t2h1d10+z))*(z0wr10+(vz*t2h1d10+z)))/a2wr10);
    }else{
    xlimitr=-sqrt(((vz*t2h1d10+z)-pbwr10)/-pawr10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1d10+z)+w1l10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwl10*sqrt(1-((z0wl10+(vz*t2h1d10+z))*(z0wl10+(vz*t2h1d10+z)))/a2wl10);
      }else{
      xlimitl=sqrt(((vz*t2h1d10+z)-pbwl10)/-pawl10);
      }
   }
  xtest=vx*t2h1d10+x;
  ylimitd=(-h2d10+h1d10)*(vz*t2h1d10+z)/l-h1d10;
  if (xtest>=xlimitr && xtest<=xlimitl && y>=ylimitd && myd10>0 ){
  i=413;
  }else{
  i=421;
  }
  }

   /* SAME INTERACTIONS BUT TRANSPERENT INNER WALLS - in these cases no limit check up is needed , because will neutrons will pass unchanged anyway*/

  if (mxr10==-1 && t2w1r10 > 0 && t2w1r10 < t1 
     && t2w1r10 < t2w1r && t2w1r10 < t2w1l && t2w1r10 < t2h1u && t2w1r10 < t2h1d && t2w1r10 < t2w1rwt && t2w1r10 < t2w1lwt && t2w1r10 < t2h1uwt && t2w1r10 < t2h1dwt
     && t2w1r10 < t2w1r1 && t2w1r10 < t2w1l1 && t2w1r10 < t2h1u1 && t2w1r10 < t2h1d1 && t2w1r10 < t2w1rwt1 && t2w1r10 < t2w1lwt1 && t2w1r10 < t2h1uwt1 && t2w1r10 < t2h1dwt1
     && t2w1r10 < t2w1r2 && t2w1r10 < t2w1l2 && t2w1r10 < t2h1u2 && t2w1r10 < t2h1d2 && t2w1r10 < t2w1rwt2 && t2w1r10 < t2w1lwt2 && t2w1r10 < t2h1uwt2 && t2w1r10 < t2h1dwt2 
     && t2w1r10 < t2w1r3 && t2w1r10 < t2w1l3 && t2w1r10 < t2h1u3 && t2w1r10 < t2h1d3 && t2w1r10 < t2w1rwt3 && t2w1r10 < t2w1lwt3 && t2w1r10 < t2h1uwt3 && t2w1r10 < t2h1dwt3
     && t2w1r10 < t2w1r4 && t2w1r10 < t2w1l4 && t2w1r10 < t2h1u4 && t2w1r10 < t2h1d4 && t2w1r10 < t2w1rwt4 && t2w1r10 < t2w1lwt4 && t2w1r10 < t2h1uwt4 && t2w1r10 < t2h1dwt4
     && t2w1r10 < t2w1r5 && t2w1r10 < t2w1l5 && t2w1r10 < t2h1u5 && t2w1r10 < t2h1d5 && t2w1r10 < t2w1rwt5 && t2w1r10 < t2w1lwt5 && t2w1r10 < t2h1uwt5 && t2w1r10 < t2h1dwt5
     && t2w1r10 < t2w1r6 && t2w1r10 < t2w1l6 && t2w1r10 < t2h1u6 && t2w1r10 < t2h1d6 && t2w1r10 < t2w1rwt6 && t2w1r10 < t2w1lwt6 && t2w1r10 < t2h1uwt6 && t2w1r10 < t2h1dwt6
     && t2w1r10 < t2w1r7 && t2w1r10 < t2w1l7 && t2w1r10 < t2h1u7 && t2w1r10 < t2h1d7 && t2w1r10 < t2w1rwt7 && t2w1r10 < t2w1lwt7 && t2w1r10 < t2h1uwt7 && t2w1r10 < t2h1dwt7
     && t2w1r10 < t2w1r8 && t2w1r10 < t2w1l8 && t2w1r10 < t2h1u8 && t2w1r10 < t2h1d8 && t2w1r10 < t2w1rwt8 && t2w1r10 < t2w1lwt8 && t2w1r10 < t2h1uwt8 && t2w1r10 < t2h1dwt8
     && t2w1r10 < t2w1r9 && t2w1r10 < t2w1l9 && t2w1r10 < t2h1u9 && t2w1r10 < t2h1d9 && t2w1r10 < t2w1rwt9 && t2w1r10 < t2w1lwt9 && t2w1r10 < t2h1uwt9 && t2w1r10 < t2h1dwt9
     && t2w1r10 < t2w1l10 && t2w1r10 < t2h1u10 && t2w1r10 < t2h1d10 && t2w1r10 < t2w1rwt10 && t2w1r10 < t2w1lwt10 && t2w1r10 < t2h1uwt10 && t2w1r10 < t2h1dwt10
     && ((linwr10!=0) && (loutwr10!=0) )) {
  i=414;
  }

  if (mxr10==-1 && t2w1r10 > 0 && t2w1r10 < t1 
     && t2w1r10 < t2w1r && t2w1r10 < t2w1l && t2w1r10 < t2h1u && t2w1r10 < t2h1d && t2w1r10 < t2w1rwt && t2w1r10 < t2w1lwt && t2w1r10 < t2h1uwt && t2w1r10 < t2h1dwt
     && t2w1r10 < t2w1r1 && t2w1r10 < t2w1l1 && t2w1r10 < t2h1u1 && t2w1r10 < t2h1d1 && t2w1r10 < t2w1rwt1 && t2w1r10 < t2w1lwt1 && t2w1r10 < t2h1uwt1 && t2w1r10 < t2h1dwt1
     && t2w1r10 < t2w1r2 && t2w1r10 < t2w1l2 && t2w1r10 < t2h1u2 && t2w1r10 < t2h1d2 && t2w1r10 < t2w1rwt2 && t2w1r10 < t2w1lwt2 && t2w1r10 < t2h1uwt2 && t2w1r10 < t2h1dwt2 
     && t2w1r10 < t2w1r3 && t2w1r10 < t2w1l3 && t2w1r10 < t2h1u3 && t2w1r10 < t2h1d3 && t2w1r10 < t2w1rwt3 && t2w1r10 < t2w1lwt3 && t2w1r10 < t2h1uwt3 && t2w1r10 < t2h1dwt3
     && t2w1r10 < t2w1r4 && t2w1r10 < t2w1l4 && t2w1r10 < t2h1u4 && t2w1r10 < t2h1d4 && t2w1r10 < t2w1rwt4 && t2w1r10 < t2w1lwt4 && t2w1r10 < t2h1uwt4 && t2w1r10 < t2h1dwt4
     && t2w1r10 < t2w1r5 && t2w1r10 < t2w1l5 && t2w1r10 < t2h1u5 && t2w1r10 < t2h1d5 && t2w1r10 < t2w1rwt5 && t2w1r10 < t2w1lwt5 && t2w1r10 < t2h1uwt5 && t2w1r10 < t2h1dwt5
     && t2w1r10 < t2w1r6 && t2w1r10 < t2w1l6 && t2w1r10 < t2h1u6 && t2w1r10 < t2h1d6 && t2w1r10 < t2w1rwt6 && t2w1r10 < t2w1lwt6 && t2w1r10 < t2h1uwt6 && t2w1r10 < t2h1dwt6
     && t2w1r10 < t2w1r7 && t2w1r10 < t2w1l7 && t2w1r10 < t2h1u7 && t2w1r10 < t2h1d7 && t2w1r10 < t2w1rwt7 && t2w1r10 < t2w1lwt7 && t2w1r10 < t2h1uwt7 && t2w1r10 < t2h1dwt7
     && t2w1r10 < t2w1r8 && t2w1r10 < t2w1l8 && t2w1r10 < t2h1u8 && t2w1r10 < t2h1d8 && t2w1r10 < t2w1rwt8 && t2w1r10 < t2w1lwt8 && t2w1r10 < t2h1uwt8 && t2w1r10 < t2h1dwt8
     && t2w1r10 < t2w1r9 && t2w1r10 < t2w1l9 && t2w1r10 < t2h1u9 && t2w1r10 < t2h1d9 && t2w1r10 < t2w1rwt9 && t2w1r10 < t2w1lwt9 && t2w1r10 < t2h1uwt9 && t2w1r10 < t2h1dwt9
     && t2w1r10 < t2w1l10 && t2w1r10 < t2h1u10 && t2w1r10 < t2h1d10 && t2w1r10 < t2w1rwt10 && t2w1r10 < t2w1lwt10 && t2w1r10 < t2h1uwt10 && t2w1r10 < t2h1dwt10
     && ((loutwr10!=0 && linwr10==0) || (loutwr10==0 && linwr10!=0))){
  i=414;
  }

  if (mxr10==-1 && t2w1r10 > 0 && t2w1r10 < t1 
     && t2w1r10 < t2w1r && t2w1r10 < t2w1l && t2w1r10 < t2h1u && t2w1r10 < t2h1d && t2w1r10 < t2w1rwt && t2w1r10 < t2w1lwt && t2w1r10 < t2h1uwt && t2w1r10 < t2h1dwt
     && t2w1r10 < t2w1r1 && t2w1r10 < t2w1l1 && t2w1r10 < t2h1u1 && t2w1r10 < t2h1d1 && t2w1r10 < t2w1rwt1 && t2w1r10 < t2w1lwt1 && t2w1r10 < t2h1uwt1 && t2w1r10 < t2h1dwt1
     && t2w1r10 < t2w1r2 && t2w1r10 < t2w1l2 && t2w1r10 < t2h1u2 && t2w1r10 < t2h1d2 && t2w1r10 < t2w1rwt2 && t2w1r10 < t2w1lwt2 && t2w1r10 < t2h1uwt2 && t2w1r10 < t2h1dwt2 
     && t2w1r10 < t2w1r3 && t2w1r10 < t2w1l3 && t2w1r10 < t2h1u3 && t2w1r10 < t2h1d3 && t2w1r10 < t2w1rwt3 && t2w1r10 < t2w1lwt3 && t2w1r10 < t2h1uwt3 && t2w1r10 < t2h1dwt3
     && t2w1r10 < t2w1r4 && t2w1r10 < t2w1l4 && t2w1r10 < t2h1u4 && t2w1r10 < t2h1d4 && t2w1r10 < t2w1rwt4 && t2w1r10 < t2w1lwt4 && t2w1r10 < t2h1uwt4 && t2w1r10 < t2h1dwt4
     && t2w1r10 < t2w1r5 && t2w1r10 < t2w1l5 && t2w1r10 < t2h1u5 && t2w1r10 < t2h1d5 && t2w1r10 < t2w1rwt5 && t2w1r10 < t2w1lwt5 && t2w1r10 < t2h1uwt5 && t2w1r10 < t2h1dwt5
     && t2w1r10 < t2w1r6 && t2w1r10 < t2w1l6 && t2w1r10 < t2h1u6 && t2w1r10 < t2h1d6 && t2w1r10 < t2w1rwt6 && t2w1r10 < t2w1lwt6 && t2w1r10 < t2h1uwt6 && t2w1r10 < t2h1dwt6
     && t2w1r10 < t2w1r7 && t2w1r10 < t2w1l7 && t2w1r10 < t2h1u7 && t2w1r10 < t2h1d7 && t2w1r10 < t2w1rwt7 && t2w1r10 < t2w1lwt7 && t2w1r10 < t2h1uwt7 && t2w1r10 < t2h1dwt7
     && t2w1r10 < t2w1r8 && t2w1r10 < t2w1l8 && t2w1r10 < t2h1u8 && t2w1r10 < t2h1d8 && t2w1r10 < t2w1rwt8 && t2w1r10 < t2w1lwt8 && t2w1r10 < t2h1uwt8 && t2w1r10 < t2h1dwt8
     && t2w1r10 < t2w1r9 && t2w1r10 < t2w1l9 && t2w1r10 < t2h1u9 && t2w1r10 < t2h1d9 && t2w1r10 < t2w1rwt9 && t2w1r10 < t2w1lwt9 && t2w1r10 < t2h1uwt9 && t2w1r10 < t2h1dwt9
     && t2w1r10 < t2w1l10 && t2w1r10 < t2h1u10 && t2w1r10 < t2h1d10 && t2w1r10 < t2w1rwt10 && t2w1r10 < t2w1lwt10 && t2w1r10 < t2h1uwt10 && t2w1r10 < t2h1dwt10
     && (loutwr10==0 && linwr10==0)){
  i=414;
  }

  if (mxl10==-1 && t2w1l10 > 0 && t2w1l10 < t1 
      && t2w1l10 < t2w1r && t2w1l10 < t2w1l && t2w1l10 < t2h1u && t2w1l10 < t2h1d && t2w1l10 < t2w1rwt && t2w1l10 < t2w1lwt && t2w1l10 < t2h1uwt && t2w1l10 < t2h1dwt
      && t2w1l10 < t2w1r1 && t2w1l10 < t2w1l1 && t2w1l10 < t2h1u1 && t2w1l10 < t2h1d1 && t2w1l10 < t2w1rwt1 && t2w1l10 < t2w1lwt1 && t2w1l10 < t2h1uwt1 && t2w1l10 < t2h1dwt1
      && t2w1l10 < t2w1r2 && t2w1l10 < t2w1l2 && t2w1l10 < t2h1u2 && t2w1l10 < t2h1d2 && t2w1l10 < t2w1rwt2 && t2w1l10 < t2w1lwt2 && t2w1l10 < t2h1uwt2 && t2w1l10 < t2h1dwt2
      && t2w1l10 < t2w1r3 && t2w1l10 < t2w1l3 && t2w1l10 < t2h1u3 && t2w1l10 < t2h1d3 && t2w1l10 < t2w1rwt3 && t2w1l10 < t2w1lwt3 && t2w1l10 < t2h1uwt3 && t2w1l10 < t2h1dwt3
      && t2w1l10 < t2w1r4 && t2w1l10 < t2w1l4 && t2w1l10 < t2h1u4 && t2w1l10 < t2h1d4 && t2w1l10 < t2w1rwt4 && t2w1l10 < t2w1lwt4 && t2w1l10 < t2h1uwt4 && t2w1l10 < t2h1dwt4
      && t2w1l10 < t2w1r5 && t2w1l10 < t2w1l5 && t2w1l10 < t2h1u5 && t2w1l10 < t2h1d5 && t2w1l10 < t2w1rwt5 && t2w1l10 < t2w1lwt5 && t2w1l10 < t2h1uwt5 && t2w1l10 < t2h1dwt5
      && t2w1l10 < t2w1r6 && t2w1l10 < t2w1l6 && t2w1l10 < t2h1u6 && t2w1l10 < t2h1d6 && t2w1l10 < t2w1rwt6 && t2w1l10 < t2w1lwt6 && t2w1l10 < t2h1uwt6 && t2w1l10 < t2h1dwt6
      && t2w1l10 < t2w1r7 && t2w1l10 < t2w1l7 && t2w1l10 < t2h1u7 && t2w1l10 < t2h1d7 && t2w1l10 < t2w1rwt7 && t2w1l10 < t2w1lwt7 && t2w1l10 < t2h1uwt7 && t2w1l10 < t2h1dwt7
      && t2w1l10 < t2w1r8 && t2w1l10 < t2w1l8 && t2w1l10 < t2h1u8 && t2w1l10 < t2h1d8 && t2w1l10 < t2w1rwt8 && t2w1l10 < t2w1lwt8 && t2w1l10 < t2h1uwt8 && t2w1l10 < t2h1dwt8
      && t2w1l10 < t2w1r9 && t2w1l10 < t2w1l9 && t2w1l10 < t2h1u9 && t2w1l10 < t2h1d9 && t2w1l10 < t2w1rwt9 && t2w1l10 < t2w1lwt9 && t2w1l10 < t2h1uwt9 && t2w1l10 < t2h1dwt9
      && t2w1l10 < t2w1r10 && t2w1l10 < t2h1u10 && t2w1l10 < t2h1d10 && t2w1l10 < t2w1rwt10 && t2w1l10 < t2w1lwt10 && t2w1l10 < t2h1uwt10 && t2w1l10 < t2h1dwt10
      && ((linwl10!=0) && (loutwl10!=0) )){
  i=415;
  }

  if (mxl10==-1 && t2w1l10 > 0 && t2w1l10 < t1 
      && t2w1l10 < t2w1r && t2w1l10 < t2w1l && t2w1l10 < t2h1u && t2w1l10 < t2h1d && t2w1l10 < t2w1rwt && t2w1l10 < t2w1lwt && t2w1l10 < t2h1uwt && t2w1l10 < t2h1dwt
      && t2w1l10 < t2w1r1 && t2w1l10 < t2w1l1 && t2w1l10 < t2h1u1 && t2w1l10 < t2h1d1 && t2w1l10 < t2w1rwt1 && t2w1l10 < t2w1lwt1 && t2w1l10 < t2h1uwt1 && t2w1l10 < t2h1dwt1
      && t2w1l10 < t2w1r2 && t2w1l10 < t2w1l2 && t2w1l10 < t2h1u2 && t2w1l10 < t2h1d2 && t2w1l10 < t2w1rwt2 && t2w1l10 < t2w1lwt2 && t2w1l10 < t2h1uwt2 && t2w1l10 < t2h1dwt2
      && t2w1l10 < t2w1r3 && t2w1l10 < t2w1l3 && t2w1l10 < t2h1u3 && t2w1l10 < t2h1d3 && t2w1l10 < t2w1rwt3 && t2w1l10 < t2w1lwt3 && t2w1l10 < t2h1uwt3 && t2w1l10 < t2h1dwt3
      && t2w1l10 < t2w1r4 && t2w1l10 < t2w1l4 && t2w1l10 < t2h1u4 && t2w1l10 < t2h1d4 && t2w1l10 < t2w1rwt4 && t2w1l10 < t2w1lwt4 && t2w1l10 < t2h1uwt4 && t2w1l10 < t2h1dwt4
      && t2w1l10 < t2w1r5 && t2w1l10 < t2w1l5 && t2w1l10 < t2h1u5 && t2w1l10 < t2h1d5 && t2w1l10 < t2w1rwt5 && t2w1l10 < t2w1lwt5 && t2w1l10 < t2h1uwt5 && t2w1l10 < t2h1dwt5
      && t2w1l10 < t2w1r6 && t2w1l10 < t2w1l6 && t2w1l10 < t2h1u6 && t2w1l10 < t2h1d6 && t2w1l10 < t2w1rwt6 && t2w1l10 < t2w1lwt6 && t2w1l10 < t2h1uwt6 && t2w1l10 < t2h1dwt6
      && t2w1l10 < t2w1r7 && t2w1l10 < t2w1l7 && t2w1l10 < t2h1u7 && t2w1l10 < t2h1d7 && t2w1l10 < t2w1rwt7 && t2w1l10 < t2w1lwt7 && t2w1l10 < t2h1uwt7 && t2w1l10 < t2h1dwt7
      && t2w1l10 < t2w1r8 && t2w1l10 < t2w1l8 && t2w1l10 < t2h1u8 && t2w1l10 < t2h1d8 && t2w1l10 < t2w1rwt8 && t2w1l10 < t2w1lwt8 && t2w1l10 < t2h1uwt8 && t2w1l10 < t2h1dwt8
      && t2w1l10 < t2w1r9 && t2w1l10 < t2w1l9 && t2w1l10 < t2h1u9 && t2w1l10 < t2h1d9 && t2w1l10 < t2w1rwt9 && t2w1l10 < t2w1lwt9 && t2w1l10 < t2h1uwt9 && t2w1l10 < t2h1dwt9
      && t2w1l10 < t2w1r10 && t2w1l10 < t2h1u10 && t2w1l10 < t2h1d10 && t2w1l10 < t2w1rwt10 && t2w1l10 < t2w1lwt10 && t2w1l10 < t2h1uwt10 && t2w1l10 < t2h1dwt10
      &&  ((loutwl10!=0 && linwl10==0) || (loutwl10==0 && linwl10!=0))){
  i=415;
  }

  if (mxl10==-1 && t2w1l10 > 0 && t2w1l10 < t1 
      && t2w1l10 < t2w1r && t2w1l10 < t2w1l && t2w1l10 < t2h1u && t2w1l10 < t2h1d && t2w1l10 < t2w1rwt && t2w1l10 < t2w1lwt && t2w1l10 < t2h1uwt && t2w1l10 < t2h1dwt
      && t2w1l10 < t2w1r1 && t2w1l10 < t2w1l1 && t2w1l10 < t2h1u1 && t2w1l10 < t2h1d1 && t2w1l10 < t2w1rwt1 && t2w1l10 < t2w1lwt1 && t2w1l10 < t2h1uwt1 && t2w1l10 < t2h1dwt1
      && t2w1l10 < t2w1r2 && t2w1l10 < t2w1l2 && t2w1l10 < t2h1u2 && t2w1l10 < t2h1d2 && t2w1l10 < t2w1rwt2 && t2w1l10 < t2w1lwt2 && t2w1l10 < t2h1uwt2 && t2w1l10 < t2h1dwt2
      && t2w1l10 < t2w1r3 && t2w1l10 < t2w1l3 && t2w1l10 < t2h1u3 && t2w1l10 < t2h1d3 && t2w1l10 < t2w1rwt3 && t2w1l10 < t2w1lwt3 && t2w1l10 < t2h1uwt3 && t2w1l10 < t2h1dwt3
      && t2w1l10 < t2w1r4 && t2w1l10 < t2w1l4 && t2w1l10 < t2h1u4 && t2w1l10 < t2h1d4 && t2w1l10 < t2w1rwt4 && t2w1l10 < t2w1lwt4 && t2w1l10 < t2h1uwt4 && t2w1l10 < t2h1dwt4
      && t2w1l10 < t2w1r5 && t2w1l10 < t2w1l5 && t2w1l10 < t2h1u5 && t2w1l10 < t2h1d5 && t2w1l10 < t2w1rwt5 && t2w1l10 < t2w1lwt5 && t2w1l10 < t2h1uwt5 && t2w1l10 < t2h1dwt5
      && t2w1l10 < t2w1r6 && t2w1l10 < t2w1l6 && t2w1l10 < t2h1u6 && t2w1l10 < t2h1d6 && t2w1l10 < t2w1rwt6 && t2w1l10 < t2w1lwt6 && t2w1l10 < t2h1uwt6 && t2w1l10 < t2h1dwt6
      && t2w1l10 < t2w1r7 && t2w1l10 < t2w1l7 && t2w1l10 < t2h1u7 && t2w1l10 < t2h1d7 && t2w1l10 < t2w1rwt7 && t2w1l10 < t2w1lwt7 && t2w1l10 < t2h1uwt7 && t2w1l10 < t2h1dwt7
      && t2w1l10 < t2w1r8 && t2w1l10 < t2w1l8 && t2w1l10 < t2h1u8 && t2w1l10 < t2h1d8 && t2w1l10 < t2w1rwt8 && t2w1l10 < t2w1lwt8 && t2w1l10 < t2h1uwt8 && t2w1l10 < t2h1dwt8
      && t2w1l10 < t2w1r9 && t2w1l10 < t2w1l9 && t2w1l10 < t2h1u9 && t2w1l10 < t2h1d9 && t2w1l10 < t2w1rwt9 && t2w1l10 < t2w1lwt9 && t2w1l10 < t2h1uwt9 && t2w1l10 < t2h1dwt9
      && t2w1l10 < t2w1r10 && t2w1l10 < t2h1u10 && t2w1l10 < t2h1d10 && t2w1l10 < t2w1rwt10 && t2w1l10 < t2w1lwt10 && t2w1l10 < t2h1uwt10 && t2w1l10 < t2h1dwt10
      && (loutwl10==0 && linwl10==0)){
  i=415;
  }

  if (myu10==-1 && t2h1u10 > 0 && t2h1u10 < t1 
  && t2h1u10 < t2w1r && t2h1u10 < t2w1l && t2h1u10 < t2h1u && t2h1u10 < t2h1d && t2h1u10 < t2w1rwt && t2h1u10 < t2w1lwt && t2h1u10 < t2h1uwt && t2h1u10 < t2h1dwt
  && t2h1u10 < t2w1r1 && t2h1u10 < t2w1l1 && t2h1u10 < t2h1u1 && t2h1u10 < t2h1d1 && t2h1u10 < t2w1rwt1 && t2h1u10 < t2w1lwt1 && t2h1u10 < t2h1uwt1 && t2h1u10 < t2h1dwt1
  && t2h1u10 < t2w1r2 && t2h1u10 < t2w1l2 && t2h1u10 < t2h1u2 && t2h1u10 < t2h1d2 && t2h1u10 < t2w1rwt2 && t2h1u10 < t2w1lwt2 && t2h1u10 < t2h1uwt2 && t2h1u10 < t2h1dwt2
  && t2h1u10 < t2w1r3 && t2h1u10 < t2w1l3 && t2h1u10 < t2h1u3 && t2h1u10 < t2h1d3 && t2h1u10 < t2w1rwt3 && t2h1u10 < t2w1lwt3 && t2h1u10 < t2h1uwt3 && t2h1u10 < t2h1dwt3
  && t2h1u10 < t2w1r4 && t2h1u10 < t2w1l4 && t2h1u10 < t2h1u4 && t2h1u10 < t2h1d4 && t2h1u10 < t2w1rwt4 && t2h1u10 < t2w1lwt4 && t2h1u10 < t2h1uwt4 && t2h1u10 < t2h1dwt4
  && t2h1u10 < t2w1r5 && t2h1u10 < t2w1l5 && t2h1u10 < t2h1u5 && t2h1u10 < t2h1d5 && t2h1u10 < t2w1rwt5 && t2h1u10 < t2w1lwt5 && t2h1u10 < t2h1uwt5 && t2h1u10 < t2h1dwt5
  && t2h1u10 < t2w1r6 && t2h1u10 < t2w1l6 && t2h1u10 < t2h1u6 && t2h1u10 < t2h1d6 && t2h1u10 < t2w1rwt6 && t2h1u10 < t2w1lwt6 && t2h1u10 < t2h1uwt6 && t2h1u10 < t2h1dwt6
  && t2h1u10 < t2w1r7 && t2h1u10 < t2w1l7 && t2h1u10 < t2h1u7 && t2h1u10 < t2h1d7 && t2h1u10 < t2w1rwt7 && t2h1u10 < t2w1lwt7 && t2h1u10 < t2h1uwt7 && t2h1u10 < t2h1dwt7
  && t2h1u10 < t2w1r8 && t2h1u10 < t2w1l8 && t2h1u10 < t2h1u8 && t2h1u10 < t2h1d8 && t2h1u10 < t2w1rwt8 && t2h1u10 < t2w1lwt8 && t2h1u10 < t2h1uwt8 && t2h1u10 < t2h1dwt8
  && t2h1u10 < t2w1r9 && t2h1u10 < t2w1l9 && t2h1u10 < t2h1u9 && t2h1u10 < t2h1d9 && t2h1u10 < t2w1rwt9 && t2h1u10 < t2w1lwt9 && t2h1u10 < t2h1uwt9 && t2h1u10 < t2h1dwt9
  && t2h1u10 < t2w1r10 && t2h1u10 < t2w1l10 && t2h1u10 < t2h1d10 && t2h1u10 < t2w1rwt10 && t2h1u10 < t2w1lwt10 && t2h1u10 < t2h1uwt10 && t2h1u10 < t2h1dwt10
  && (louthu10 !=0 && linhu10!=0)){
  i=416;
  }

  if (myu10==-1 && t2h1u10 > 0 && t2h1u10 < t1 
  && t2h1u10 < t2w1r && t2h1u10 < t2w1l && t2h1u10 < t2h1u && t2h1u10 < t2h1d && t2h1u10 < t2w1rwt && t2h1u10 < t2w1lwt && t2h1u10 < t2h1uwt && t2h1u10 < t2h1dwt
  && t2h1u10 < t2w1r1 && t2h1u10 < t2w1l1 && t2h1u10 < t2h1u1 && t2h1u10 < t2h1d1 && t2h1u10 < t2w1rwt1 && t2h1u10 < t2w1lwt1 && t2h1u10 < t2h1uwt1 && t2h1u10 < t2h1dwt1
  && t2h1u10 < t2w1r2 && t2h1u10 < t2w1l2 && t2h1u10 < t2h1u2 && t2h1u10 < t2h1d2 && t2h1u10 < t2w1rwt2 && t2h1u10 < t2w1lwt2 && t2h1u10 < t2h1uwt2 && t2h1u10 < t2h1dwt2
  && t2h1u10 < t2w1r3 && t2h1u10 < t2w1l3 && t2h1u10 < t2h1u3 && t2h1u10 < t2h1d3 && t2h1u10 < t2w1rwt3 && t2h1u10 < t2w1lwt3 && t2h1u10 < t2h1uwt3 && t2h1u10 < t2h1dwt3
  && t2h1u10 < t2w1r4 && t2h1u10 < t2w1l4 && t2h1u10 < t2h1u4 && t2h1u10 < t2h1d4 && t2h1u10 < t2w1rwt4 && t2h1u10 < t2w1lwt4 && t2h1u10 < t2h1uwt4 && t2h1u10 < t2h1dwt4
  && t2h1u10 < t2w1r5 && t2h1u10 < t2w1l5 && t2h1u10 < t2h1u5 && t2h1u10 < t2h1d5 && t2h1u10 < t2w1rwt5 && t2h1u10 < t2w1lwt5 && t2h1u10 < t2h1uwt5 && t2h1u10 < t2h1dwt5
  && t2h1u10 < t2w1r6 && t2h1u10 < t2w1l6 && t2h1u10 < t2h1u6 && t2h1u10 < t2h1d6 && t2h1u10 < t2w1rwt6 && t2h1u10 < t2w1lwt6 && t2h1u10 < t2h1uwt6 && t2h1u10 < t2h1dwt6
  && t2h1u10 < t2w1r7 && t2h1u10 < t2w1l7 && t2h1u10 < t2h1u7 && t2h1u10 < t2h1d7 && t2h1u10 < t2w1rwt7 && t2h1u10 < t2w1lwt7 && t2h1u10 < t2h1uwt7 && t2h1u10 < t2h1dwt7
  && t2h1u10 < t2w1r8 && t2h1u10 < t2w1l8 && t2h1u10 < t2h1u8 && t2h1u10 < t2h1d8 && t2h1u10 < t2w1rwt8 && t2h1u10 < t2w1lwt8 && t2h1u10 < t2h1uwt8 && t2h1u10 < t2h1dwt8
  && t2h1u10 < t2w1r9 && t2h1u10 < t2w1l9 && t2h1u10 < t2h1u9 && t2h1u10 < t2h1d9 && t2h1u10 < t2w1rwt9 && t2h1u10 < t2w1lwt9 && t2h1u10 < t2h1uwt9 && t2h1u10 < t2h1dwt9
  && t2h1u10 < t2w1r10 && t2h1u10 < t2w1l10 && t2h1u10 < t2h1d10 && t2h1u10 < t2w1rwt10 && t2h1u10 < t2w1lwt10 && t2h1u10 < t2h1uwt10 && t2h1u10 < t2h1dwt10
  && ((louthu10!=0 && linhu10==0) || (louthu10==0 && linhu10!=0))){
  i=416;
  }

  if (myu10==-1 && t2h1u10 > 0 && t2h1u10 < t1 
  && t2h1u10 < t2w1r && t2h1u10 < t2w1l && t2h1u10 < t2h1u && t2h1u10 < t2h1d && t2h1u10 < t2w1rwt && t2h1u10 < t2w1lwt && t2h1u10 < t2h1uwt && t2h1u10 < t2h1dwt
  && t2h1u10 < t2w1r1 && t2h1u10 < t2w1l1 && t2h1u10 < t2h1u1 && t2h1u10 < t2h1d1 && t2h1u10 < t2w1rwt1 && t2h1u10 < t2w1lwt1 && t2h1u10 < t2h1uwt1 && t2h1u10 < t2h1dwt1
  && t2h1u10 < t2w1r2 && t2h1u10 < t2w1l2 && t2h1u10 < t2h1u2 && t2h1u10 < t2h1d2 && t2h1u10 < t2w1rwt2 && t2h1u10 < t2w1lwt2 && t2h1u10 < t2h1uwt2 && t2h1u10 < t2h1dwt2
  && t2h1u10 < t2w1r3 && t2h1u10 < t2w1l3 && t2h1u10 < t2h1u3 && t2h1u10 < t2h1d3 && t2h1u10 < t2w1rwt3 && t2h1u10 < t2w1lwt3 && t2h1u10 < t2h1uwt3 && t2h1u10 < t2h1dwt3
  && t2h1u10 < t2w1r4 && t2h1u10 < t2w1l4 && t2h1u10 < t2h1u4 && t2h1u10 < t2h1d4 && t2h1u10 < t2w1rwt4 && t2h1u10 < t2w1lwt4 && t2h1u10 < t2h1uwt4 && t2h1u10 < t2h1dwt4
  && t2h1u10 < t2w1r5 && t2h1u10 < t2w1l5 && t2h1u10 < t2h1u5 && t2h1u10 < t2h1d5 && t2h1u10 < t2w1rwt5 && t2h1u10 < t2w1lwt5 && t2h1u10 < t2h1uwt5 && t2h1u10 < t2h1dwt5
  && t2h1u10 < t2w1r6 && t2h1u10 < t2w1l6 && t2h1u10 < t2h1u6 && t2h1u10 < t2h1d6 && t2h1u10 < t2w1rwt6 && t2h1u10 < t2w1lwt6 && t2h1u10 < t2h1uwt6 && t2h1u10 < t2h1dwt6
  && t2h1u10 < t2w1r7 && t2h1u10 < t2w1l7 && t2h1u10 < t2h1u7 && t2h1u10 < t2h1d7 && t2h1u10 < t2w1rwt7 && t2h1u10 < t2w1lwt7 && t2h1u10 < t2h1uwt7 && t2h1u10 < t2h1dwt7
  && t2h1u10 < t2w1r8 && t2h1u10 < t2w1l8 && t2h1u10 < t2h1u8 && t2h1u10 < t2h1d8 && t2h1u10 < t2w1rwt8 && t2h1u10 < t2w1lwt8 && t2h1u10 < t2h1uwt8 && t2h1u10 < t2h1dwt8
  && t2h1u10 < t2w1r9 && t2h1u10 < t2w1l9 && t2h1u10 < t2h1u9 && t2h1u10 < t2h1d9 && t2h1u10 < t2w1rwt9 && t2h1u10 < t2w1lwt9 && t2h1u10 < t2h1uwt9 && t2h1u10 < t2h1dwt9
  && t2h1u10 < t2w1r10 && t2h1u10 < t2w1l10 && t2h1u10 < t2h1d10 && t2h1u10 < t2w1rwt10 && t2h1u10 < t2w1lwt10 && t2h1u10 < t2h1uwt10 && t2h1u10 < t2h1dwt10
  && (louthu10 == 0 && linhu10 == 0)){
  i=416;
  }

  if (myd10==-1 && t2h1d10 > 0 && t2h1d10 < t1 
  && t2h1d10 < t2w1r && t2h1d10 < t2w1l && t2h1d10 < t2h1u && t2h1d10 < t2h1d && t2h1d10 < t2w1rwt && t2h1d10 < t2w1lwt && t2h1d10 < t2h1uwt && t2h1d10 < t2h1dwt
  && t2h1d10 < t2w1r1 && t2h1d10 < t2w1l1 && t2h1d10 < t2h1u1 && t2h1d10 < t2h1d1 && t2h1d10 < t2w1rwt1 && t2h1d10 < t2w1lwt1 && t2h1d10 < t2h1uwt1 && t2h1d10 < t2h1dwt1
  && t2h1d10 < t2w1r2 && t2h1d10 < t2w1l2 && t2h1d10 < t2h1u2 && t2h1d10 < t2h1d2 && t2h1d10 < t2w1rwt2 && t2h1d10 < t2w1lwt2 && t2h1d10 < t2h1uwt2 && t2h1d10 < t2h1dwt2
  && t2h1d10 < t2w1r3 && t2h1d10 < t2w1l3 && t2h1d10 < t2h1u3 && t2h1d10 < t2h1d3 && t2h1d10 < t2w1rwt3 && t2h1d10 < t2w1lwt3 && t2h1d10 < t2h1uwt3 && t2h1d10 < t2h1dwt3
  && t2h1d10 < t2w1r4 && t2h1d10 < t2w1l4 && t2h1d10 < t2h1u4 && t2h1d10 < t2h1d4 && t2h1d10 < t2w1rwt4 && t2h1d10 < t2w1lwt4 && t2h1d10 < t2h1uwt4 && t2h1d10 < t2h1dwt4
  && t2h1d10 < t2w1r5 && t2h1d10 < t2w1l5 && t2h1d10 < t2h1u5 && t2h1d10 < t2h1d5 && t2h1d10 < t2w1rwt5 && t2h1d10 < t2w1lwt5 && t2h1d10 < t2h1uwt5 && t2h1d10 < t2h1dwt5
  && t2h1d10 < t2w1r6 && t2h1d10 < t2w1l6 && t2h1d10 < t2h1u6 && t2h1d10 < t2h1d6 && t2h1d10 < t2w1rwt6 && t2h1d10 < t2w1lwt6 && t2h1d10 < t2h1uwt6 && t2h1d10 < t2h1dwt6
  && t2h1d10 < t2w1r7 && t2h1d10 < t2w1l7 && t2h1d10 < t2h1u7 && t2h1d10 < t2h1d7 && t2h1d10 < t2w1rwt7 && t2h1d10 < t2w1lwt7 && t2h1d10 < t2h1uwt7 && t2h1d10 < t2h1dwt7
  && t2h1d10 < t2w1r8 && t2h1d10 < t2w1l8 && t2h1d10 < t2h1u8 && t2h1d10 < t2h1d8 && t2h1d10 < t2w1rwt8 && t2h1d10 < t2w1lwt8 && t2h1d10 < t2h1uwt8 && t2h1d10 < t2h1dwt8
  && t2h1d10 < t2w1r9 && t2h1d10 < t2w1l9 && t2h1d10 < t2h1u9 && t2h1d10 < t2h1d9 && t2h1d10 < t2w1rwt9 && t2h1d10 < t2w1lwt9 && t2h1d10 < t2h1uwt9 && t2h1d10 < t2h1dwt9
  && t2h1d10 < t2w1r10 && t2h1d10 < t2w1l10 && t2h1d10 < t2h1u10 && t2h1d10 < t2w1rwt10 && t2h1d10 < t2w1lwt10 && t2h1d10 < t2h1uwt10 && t2h1d10 < t2h1dwt10
  && (louthd10 !=0 && linhd10!=0)){
  i=417;
  }

  if (myd10==-1 && t2h1d10 > 0 && t2h1d10 < t1 
  && t2h1d10 < t2w1r && t2h1d10 < t2w1l && t2h1d10 < t2h1u && t2h1d10 < t2h1d && t2h1d10 < t2w1rwt && t2h1d10 < t2w1lwt && t2h1d10 < t2h1uwt && t2h1d10 < t2h1dwt
  && t2h1d10 < t2w1r1 && t2h1d10 < t2w1l1 && t2h1d10 < t2h1u1 && t2h1d10 < t2h1d1 && t2h1d10 < t2w1rwt1 && t2h1d10 < t2w1lwt1 && t2h1d10 < t2h1uwt1 && t2h1d10 < t2h1dwt1
  && t2h1d10 < t2w1r2 && t2h1d10 < t2w1l2 && t2h1d10 < t2h1u2 && t2h1d10 < t2h1d2 && t2h1d10 < t2w1rwt2 && t2h1d10 < t2w1lwt2 && t2h1d10 < t2h1uwt2 && t2h1d10 < t2h1dwt2
  && t2h1d10 < t2w1r3 && t2h1d10 < t2w1l3 && t2h1d10 < t2h1u3 && t2h1d10 < t2h1d3 && t2h1d10 < t2w1rwt3 && t2h1d10 < t2w1lwt3 && t2h1d10 < t2h1uwt3 && t2h1d10 < t2h1dwt3
  && t2h1d10 < t2w1r4 && t2h1d10 < t2w1l4 && t2h1d10 < t2h1u4 && t2h1d10 < t2h1d4 && t2h1d10 < t2w1rwt4 && t2h1d10 < t2w1lwt4 && t2h1d10 < t2h1uwt4 && t2h1d10 < t2h1dwt4
  && t2h1d10 < t2w1r5 && t2h1d10 < t2w1l5 && t2h1d10 < t2h1u5 && t2h1d10 < t2h1d5 && t2h1d10 < t2w1rwt5 && t2h1d10 < t2w1lwt5 && t2h1d10 < t2h1uwt5 && t2h1d10 < t2h1dwt5
  && t2h1d10 < t2w1r6 && t2h1d10 < t2w1l6 && t2h1d10 < t2h1u6 && t2h1d10 < t2h1d6 && t2h1d10 < t2w1rwt6 && t2h1d10 < t2w1lwt6 && t2h1d10 < t2h1uwt6 && t2h1d10 < t2h1dwt6
  && t2h1d10 < t2w1r7 && t2h1d10 < t2w1l7 && t2h1d10 < t2h1u7 && t2h1d10 < t2h1d7 && t2h1d10 < t2w1rwt7 && t2h1d10 < t2w1lwt7 && t2h1d10 < t2h1uwt7 && t2h1d10 < t2h1dwt7
  && t2h1d10 < t2w1r8 && t2h1d10 < t2w1l8 && t2h1d10 < t2h1u8 && t2h1d10 < t2h1d8 && t2h1d10 < t2w1rwt8 && t2h1d10 < t2w1lwt8 && t2h1d10 < t2h1uwt8 && t2h1d10 < t2h1dwt8
  && t2h1d10 < t2w1r9 && t2h1d10 < t2w1l9 && t2h1d10 < t2h1u9 && t2h1d10 < t2h1d9 && t2h1d10 < t2w1rwt9 && t2h1d10 < t2w1lwt9 && t2h1d10 < t2h1uwt9 && t2h1d10 < t2h1dwt9
  && t2h1d10 < t2w1r10 && t2h1d10 < t2w1l10 && t2h1d10 < t2h1u10 && t2h1d10 < t2w1rwt10 && t2h1d10 < t2w1lwt10 && t2h1d10 < t2h1uwt10 && t2h1d10 < t2h1dwt10
  && ((louthd10 !=0 && linhd10==0) || (louthd10 ==0 && linhd10!=0))){
  i=417;
  }

  if (myd10==-1 && t2h1d10 > 0 && t2h1d10 < t1 
  && t2h1d10 < t2w1r && t2h1d10 < t2w1l && t2h1d10 < t2h1u && t2h1d10 < t2h1d && t2h1d10 < t2w1rwt && t2h1d10 < t2w1lwt && t2h1d10 < t2h1uwt && t2h1d10 < t2h1dwt
  && t2h1d10 < t2w1r1 && t2h1d10 < t2w1l1 && t2h1d10 < t2h1u1 && t2h1d10 < t2h1d1 && t2h1d10 < t2w1rwt1 && t2h1d10 < t2w1lwt1 && t2h1d10 < t2h1uwt1 && t2h1d10 < t2h1dwt1
  && t2h1d10 < t2w1r2 && t2h1d10 < t2w1l2 && t2h1d10 < t2h1u2 && t2h1d10 < t2h1d2 && t2h1d10 < t2w1rwt2 && t2h1d10 < t2w1lwt2 && t2h1d10 < t2h1uwt2 && t2h1d10 < t2h1dwt2
  && t2h1d10 < t2w1r3 && t2h1d10 < t2w1l3 && t2h1d10 < t2h1u3 && t2h1d10 < t2h1d3 && t2h1d10 < t2w1rwt3 && t2h1d10 < t2w1lwt3 && t2h1d10 < t2h1uwt3 && t2h1d10 < t2h1dwt3
  && t2h1d10 < t2w1r4 && t2h1d10 < t2w1l4 && t2h1d10 < t2h1u4 && t2h1d10 < t2h1d4 && t2h1d10 < t2w1rwt4 && t2h1d10 < t2w1lwt4 && t2h1d10 < t2h1uwt4 && t2h1d10 < t2h1dwt4
  && t2h1d10 < t2w1r5 && t2h1d10 < t2w1l5 && t2h1d10 < t2h1u5 && t2h1d10 < t2h1d5 && t2h1d10 < t2w1rwt5 && t2h1d10 < t2w1lwt5 && t2h1d10 < t2h1uwt5 && t2h1d10 < t2h1dwt5
  && t2h1d10 < t2w1r6 && t2h1d10 < t2w1l6 && t2h1d10 < t2h1u6 && t2h1d10 < t2h1d6 && t2h1d10 < t2w1rwt6 && t2h1d10 < t2w1lwt6 && t2h1d10 < t2h1uwt6 && t2h1d10 < t2h1dwt6
  && t2h1d10 < t2w1r7 && t2h1d10 < t2w1l7 && t2h1d10 < t2h1u7 && t2h1d10 < t2h1d7 && t2h1d10 < t2w1rwt7 && t2h1d10 < t2w1lwt7 && t2h1d10 < t2h1uwt7 && t2h1d10 < t2h1dwt7
  && t2h1d10 < t2w1r8 && t2h1d10 < t2w1l8 && t2h1d10 < t2h1u8 && t2h1d10 < t2h1d8 && t2h1d10 < t2w1rwt8 && t2h1d10 < t2w1lwt8 && t2h1d10 < t2h1uwt8 && t2h1d10 < t2h1dwt8
  && t2h1d10 < t2w1r9 && t2h1d10 < t2w1l9 && t2h1d10 < t2h1u9 && t2h1d10 < t2h1d9 && t2h1d10 < t2w1rwt9 && t2h1d10 < t2w1lwt9 && t2h1d10 < t2h1uwt9 && t2h1d10 < t2h1dwt9
  && t2h1d10 < t2w1r10 && t2h1d10 < t2w1l10 && t2h1d10 < t2h1u10 && t2h1d10 < t2w1rwt10 && t2h1d10 < t2w1lwt10 && t2h1d10 < t2h1uwt10 && t2h1d10 < t2h1dwt10
  && (louthd10 == 0 && linhd10 == 0)){
  i=417;
  }

   
												/* EVERTHING AGAIN FOR THE OUTER WALLS */

												/* neutron interacts with the elliptic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW10!=-1 && t2w1rwt10 > 0 && t2w1rwt10 < t1 
  && t2w1rwt10 < t2w1r && t2w1rwt10 < t2w1l && t2w1rwt10 < t2h1u && t2w1rwt10 < t2h1d && t2w1rwt10 <t2w1rwt && t2w1rwt10 <t2w1lwt && t2w1rwt10 < t2h1uwt && t2w1rwt10 < t2h1dwt
  && t2w1rwt10 < t2w1r1 && t2w1rwt10 < t2w1l1 && t2w1rwt10 < t2h1u1 && t2w1rwt10 < t2h1d1 && t2w1rwt10 <t2w1rwt1 && t2w1rwt10 <t2w1lwt1 && t2w1rwt10 < t2h1uwt1 && t2w1rwt10 < t2h1dwt1
  && t2w1rwt10 < t2w1r2 && t2w1rwt10 < t2w1l2 && t2w1rwt10 < t2h1u2 && t2w1rwt10 < t2h1d2 && t2w1rwt10 <t2w1rwt2 && t2w1rwt10 <t2w1lwt2 && t2w1rwt10 < t2h1uwt2 && t2w1rwt10 < t2h1dwt2
  && t2w1rwt10 < t2w1r3 && t2w1rwt10 < t2w1l3 && t2w1rwt10 < t2h1u3 && t2w1rwt10 < t2h1d3 && t2w1rwt10 <t2w1rwt3 && t2w1rwt10 <t2w1lwt3 && t2w1rwt10 < t2h1uwt3 && t2w1rwt10 < t2h1dwt3
  && t2w1rwt10 < t2w1r4 && t2w1rwt10 < t2w1l4 && t2w1rwt10 < t2h1u4 && t2w1rwt10 < t2h1d4 && t2w1rwt10 <t2w1rwt4 && t2w1rwt10 <t2w1lwt4 && t2w1rwt10 < t2h1uwt4 && t2w1rwt10 < t2h1dwt4
  && t2w1rwt10 < t2w1r5 && t2w1rwt10 < t2w1l5 && t2w1rwt10 < t2h1u5 && t2w1rwt10 < t2h1d5 && t2w1rwt10 <t2w1rwt5 && t2w1rwt10 <t2w1lwt5 && t2w1rwt10 < t2h1uwt5 && t2w1rwt10 < t2h1dwt5
  && t2w1rwt10 < t2w1r6 && t2w1rwt10 < t2w1l6 && t2w1rwt10 < t2h1u6 && t2w1rwt10 < t2h1d6 && t2w1rwt10 <t2w1rwt6 && t2w1rwt10 <t2w1lwt6 && t2w1rwt10 < t2h1uwt6 && t2w1rwt10 < t2h1dwt6
  && t2w1rwt10 < t2w1r7 && t2w1rwt10 < t2w1l7 && t2w1rwt10 < t2h1u7 && t2w1rwt10 < t2h1d7 && t2w1rwt10 <t2w1rwt7 && t2w1rwt10 <t2w1lwt7 && t2w1rwt10 < t2h1uwt7 && t2w1rwt10 < t2h1dwt7
  && t2w1rwt10 < t2w1r8 && t2w1rwt10 < t2w1l8 && t2w1rwt10 < t2h1u8 && t2w1rwt10 < t2h1d8 && t2w1rwt10 <t2w1rwt8 && t2w1rwt10 <t2w1lwt8 && t2w1rwt10 < t2h1uwt8 && t2w1rwt10 < t2h1dwt8
  && t2w1rwt10 < t2w1r9 && t2w1rwt10 < t2w1l9 && t2w1rwt10 < t2h1u9 && t2w1rwt10 < t2h1d9 && t2w1rwt10 <t2w1rwt9 && t2w1rwt10 <t2w1lwt9 && t2w1rwt10 < t2h1uwt9 && t2w1rwt10 < t2h1dwt9
  && t2w1rwt10 < t2w1r10 && t2w1rwt10 < t2w1l10 && t2w1rwt10 < t2h1u10 && t2w1rwt10 < t2h1d10 && t2w1rwt10 <t2w1lwt10 && t2w1rwt10 < t2h1uwt10 && t2w1rwt10 < t2h1dwt10
  && ((linwr10!=0) && (loutwr10!=0) )){	
   if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1rwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1rwt10+z))*(z0hd10+(vz*t2w1rwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1rwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1rwt10+z))*(z0hu10+(vz*t2w1rwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1rwt10+y;
  xtest=vx*t2w1rwt10+x;
  xlimitrwt=-bwrwt10*sqrt(1-((vz*t2w1rwt10+z)+z0wr10)*((vz*t2w1rwt10+z)+z0wr10)/a2wrwt10);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW10 > 0){
  i=422;
  }
  else{
  i=434;
  }
  }

													/* neutron interacts with the parabolic right OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxrOW10!=-1 && t2w1rwt10 > 0 && t2w1rwt10 < t1 
  && t2w1rwt10 < t2w1r && t2w1rwt10 < t2w1l && t2w1rwt10 < t2h1u && t2w1rwt10 < t2h1d && t2w1rwt10 <t2w1rwt && t2w1rwt10 <t2w1lwt && t2w1rwt10 < t2h1uwt && t2w1rwt10 < t2h1dwt
  && t2w1rwt10 < t2w1r1 && t2w1rwt10 < t2w1l1 && t2w1rwt10 < t2h1u1 && t2w1rwt10 < t2h1d1 && t2w1rwt10 <t2w1rwt1 && t2w1rwt10 <t2w1lwt1 && t2w1rwt10 < t2h1uwt1 && t2w1rwt10 < t2h1dwt1
  && t2w1rwt10 < t2w1r2 && t2w1rwt10 < t2w1l2 && t2w1rwt10 < t2h1u2 && t2w1rwt10 < t2h1d2 && t2w1rwt10 <t2w1rwt2 && t2w1rwt10 <t2w1lwt2 && t2w1rwt10 < t2h1uwt2 && t2w1rwt10 < t2h1dwt2
  && t2w1rwt10 < t2w1r3 && t2w1rwt10 < t2w1l3 && t2w1rwt10 < t2h1u3 && t2w1rwt10 < t2h1d3 && t2w1rwt10 <t2w1rwt3 && t2w1rwt10 <t2w1lwt3 && t2w1rwt10 < t2h1uwt3 && t2w1rwt10 < t2h1dwt3
  && t2w1rwt10 < t2w1r4 && t2w1rwt10 < t2w1l4 && t2w1rwt10 < t2h1u4 && t2w1rwt10 < t2h1d4 && t2w1rwt10 <t2w1rwt4 && t2w1rwt10 <t2w1lwt4 && t2w1rwt10 < t2h1uwt4 && t2w1rwt10 < t2h1dwt4
  && t2w1rwt10 < t2w1r5 && t2w1rwt10 < t2w1l5 && t2w1rwt10 < t2h1u5 && t2w1rwt10 < t2h1d5 && t2w1rwt10 <t2w1rwt5 && t2w1rwt10 <t2w1lwt5 && t2w1rwt10 < t2h1uwt5 && t2w1rwt10 < t2h1dwt5
  && t2w1rwt10 < t2w1r6 && t2w1rwt10 < t2w1l6 && t2w1rwt10 < t2h1u6 && t2w1rwt10 < t2h1d6 && t2w1rwt10 <t2w1rwt6 && t2w1rwt10 <t2w1lwt6 && t2w1rwt10 < t2h1uwt6 && t2w1rwt10 < t2h1dwt6
  && t2w1rwt10 < t2w1r7 && t2w1rwt10 < t2w1l7 && t2w1rwt10 < t2h1u7 && t2w1rwt10 < t2h1d7 && t2w1rwt10 <t2w1rwt7 && t2w1rwt10 <t2w1lwt7 && t2w1rwt10 < t2h1uwt7 && t2w1rwt10 < t2h1dwt7
  && t2w1rwt10 < t2w1r8 && t2w1rwt10 < t2w1l8 && t2w1rwt10 < t2h1u8 && t2w1rwt10 < t2h1d8 && t2w1rwt10 <t2w1rwt8 && t2w1rwt10 <t2w1lwt8 && t2w1rwt10 < t2h1uwt8 && t2w1rwt10 < t2h1dwt8
  && t2w1rwt10 < t2w1r9 && t2w1rwt10 < t2w1l9 && t2w1rwt10 < t2h1u9 && t2w1rwt10 < t2h1d9 && t2w1rwt10 <t2w1rwt9 && t2w1rwt10 <t2w1lwt9 && t2w1rwt10 < t2h1uwt9 && t2w1rwt10 < t2h1dwt9
  && t2w1rwt10 < t2w1r10 && t2w1rwt10 < t2w1l10 && t2w1rwt10 < t2h1u10 && t2w1rwt10 < t2h1d10 && t2w1rwt10 <t2w1lwt10 && t2w1rwt10 < t2h1uwt10 && t2w1rwt10 < t2h1dwt10
  && ((loutwr10!=0 && linwr10==0) || (loutwr10==0 && linwr10!=0))){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1rwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1rwt10+z))*(z0hd10+(vz*t2w1rwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1rwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1rwt10+z))*(z0hu10+(vz*t2w1rwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1rwt10+y;
  xtest=vx*t2w1rwt10+x;
  xlimitr=-sqrt((pbwrwt10-(vz*t2w1rwt10+z))/pawrwt10);
  if (ytest>ylimitd && ytest<ylimitu && xtest<=xlimitr && mxrOW10 > 0){
  i=423; 
  }else{
  i=434;}
  }

													/* neutron interacts with the straight right OUTER wall - comments are analog to inner elliptic right wall */

  if (mxrOW10!=-1 && t2w1rwt10 > 0 && t2w1rwt10 < t1 
  && t2w1rwt10 < t2w1r && t2w1rwt10 < t2w1l && t2w1rwt10 < t2h1u && t2w1rwt10 < t2h1d && t2w1rwt10 <t2w1rwt && t2w1rwt10 <t2w1lwt && t2w1rwt10 < t2h1uwt && t2w1rwt10 < t2h1dwt
  && t2w1rwt10 < t2w1r1 && t2w1rwt10 < t2w1l1 && t2w1rwt10 < t2h1u1 && t2w1rwt10 < t2h1d1 && t2w1rwt10 <t2w1rwt1 && t2w1rwt10 <t2w1lwt1 && t2w1rwt10 < t2h1uwt1 && t2w1rwt10 < t2h1dwt1
  && t2w1rwt10 < t2w1r2 && t2w1rwt10 < t2w1l2 && t2w1rwt10 < t2h1u2 && t2w1rwt10 < t2h1d2 && t2w1rwt10 <t2w1rwt2 && t2w1rwt10 <t2w1lwt2 && t2w1rwt10 < t2h1uwt2 && t2w1rwt10 < t2h1dwt2
  && t2w1rwt10 < t2w1r3 && t2w1rwt10 < t2w1l3 && t2w1rwt10 < t2h1u3 && t2w1rwt10 < t2h1d3 && t2w1rwt10 <t2w1rwt3 && t2w1rwt10 <t2w1lwt3 && t2w1rwt10 < t2h1uwt3 && t2w1rwt10 < t2h1dwt3
  && t2w1rwt10 < t2w1r4 && t2w1rwt10 < t2w1l4 && t2w1rwt10 < t2h1u4 && t2w1rwt10 < t2h1d4 && t2w1rwt10 <t2w1rwt4 && t2w1rwt10 <t2w1lwt4 && t2w1rwt10 < t2h1uwt4 && t2w1rwt10 < t2h1dwt4
  && t2w1rwt10 < t2w1r5 && t2w1rwt10 < t2w1l5 && t2w1rwt10 < t2h1u5 && t2w1rwt10 < t2h1d5 && t2w1rwt10 <t2w1rwt5 && t2w1rwt10 <t2w1lwt5 && t2w1rwt10 < t2h1uwt5 && t2w1rwt10 < t2h1dwt5
  && t2w1rwt10 < t2w1r6 && t2w1rwt10 < t2w1l6 && t2w1rwt10 < t2h1u6 && t2w1rwt10 < t2h1d6 && t2w1rwt10 <t2w1rwt6 && t2w1rwt10 <t2w1lwt6 && t2w1rwt10 < t2h1uwt6 && t2w1rwt10 < t2h1dwt6
  && t2w1rwt10 < t2w1r7 && t2w1rwt10 < t2w1l7 && t2w1rwt10 < t2h1u7 && t2w1rwt10 < t2h1d7 && t2w1rwt10 <t2w1rwt7 && t2w1rwt10 <t2w1lwt7 && t2w1rwt10 < t2h1uwt7 && t2w1rwt10 < t2h1dwt7
  && t2w1rwt10 < t2w1r8 && t2w1rwt10 < t2w1l8 && t2w1rwt10 < t2h1u8 && t2w1rwt10 < t2h1d8 && t2w1rwt10 <t2w1rwt8 && t2w1rwt10 <t2w1lwt8 && t2w1rwt10 < t2h1uwt8 && t2w1rwt10 < t2h1dwt8
  && t2w1rwt10 < t2w1r9 && t2w1rwt10 < t2w1l9 && t2w1rwt10 < t2h1u9 && t2w1rwt10 < t2h1d9 && t2w1rwt10 <t2w1rwt9 && t2w1rwt10 <t2w1lwt9 && t2w1rwt10 < t2h1uwt9 && t2w1rwt10 < t2h1dwt9
  && t2w1rwt10 < t2w1r10 && t2w1rwt10 < t2w1l10 && t2w1rwt10 < t2h1u10 && t2w1rwt10 < t2h1d10 && t2w1rwt10 <t2w1lwt10 && t2w1rwt10 < t2h1uwt10 && t2w1rwt10 < t2h1dwt10
  && (loutwr10==0 && linwr10==0)){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1rwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1rwt10+z))*(z0hd10+(vz*t2w1rwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1rwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1rwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1rwt10+z))*(z0hu10+(vz*t2w1rwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1rwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1rwt10+y; 
  xtest=vx*t2w1rwt10+x;
  xlimitr=-(-w2r10+w1r10)*(vz*t2w1rwt10+z)/l-w1rwt10;
  if(ytest>=ylimitd && ytest<=ylimitu && xtest<=xlimitr && mxrOW10>0){
  i=424;
  }else{
  i=434;
  }
  }

													/* neutron interacts with the elliptic left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW10!=-1 && t2w1lwt10 > 0 && t2w1lwt10 < t1 
  && t2w1lwt10 < t2w1r && t2w1lwt10 < t2w1l && t2w1lwt10 < t2h1u && t2w1lwt10 < t2h1d && t2w1lwt10 <t2w1rwt && t2w1lwt10 <t2w1lwt && t2w1lwt10 < t2h1uwt && t2w1lwt10 < t2h1dwt
  && t2w1lwt10 < t2w1r1 && t2w1lwt10 < t2w1l1 && t2w1lwt10 < t2h1u1 && t2w1lwt10 < t2h1d1 && t2w1lwt10 <t2w1rwt1 && t2w1lwt10 <t2w1lwt1 && t2w1lwt10 < t2h1uwt1 && t2w1lwt10 < t2h1dwt1
  && t2w1lwt10 < t2w1r2 && t2w1lwt10 < t2w1l2 && t2w1lwt10 < t2h1u2 && t2w1lwt10 < t2h1d2 && t2w1lwt10 <t2w1rwt2 && t2w1lwt10 <t2w1lwt2 && t2w1lwt10 < t2h1uwt2 && t2w1lwt10 < t2h1dwt2
  && t2w1lwt10 < t2w1r3 && t2w1lwt10 < t2w1l3 && t2w1lwt10 < t2h1u3 && t2w1lwt10 < t2h1d3 && t2w1lwt10 <t2w1rwt3 && t2w1lwt10 <t2w1lwt3 && t2w1lwt10 < t2h1uwt3 && t2w1lwt10 < t2h1dwt3
  && t2w1lwt10 < t2w1r4 && t2w1lwt10 < t2w1l4 && t2w1lwt10 < t2h1u4 && t2w1lwt10 < t2h1d4 && t2w1lwt10 <t2w1rwt4 && t2w1lwt10 <t2w1lwt4 && t2w1lwt10 < t2h1uwt4 && t2w1lwt10 < t2h1dwt4
  && t2w1lwt10 < t2w1r5 && t2w1lwt10 < t2w1l5 && t2w1lwt10 < t2h1u5 && t2w1lwt10 < t2h1d5 && t2w1lwt10 <t2w1rwt5 && t2w1lwt10 <t2w1lwt5 && t2w1lwt10 < t2h1uwt5 && t2w1lwt10 < t2h1dwt5
  && t2w1lwt10 < t2w1r6 && t2w1lwt10 < t2w1l6 && t2w1lwt10 < t2h1u6 && t2w1lwt10 < t2h1d6 && t2w1lwt10 <t2w1rwt6 && t2w1lwt10 <t2w1lwt6 && t2w1lwt10 < t2h1uwt6 && t2w1lwt10 < t2h1dwt6
  && t2w1lwt10 < t2w1r7 && t2w1lwt10 < t2w1l7 && t2w1lwt10 < t2h1u7 && t2w1lwt10 < t2h1d7 && t2w1lwt10 <t2w1rwt7 && t2w1lwt10 <t2w1lwt7 && t2w1lwt10 < t2h1uwt7 && t2w1lwt10 < t2h1dwt7
  && t2w1lwt10 < t2w1r8 && t2w1lwt10 < t2w1l8 && t2w1lwt10 < t2h1u8 && t2w1lwt10 < t2h1d8 && t2w1lwt10 <t2w1rwt8 && t2w1lwt10 <t2w1lwt8 && t2w1lwt10 < t2h1uwt8 && t2w1lwt10 < t2h1dwt8
  && t2w1lwt10 < t2w1r9 && t2w1lwt10 < t2w1l9 && t2w1lwt10 < t2h1u9 && t2w1lwt10 < t2h1d9 && t2w1lwt10 <t2w1rwt9 && t2w1lwt10 <t2w1lwt9 && t2w1lwt10 < t2h1uwt9 && t2w1lwt10 < t2h1dwt9
  && t2w1lwt10 < t2w1r10 && t2w1lwt10 < t2w1l10 && t2w1lwt10 < t2h1u10 && t2w1lwt10 < t2h1d10 && t2w1lwt10 <t2w1rwt10 && t2w1lwt10 < t2h1uwt10 && t2w1lwt10 < t2h1dwt10
  && ((linwl10!=0) && (loutwl10!=0) )){
  if(linhd10==0 && louthd10==0)
   if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1lwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1lwt10+z))*(z0hd10+(vz*t2w1lwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1lwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1lwt10+z))*(z0hu10+(vz*t2w1lwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1lwt10+y;
  xtest=vx*t2w1lwt10+x;
  xlimitlwt=-bwlwt10*sqrt(1-((vz*t2w1lwt10+z)+z0wl10)*((vz*t2w1lwt10+z)+z0wl10)/a2wlwt10);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW10>0){
  i=425;
  }else{
  i=435;
  }
  }

													/* neutron interacts with the parabolic left OUTER wall - comments are analog to inner elliptic right wall */

  if (mxlOW10!=-1 && t2w1lwt10 > 0 && t2w1lwt10 < t1 
  && t2w1lwt10 < t2w1r && t2w1lwt10 < t2w1l && t2w1lwt10 < t2h1u && t2w1lwt10 < t2h1d && t2w1lwt10 <t2w1rwt && t2w1lwt10 <t2w1lwt && t2w1lwt10 < t2h1uwt && t2w1lwt10 < t2h1dwt
  && t2w1lwt10 < t2w1r1 && t2w1lwt10 < t2w1l1 && t2w1lwt10 < t2h1u1 && t2w1lwt10 < t2h1d1 && t2w1lwt10 <t2w1rwt1 && t2w1lwt10 <t2w1lwt1 && t2w1lwt10 < t2h1uwt1 && t2w1lwt10 < t2h1dwt1
  && t2w1lwt10 < t2w1r2 && t2w1lwt10 < t2w1l2 && t2w1lwt10 < t2h1u2 && t2w1lwt10 < t2h1d2 && t2w1lwt10 <t2w1rwt2 && t2w1lwt10 <t2w1lwt2 && t2w1lwt10 < t2h1uwt2 && t2w1lwt10 < t2h1dwt2
  && t2w1lwt10 < t2w1r3 && t2w1lwt10 < t2w1l3 && t2w1lwt10 < t2h1u3 && t2w1lwt10 < t2h1d3 && t2w1lwt10 <t2w1rwt3 && t2w1lwt10 <t2w1lwt3 && t2w1lwt10 < t2h1uwt3 && t2w1lwt10 < t2h1dwt3
  && t2w1lwt10 < t2w1r4 && t2w1lwt10 < t2w1l4 && t2w1lwt10 < t2h1u4 && t2w1lwt10 < t2h1d4 && t2w1lwt10 <t2w1rwt4 && t2w1lwt10 <t2w1lwt4 && t2w1lwt10 < t2h1uwt4 && t2w1lwt10 < t2h1dwt4
  && t2w1lwt10 < t2w1r5 && t2w1lwt10 < t2w1l5 && t2w1lwt10 < t2h1u5 && t2w1lwt10 < t2h1d5 && t2w1lwt10 <t2w1rwt5 && t2w1lwt10 <t2w1lwt5 && t2w1lwt10 < t2h1uwt5 && t2w1lwt10 < t2h1dwt5
  && t2w1lwt10 < t2w1r6 && t2w1lwt10 < t2w1l6 && t2w1lwt10 < t2h1u6 && t2w1lwt10 < t2h1d6 && t2w1lwt10 <t2w1rwt6 && t2w1lwt10 <t2w1lwt6 && t2w1lwt10 < t2h1uwt6 && t2w1lwt10 < t2h1dwt6
  && t2w1lwt10 < t2w1r7 && t2w1lwt10 < t2w1l7 && t2w1lwt10 < t2h1u7 && t2w1lwt10 < t2h1d7 && t2w1lwt10 <t2w1rwt7 && t2w1lwt10 <t2w1lwt7 && t2w1lwt10 < t2h1uwt7 && t2w1lwt10 < t2h1dwt7
  && t2w1lwt10 < t2w1r8 && t2w1lwt10 < t2w1l8 && t2w1lwt10 < t2h1u8 && t2w1lwt10 < t2h1d8 && t2w1lwt10 <t2w1rwt8 && t2w1lwt10 <t2w1lwt8 && t2w1lwt10 < t2h1uwt8 && t2w1lwt10 < t2h1dwt8
  && t2w1lwt10 < t2w1r9 && t2w1lwt10 < t2w1l9 && t2w1lwt10 < t2h1u9 && t2w1lwt10 < t2h1d9 && t2w1lwt10 <t2w1rwt9 && t2w1lwt10 <t2w1lwt9 && t2w1lwt10 < t2h1uwt9 && t2w1lwt10 < t2h1dwt9
  && t2w1lwt10 < t2w1r10 && t2w1lwt10 < t2w1l10 && t2w1lwt10 < t2h1u10 && t2w1lwt10 < t2h1d10 && t2w1lwt10 <t2w1rwt10 && t2w1lwt10 < t2h1uwt10 && t2w1lwt10 < t2h1dwt10
  && ((loutwl10!=0 && linwl10==0) || (loutwl10==0 && linwl10!=0))){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1lwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1lwt10+z))*(z0hd10+(vz*t2w1lwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1lwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1lwt10+z))*(z0hu10+(vz*t2w1lwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1lwt10+y;
  xtest=vx*t2w1lwt10+x;
  xlimitl=-sqrt((pbwlwt10-(vz*t2w1lwt10+z))/pawlwt10);
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW10>0){
  i=426;
  }else{
  i=435;
  }
  }

														/* neutron interacts with the straight left OUTER wall - comments are analog to inner elliptic right wall*/

  if (mxlOW10!=-1 && t2w1lwt10 > 0 && t2w1lwt10 < t1 
  && t2w1lwt10 < t2w1r && t2w1lwt10 < t2w1l && t2w1lwt10 < t2h1u && t2w1lwt10 < t2h1d && t2w1lwt10 <t2w1rwt && t2w1lwt10 <t2w1lwt && t2w1lwt10 < t2h1uwt && t2w1lwt10 < t2h1dwt
  && t2w1lwt10 < t2w1r1 && t2w1lwt10 < t2w1l1 && t2w1lwt10 < t2h1u1 && t2w1lwt10 < t2h1d1 && t2w1lwt10 <t2w1rwt1 && t2w1lwt10 <t2w1lwt1 && t2w1lwt10 < t2h1uwt1 && t2w1lwt10 < t2h1dwt1
  && t2w1lwt10 < t2w1r2 && t2w1lwt10 < t2w1l2 && t2w1lwt10 < t2h1u2 && t2w1lwt10 < t2h1d2 && t2w1lwt10 <t2w1rwt2 && t2w1lwt10 <t2w1lwt2 && t2w1lwt10 < t2h1uwt2 && t2w1lwt10 < t2h1dwt2
  && t2w1lwt10 < t2w1r3 && t2w1lwt10 < t2w1l3 && t2w1lwt10 < t2h1u3 && t2w1lwt10 < t2h1d3 && t2w1lwt10 <t2w1rwt3 && t2w1lwt10 <t2w1lwt3 && t2w1lwt10 < t2h1uwt3 && t2w1lwt10 < t2h1dwt3
  && t2w1lwt10 < t2w1r4 && t2w1lwt10 < t2w1l4 && t2w1lwt10 < t2h1u4 && t2w1lwt10 < t2h1d4 && t2w1lwt10 <t2w1rwt4 && t2w1lwt10 <t2w1lwt4 && t2w1lwt10 < t2h1uwt4 && t2w1lwt10 < t2h1dwt4
  && t2w1lwt10 < t2w1r5 && t2w1lwt10 < t2w1l5 && t2w1lwt10 < t2h1u5 && t2w1lwt10 < t2h1d5 && t2w1lwt10 <t2w1rwt5 && t2w1lwt10 <t2w1lwt5 && t2w1lwt10 < t2h1uwt5 && t2w1lwt10 < t2h1dwt5
  && t2w1lwt10 < t2w1r6 && t2w1lwt10 < t2w1l6 && t2w1lwt10 < t2h1u6 && t2w1lwt10 < t2h1d6 && t2w1lwt10 <t2w1rwt6 && t2w1lwt10 <t2w1lwt6 && t2w1lwt10 < t2h1uwt6 && t2w1lwt10 < t2h1dwt6
  && t2w1lwt10 < t2w1r7 && t2w1lwt10 < t2w1l7 && t2w1lwt10 < t2h1u7 && t2w1lwt10 < t2h1d7 && t2w1lwt10 <t2w1rwt7 && t2w1lwt10 <t2w1lwt7 && t2w1lwt10 < t2h1uwt7 && t2w1lwt10 < t2h1dwt7
  && t2w1lwt10 < t2w1r8 && t2w1lwt10 < t2w1l8 && t2w1lwt10 < t2h1u8 && t2w1lwt10 < t2h1d8 && t2w1lwt10 <t2w1rwt8 && t2w1lwt10 <t2w1lwt8 && t2w1lwt10 < t2h1uwt8 && t2w1lwt10 < t2h1dwt8
  && t2w1lwt10 < t2w1r9 && t2w1lwt10 < t2w1l9 && t2w1lwt10 < t2h1u9 && t2w1lwt10 < t2h1d9 && t2w1lwt10 <t2w1rwt9 && t2w1lwt10 <t2w1lwt9 && t2w1lwt10 < t2h1uwt9 && t2w1lwt10 < t2h1dwt9
  && t2w1lwt10 < t2w1r10 && t2w1lwt10 < t2w1l10 && t2w1lwt10 < t2h1u10 && t2w1lwt10 < t2h1d10 && t2w1lwt10 <t2w1rwt10 && t2w1lwt10 < t2h1uwt10 && t2w1lwt10 < t2h1dwt10
  && (loutwl10==0 && linwl10==0)){
  if(linhd10==0 && louthd10==0)
   {
      ylimitd=(-h2d10+h1d10)/l*(vz*t2w1lwt10+z)-h1dwt10;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ylimitd=-bhdwt10*sqrt(1-((z0hd10+(vz*t2w1lwt10+z))*(z0hd10+(vz*t2w1lwt10+z)))/a2hdwt10);
      }else{
      ylimitd=-sqrt(((vz*t2w1lwt10+z)-pbhdwt10)/-pahdwt10);
      }
   }
   if(linhu10==0 && louthu10==0)
    {
     ylimitu=(h2u10-h1u10)/l*(vz*t2w1lwt10+z)+h1uwt10;
    }else{
     if(linhu10!=0 && louthu10!=0)
     {
     ylimitu=bhuwt10*sqrt(1-((z0hu10+(vz*t2w1lwt10+z))*(z0hu10+(vz*t2w1lwt10+z)))/a2huwt10);
     }else{
     ylimitu=sqrt(((vz*t2w1lwt10+z)-pbhuwt10)/-pahuwt10);
    }
    }
  ytest=vy*t2w1lwt10+y; 
  xtest=vx*t2w1lwt10+x;
  xlimitl=(w2l10-w1l10)*(vz*t2w1lwt10+z)/l+w1lwt10;
  if (ytest>=ylimitd && ytest<=ylimitu && xtest>=xlimitl && mxlOW10>0){
  i=427;
  }else{
  i=435;
  }
  }

															/* neutron interacts with the elliptic top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW10!=-1 && t2h1uwt10 > 0 && t2h1uwt10 < t1 
  && t2h1uwt10 < t2w1r && t2h1uwt10 < t2w1l && t2h1uwt10 < t2h1u && t2h1uwt10 < t2h1d && t2h1uwt10 < t2w1rwt && t2h1uwt10 < t2w1lwt && t2h1uwt10 < t2h1uwt && t2h1uwt10 < t2h1dwt 
  && t2h1uwt10 < t2w1r1 && t2h1uwt10 < t2w1l1 && t2h1uwt10 < t2h1u1 && t2h1uwt10 < t2h1d1 && t2h1uwt10 < t2w1rwt1 && t2h1uwt10 < t2w1lwt1 && t2h1uwt10 < t2h1uwt1 && t2h1uwt10 < t2h1dwt1
  && t2h1uwt10 < t2w1r2 && t2h1uwt10 < t2w1l2 && t2h1uwt10 < t2h1u2 && t2h1uwt10 < t2h1d2 && t2h1uwt10 < t2w1rwt2 && t2h1uwt10 < t2w1lwt2 && t2h1uwt10 < t2h1uwt2 && t2h1uwt10 < t2h1dwt2
  && t2h1uwt10 < t2w1r3 && t2h1uwt10 < t2w1l3 && t2h1uwt10 < t2h1u3 && t2h1uwt10 < t2h1d3 && t2h1uwt10 < t2w1rwt3 && t2h1uwt10 < t2w1lwt3 && t2h1uwt10 < t2h1uwt3 && t2h1uwt10 < t2h1dwt3
  && t2h1uwt10 < t2w1r4 && t2h1uwt10 < t2w1l4 && t2h1uwt10 < t2h1u4 && t2h1uwt10 < t2h1d4 && t2h1uwt10 < t2w1rwt4 && t2h1uwt10 < t2w1lwt4 && t2h1uwt10 < t2h1uwt4 && t2h1uwt10 < t2h1dwt4
  && t2h1uwt10 < t2w1r5 && t2h1uwt10 < t2w1l5 && t2h1uwt10 < t2h1u5 && t2h1uwt10 < t2h1d5 && t2h1uwt10 < t2w1rwt5 && t2h1uwt10 < t2w1lwt5 && t2h1uwt10 < t2h1uwt5 && t2h1uwt10 < t2h1dwt5
  && t2h1uwt10 < t2w1r6 && t2h1uwt10 < t2w1l6 && t2h1uwt10 < t2h1u6 && t2h1uwt10 < t2h1d6 && t2h1uwt10 < t2w1rwt6 && t2h1uwt10 < t2w1lwt6 && t2h1uwt10 < t2h1uwt6 && t2h1uwt10 < t2h1dwt6
  && t2h1uwt10 < t2w1r7 && t2h1uwt10 < t2w1l7 && t2h1uwt10 < t2h1u7 && t2h1uwt10 < t2h1d7 && t2h1uwt10 < t2w1rwt7 && t2h1uwt10 < t2w1lwt7 && t2h1uwt10 < t2h1uwt7 && t2h1uwt10 < t2h1dwt7
  && t2h1uwt10 < t2w1r8 && t2h1uwt10 < t2w1l8 && t2h1uwt10 < t2h1u8 && t2h1uwt10 < t2h1d8 && t2h1uwt10 < t2w1rwt8 && t2h1uwt10 < t2w1lwt8 && t2h1uwt10 < t2h1uwt8 && t2h1uwt10 < t2h1dwt8
  && t2h1uwt10 < t2w1r9 && t2h1uwt10 < t2w1l9 && t2h1uwt10 < t2h1u9 && t2h1uwt10 < t2h1d9 && t2h1uwt10 < t2w1rwt9 && t2h1uwt10 < t2w1lwt9 && t2h1uwt10 < t2h1uwt9 && t2h1uwt10 < t2h1dwt9
  && t2h1uwt10 < t2w1r10 && t2h1uwt10 < t2w1l10 && t2h1uwt10 < t2h1u10 && t2h1uwt10 < t2h1d10 && t2h1uwt10 < t2w1rwt10 && t2h1uwt10 < t2w1lwt10 && t2h1uwt10 < t2h1dwt10
  && (louthu10 !=0 && linhu10!=0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1uwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1uwt10+z))*(z0wr10+(vz*t2h1uwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1uwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1uwt10+z))*(z0wl10+(vz*t2h1uwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1uwt10+x;
  ytest=vy*t2w1lwt10+y;
  ylimitu=bhuwt10*sqrt(1-((vz*t2h1uwt10+z)+z0hu10)*((vz*t2h1uwt10+z)+z0hu10)/a2huwt10);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW10>0 ){
  i=428;
  }else{
  i=436;
  }
  }
	
															/* neutron interacts with the parabolic top OUTER wall - comments are analog to inner elliptic right wall */

  if (myuOW10!=-1 && t2h1uwt10 > 0 && t2h1uwt10 < t1 
  && t2h1uwt10 < t2w1r && t2h1uwt10 < t2w1l && t2h1uwt10 < t2h1u && t2h1uwt10 < t2h1d && t2h1uwt10 < t2w1rwt && t2h1uwt10 < t2w1lwt && t2h1uwt10 < t2h1uwt && t2h1uwt10 < t2h1dwt 
  && t2h1uwt10 < t2w1r1 && t2h1uwt10 < t2w1l1 && t2h1uwt10 < t2h1u1 && t2h1uwt10 < t2h1d1 && t2h1uwt10 < t2w1rwt1 && t2h1uwt10 < t2w1lwt1 && t2h1uwt10 < t2h1uwt1 && t2h1uwt10 < t2h1dwt1
  && t2h1uwt10 < t2w1r2 && t2h1uwt10 < t2w1l2 && t2h1uwt10 < t2h1u2 && t2h1uwt10 < t2h1d2 && t2h1uwt10 < t2w1rwt2 && t2h1uwt10 < t2w1lwt2 && t2h1uwt10 < t2h1uwt2 && t2h1uwt10 < t2h1dwt2
  && t2h1uwt10 < t2w1r3 && t2h1uwt10 < t2w1l3 && t2h1uwt10 < t2h1u3 && t2h1uwt10 < t2h1d3 && t2h1uwt10 < t2w1rwt3 && t2h1uwt10 < t2w1lwt3 && t2h1uwt10 < t2h1uwt3 && t2h1uwt10 < t2h1dwt3
  && t2h1uwt10 < t2w1r4 && t2h1uwt10 < t2w1l4 && t2h1uwt10 < t2h1u4 && t2h1uwt10 < t2h1d4 && t2h1uwt10 < t2w1rwt4 && t2h1uwt10 < t2w1lwt4 && t2h1uwt10 < t2h1uwt4 && t2h1uwt10 < t2h1dwt4
  && t2h1uwt10 < t2w1r5 && t2h1uwt10 < t2w1l5 && t2h1uwt10 < t2h1u5 && t2h1uwt10 < t2h1d5 && t2h1uwt10 < t2w1rwt5 && t2h1uwt10 < t2w1lwt5 && t2h1uwt10 < t2h1uwt5 && t2h1uwt10 < t2h1dwt5
  && t2h1uwt10 < t2w1r6 && t2h1uwt10 < t2w1l6 && t2h1uwt10 < t2h1u6 && t2h1uwt10 < t2h1d6 && t2h1uwt10 < t2w1rwt6 && t2h1uwt10 < t2w1lwt6 && t2h1uwt10 < t2h1uwt6 && t2h1uwt10 < t2h1dwt6
  && t2h1uwt10 < t2w1r7 && t2h1uwt10 < t2w1l7 && t2h1uwt10 < t2h1u7 && t2h1uwt10 < t2h1d7 && t2h1uwt10 < t2w1rwt7 && t2h1uwt10 < t2w1lwt7 && t2h1uwt10 < t2h1uwt7 && t2h1uwt10 < t2h1dwt7
  && t2h1uwt10 < t2w1r8 && t2h1uwt10 < t2w1l8 && t2h1uwt10 < t2h1u8 && t2h1uwt10 < t2h1d8 && t2h1uwt10 < t2w1rwt8 && t2h1uwt10 < t2w1lwt8 && t2h1uwt10 < t2h1uwt8 && t2h1uwt10 < t2h1dwt8
  && t2h1uwt10 < t2w1r9 && t2h1uwt10 < t2w1l9 && t2h1uwt10 < t2h1u9 && t2h1uwt10 < t2h1d9 && t2h1uwt10 < t2w1rwt9 && t2h1uwt10 < t2w1lwt9 && t2h1uwt10 < t2h1uwt9 && t2h1uwt10 < t2h1dwt9
  && t2h1uwt10 < t2w1r10 && t2h1uwt10 < t2w1l10 && t2h1uwt10 < t2h1u10 && t2h1uwt10 < t2h1d10 && t2h1uwt10 < t2w1rwt10 && t2h1uwt10 < t2w1lwt10 && t2h1uwt10 < t2h1dwt10
  && ((louthu10!=0 && linhu10==0) || (louthu10==0 && linhu10!=0))){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1uwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1uwt10+z))*(z0wr10+(vz*t2h1uwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1uwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1uwt10+z))*(z0wl10+(vz*t2h1uwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1uwt10+x;
  ytest=vy*t2w1lwt10+y;
  ylimitu=sqrt((pbhuwt10-(vz*t2h1uwt10+z))/pahuwt10);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW10>0){
  i=429;
  }else{
  i=436;
  }
  }


															/* neutron interacts with the straight top OUTER wall - comments are analog to inner elliptic right wall*/

  if (myuOW10!=-1 && t2h1uwt10 > 0 && t2h1uwt10 < t1 
  && t2h1uwt10 < t2w1r && t2h1uwt10 < t2w1l && t2h1uwt10 < t2h1u && t2h1uwt10 < t2h1d && t2h1uwt10 < t2w1rwt && t2h1uwt10 < t2w1lwt && t2h1uwt10 < t2h1uwt && t2h1uwt10 < t2h1dwt 
  && t2h1uwt10 < t2w1r1 && t2h1uwt10 < t2w1l1 && t2h1uwt10 < t2h1u1 && t2h1uwt10 < t2h1d1 && t2h1uwt10 < t2w1rwt1 && t2h1uwt10 < t2w1lwt1 && t2h1uwt10 < t2h1uwt1 && t2h1uwt10 < t2h1dwt1
  && t2h1uwt10 < t2w1r2 && t2h1uwt10 < t2w1l2 && t2h1uwt10 < t2h1u2 && t2h1uwt10 < t2h1d2 && t2h1uwt10 < t2w1rwt2 && t2h1uwt10 < t2w1lwt2 && t2h1uwt10 < t2h1uwt2 && t2h1uwt10 < t2h1dwt2
  && t2h1uwt10 < t2w1r3 && t2h1uwt10 < t2w1l3 && t2h1uwt10 < t2h1u3 && t2h1uwt10 < t2h1d3 && t2h1uwt10 < t2w1rwt3 && t2h1uwt10 < t2w1lwt3 && t2h1uwt10 < t2h1uwt3 && t2h1uwt10 < t2h1dwt3
  && t2h1uwt10 < t2w1r4 && t2h1uwt10 < t2w1l4 && t2h1uwt10 < t2h1u4 && t2h1uwt10 < t2h1d4 && t2h1uwt10 < t2w1rwt4 && t2h1uwt10 < t2w1lwt4 && t2h1uwt10 < t2h1uwt4 && t2h1uwt10 < t2h1dwt4
  && t2h1uwt10 < t2w1r5 && t2h1uwt10 < t2w1l5 && t2h1uwt10 < t2h1u5 && t2h1uwt10 < t2h1d5 && t2h1uwt10 < t2w1rwt5 && t2h1uwt10 < t2w1lwt5 && t2h1uwt10 < t2h1uwt5 && t2h1uwt10 < t2h1dwt5
  && t2h1uwt10 < t2w1r6 && t2h1uwt10 < t2w1l6 && t2h1uwt10 < t2h1u6 && t2h1uwt10 < t2h1d6 && t2h1uwt10 < t2w1rwt6 && t2h1uwt10 < t2w1lwt6 && t2h1uwt10 < t2h1uwt6 && t2h1uwt10 < t2h1dwt6
  && t2h1uwt10 < t2w1r7 && t2h1uwt10 < t2w1l7 && t2h1uwt10 < t2h1u7 && t2h1uwt10 < t2h1d7 && t2h1uwt10 < t2w1rwt7 && t2h1uwt10 < t2w1lwt7 && t2h1uwt10 < t2h1uwt7 && t2h1uwt10 < t2h1dwt7
  && t2h1uwt10 < t2w1r8 && t2h1uwt10 < t2w1l8 && t2h1uwt10 < t2h1u8 && t2h1uwt10 < t2h1d8 && t2h1uwt10 < t2w1rwt8 && t2h1uwt10 < t2w1lwt8 && t2h1uwt10 < t2h1uwt8 && t2h1uwt10 < t2h1dwt8
  && t2h1uwt10 < t2w1r9 && t2h1uwt10 < t2w1l9 && t2h1uwt10 < t2h1u9 && t2h1uwt10 < t2h1d9 && t2h1uwt10 < t2w1rwt9 && t2h1uwt10 < t2w1lwt9 && t2h1uwt10 < t2h1uwt9 && t2h1uwt10 < t2h1dwt9
  && t2h1uwt10 < t2w1r10 && t2h1uwt10 < t2w1l10 && t2h1uwt10 < t2h1u10 && t2h1uwt10 < t2h1d10 && t2h1uwt10 < t2w1rwt10 && t2h1uwt10 < t2w1lwt10 && t2h1uwt10 < t2h1dwt10
  && (louthu10 == 0 && linhu10 == 0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1uwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1uwt10+z))*(z0wr10+(vz*t2h1uwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1uwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1uwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1uwt10+z))*(z0wl10+(vz*t2h1uwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1uwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1uwt10+x;
  ytest=vy*t2w1lwt10+y;
  ylimitu=(h2u10-h1u10)*(vz*t2h1uwt10+z)/l+h1uwt10;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest>=ylimitu && myuOW10>0 ){
  i=430;
  }else{
  i=436;
  }
  }

															/* neutron interacts with the elliptic down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW10!=-1 && t2h1dwt10 > 0 && t2h1dwt10 < t1 
  && t2h1dwt10 < t2w1r && t2h1dwt10 < t2w1l && t2h1dwt10 < t2h1u && t2h1dwt10 < t2h1d && t2h1dwt10 < t2w1rwt && t2h1dwt10 < t2w1lwt && t2h1dwt10 < t2h1uwt && t2h1dwt10 < t2h1dwt 
  && t2h1dwt10 < t2w1r1 && t2h1dwt10 < t2w1l1 && t2h1dwt10 < t2h1u1 && t2h1dwt10 < t2h1d1 && t2h1dwt10 < t2w1rwt1 && t2h1dwt10 < t2w1lwt1 && t2h1dwt10 < t2h1uwt1 && t2h1dwt10 < t2h1dwt1
  && t2h1dwt10 < t2w1r2 && t2h1dwt10 < t2w1l2 && t2h1dwt10 < t2h1u2 && t2h1dwt10 < t2h1d2 && t2h1dwt10 < t2w1rwt2 && t2h1dwt10 < t2w1lwt2 && t2h1dwt10 < t2h1uwt2 && t2h1dwt10 < t2h1dwt2 
  && t2h1dwt10 < t2w1r3 && t2h1dwt10 < t2w1l3 && t2h1dwt10 < t2h1u3 && t2h1dwt10 < t2h1d3 && t2h1dwt10 < t2w1rwt3 && t2h1dwt10 < t2w1lwt3 && t2h1dwt10 < t2h1uwt3 && t2h1dwt10 < t2h1dwt3
  && t2h1dwt10 < t2w1r4 && t2h1dwt10 < t2w1l4 && t2h1dwt10 < t2h1u4 && t2h1dwt10 < t2h1d4 && t2h1dwt10 < t2w1rwt4 && t2h1dwt10 < t2w1lwt4 && t2h1dwt10 < t2h1uwt4 && t2h1dwt10 < t2h1dwt4
  && t2h1dwt10 < t2w1r5 && t2h1dwt10 < t2w1l5 && t2h1dwt10 < t2h1u5 && t2h1dwt10 < t2h1d5 && t2h1dwt10 < t2w1rwt5 && t2h1dwt10 < t2w1lwt5 && t2h1dwt10 < t2h1uwt5 && t2h1dwt10 < t2h1dwt5
  && t2h1dwt10 < t2w1r6 && t2h1dwt10 < t2w1l6 && t2h1dwt10 < t2h1u6 && t2h1dwt10 < t2h1d6 && t2h1dwt10 < t2w1rwt6 && t2h1dwt10 < t2w1lwt6 && t2h1dwt10 < t2h1uwt6 && t2h1dwt10 < t2h1dwt6
  && t2h1dwt10 < t2w1r7 && t2h1dwt10 < t2w1l7 && t2h1dwt10 < t2h1u7 && t2h1dwt10 < t2h1d7 && t2h1dwt10 < t2w1rwt7 && t2h1dwt10 < t2w1lwt7 && t2h1dwt10 < t2h1uwt7 && t2h1dwt10 < t2h1dwt7 
  && t2h1dwt10 < t2w1r8 && t2h1dwt10 < t2w1l8 && t2h1dwt10 < t2h1u8 && t2h1dwt10 < t2h1d8 && t2h1dwt10 < t2w1rwt8 && t2h1dwt10 < t2w1lwt8 && t2h1dwt10 < t2h1uwt8 && t2h1dwt10 < t2h1dwt8
  && t2h1dwt10 < t2w1r9 && t2h1dwt10 < t2w1l9 && t2h1dwt10 < t2h1u9 && t2h1dwt10 < t2h1d9 && t2h1dwt10 < t2w1rwt9 && t2h1dwt10 < t2w1lwt9 && t2h1dwt10 < t2h1uwt9 && t2h1dwt10 < t2h1dwt9 
  && t2h1dwt10 < t2w1r10 && t2h1dwt10 < t2w1l10 && t2h1dwt10 < t2h1u10 && t2h1dwt10 < t2h1d10 && t2h1dwt10 < t2w1rwt10 && t2h1dwt10 < t2w1lwt10 && t2h1dwt10 < t2h1uwt10   
  && (louthd10 !=0 && linhd10!=0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1dwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1dwt10+z))*(z0wr10+(vz*t2h1dwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1dwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1dwt10+z))*(z0wl10+(vz*t2h1dwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1dwt10+x;
  ytest=vy*t2w1lwt10+y;
  ylimitd=-bhdwt10*sqrt(1-((vz*t2h1dwt10+z)+z0hd10)*((vz*t2h1dwt10+z)+z0hd10)/a2hdwt10);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW10>0){
  i=431;
  }else{
  i=437;
  }
  }

															/* neutron interacts with the parabolic down OUTER wall - comments are analog to inner elliptic right wall */

  if (mydOW10!=-1 && t2h1dwt10 > 0 && t2h1dwt10 < t1 
  && t2h1dwt10 < t2w1r && t2h1dwt10 < t2w1l && t2h1dwt10 < t2h1u && t2h1dwt10 < t2h1d && t2h1dwt10 < t2w1rwt && t2h1dwt10 < t2w1lwt && t2h1dwt10 < t2h1uwt && t2h1dwt10 < t2h1dwt 
  && t2h1dwt10 < t2w1r1 && t2h1dwt10 < t2w1l1 && t2h1dwt10 < t2h1u1 && t2h1dwt10 < t2h1d1 && t2h1dwt10 < t2w1rwt1 && t2h1dwt10 < t2w1lwt1 && t2h1dwt10 < t2h1uwt1 && t2h1dwt10 < t2h1dwt1
  && t2h1dwt10 < t2w1r2 && t2h1dwt10 < t2w1l2 && t2h1dwt10 < t2h1u2 && t2h1dwt10 < t2h1d2 && t2h1dwt10 < t2w1rwt2 && t2h1dwt10 < t2w1lwt2 && t2h1dwt10 < t2h1uwt2 && t2h1dwt10 < t2h1dwt2 
  && t2h1dwt10 < t2w1r3 && t2h1dwt10 < t2w1l3 && t2h1dwt10 < t2h1u3 && t2h1dwt10 < t2h1d3 && t2h1dwt10 < t2w1rwt3 && t2h1dwt10 < t2w1lwt3 && t2h1dwt10 < t2h1uwt3 && t2h1dwt10 < t2h1dwt3
  && t2h1dwt10 < t2w1r4 && t2h1dwt10 < t2w1l4 && t2h1dwt10 < t2h1u4 && t2h1dwt10 < t2h1d4 && t2h1dwt10 < t2w1rwt4 && t2h1dwt10 < t2w1lwt4 && t2h1dwt10 < t2h1uwt4 && t2h1dwt10 < t2h1dwt4
  && t2h1dwt10 < t2w1r5 && t2h1dwt10 < t2w1l5 && t2h1dwt10 < t2h1u5 && t2h1dwt10 < t2h1d5 && t2h1dwt10 < t2w1rwt5 && t2h1dwt10 < t2w1lwt5 && t2h1dwt10 < t2h1uwt5 && t2h1dwt10 < t2h1dwt5
  && t2h1dwt10 < t2w1r6 && t2h1dwt10 < t2w1l6 && t2h1dwt10 < t2h1u6 && t2h1dwt10 < t2h1d6 && t2h1dwt10 < t2w1rwt6 && t2h1dwt10 < t2w1lwt6 && t2h1dwt10 < t2h1uwt6 && t2h1dwt10 < t2h1dwt6
  && t2h1dwt10 < t2w1r7 && t2h1dwt10 < t2w1l7 && t2h1dwt10 < t2h1u7 && t2h1dwt10 < t2h1d7 && t2h1dwt10 < t2w1rwt7 && t2h1dwt10 < t2w1lwt7 && t2h1dwt10 < t2h1uwt7 && t2h1dwt10 < t2h1dwt7 
  && t2h1dwt10 < t2w1r8 && t2h1dwt10 < t2w1l8 && t2h1dwt10 < t2h1u8 && t2h1dwt10 < t2h1d8 && t2h1dwt10 < t2w1rwt8 && t2h1dwt10 < t2w1lwt8 && t2h1dwt10 < t2h1uwt8 && t2h1dwt10 < t2h1dwt8
  && t2h1dwt10 < t2w1r9 && t2h1dwt10 < t2w1l9 && t2h1dwt10 < t2h1u9 && t2h1dwt10 < t2h1d9 && t2h1dwt10 < t2w1rwt9 && t2h1dwt10 < t2w1lwt9 && t2h1dwt10 < t2h1uwt9 && t2h1dwt10 < t2h1dwt9 
  && t2h1dwt10 < t2w1r10 && t2h1dwt10 < t2w1l10 && t2h1dwt10 < t2h1u10 && t2h1dwt10 < t2h1d10 && t2h1dwt10 < t2w1rwt10 && t2h1dwt10 < t2w1lwt10 && t2h1dwt10 < t2h1uwt10 
  && ((louthd10 !=0 && linhd10==0) || (louthd10 ==0 && linhd10!=0))){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1dwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1dwt10+z))*(z0wr10+(vz*t2h1dwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
     xlimitl=(w2l10-w1l10)/l*(vz*t2h1dwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1dwt10+z))*(z0wl10+(vz*t2h1dwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1dwt10+x;
  ytest=vy*t2w1lwt10+y;
  ylimitd=-sqrt((pbhdwt10-(vz*t2h1dwt10+z))/pahdwt10);
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW10>0 ){
  i=432;
  }else{
  i=437;
  }
  }

															/* neutron interacts with the straight down OUTER wall - comments are analog to inner elliptic right wall*/

  if (mydOW10!=-1 && t2h1dwt10 > 0 && t2h1dwt10 < t1 
  && t2h1dwt10 < t2w1r && t2h1dwt10 < t2w1l && t2h1dwt10 < t2h1u && t2h1dwt10 < t2h1d && t2h1dwt10 < t2w1rwt && t2h1dwt10 < t2w1lwt && t2h1dwt10 < t2h1uwt && t2h1dwt10 < t2h1dwt 
  && t2h1dwt10 < t2w1r1 && t2h1dwt10 < t2w1l1 && t2h1dwt10 < t2h1u1 && t2h1dwt10 < t2h1d1 && t2h1dwt10 < t2w1rwt1 && t2h1dwt10 < t2w1lwt1 && t2h1dwt10 < t2h1uwt1 && t2h1dwt10 < t2h1dwt1
  && t2h1dwt10 < t2w1r2 && t2h1dwt10 < t2w1l2 && t2h1dwt10 < t2h1u2 && t2h1dwt10 < t2h1d2 && t2h1dwt10 < t2w1rwt2 && t2h1dwt10 < t2w1lwt2 && t2h1dwt10 < t2h1uwt2 && t2h1dwt10 < t2h1dwt2 
  && t2h1dwt10 < t2w1r3 && t2h1dwt10 < t2w1l3 && t2h1dwt10 < t2h1u3 && t2h1dwt10 < t2h1d3 && t2h1dwt10 < t2w1rwt3 && t2h1dwt10 < t2w1lwt3 && t2h1dwt10 < t2h1uwt3 && t2h1dwt10 < t2h1dwt3
  && t2h1dwt10 < t2w1r4 && t2h1dwt10 < t2w1l4 && t2h1dwt10 < t2h1u4 && t2h1dwt10 < t2h1d4 && t2h1dwt10 < t2w1rwt4 && t2h1dwt10 < t2w1lwt4 && t2h1dwt10 < t2h1uwt4 && t2h1dwt10 < t2h1dwt4
  && t2h1dwt10 < t2w1r5 && t2h1dwt10 < t2w1l5 && t2h1dwt10 < t2h1u5 && t2h1dwt10 < t2h1d5 && t2h1dwt10 < t2w1rwt5 && t2h1dwt10 < t2w1lwt5 && t2h1dwt10 < t2h1uwt5 && t2h1dwt10 < t2h1dwt5
  && t2h1dwt10 < t2w1r6 && t2h1dwt10 < t2w1l6 && t2h1dwt10 < t2h1u6 && t2h1dwt10 < t2h1d6 && t2h1dwt10 < t2w1rwt6 && t2h1dwt10 < t2w1lwt6 && t2h1dwt10 < t2h1uwt6 && t2h1dwt10 < t2h1dwt6
  && t2h1dwt10 < t2w1r7 && t2h1dwt10 < t2w1l7 && t2h1dwt10 < t2h1u7 && t2h1dwt10 < t2h1d7 && t2h1dwt10 < t2w1rwt7 && t2h1dwt10 < t2w1lwt7 && t2h1dwt10 < t2h1uwt7 && t2h1dwt10 < t2h1dwt7 
  && t2h1dwt10 < t2w1r8 && t2h1dwt10 < t2w1l8 && t2h1dwt10 < t2h1u8 && t2h1dwt10 < t2h1d8 && t2h1dwt10 < t2w1rwt8 && t2h1dwt10 < t2w1lwt8 && t2h1dwt10 < t2h1uwt8 && t2h1dwt10 < t2h1dwt8
  && t2h1dwt10 < t2w1r9 && t2h1dwt10 < t2w1l9 && t2h1dwt10 < t2h1u9 && t2h1dwt10 < t2h1d9 && t2h1dwt10 < t2w1rwt9 && t2h1dwt10 < t2w1lwt9 && t2h1dwt10 < t2h1uwt9 && t2h1dwt10 < t2h1dwt9 
  && t2h1dwt10 < t2w1r10 && t2h1dwt10 < t2w1l10 && t2h1dwt10 < t2h1u10 && t2h1dwt10 < t2h1d10 && t2h1dwt10 < t2w1rwt10 && t2h1dwt10 < t2w1lwt10 && t2h1dwt10 < t2h1uwt10 
  && (louthd10 == 0 && linhd10 == 0)){
  if(linwr10==0 && loutwr10==0)
  {
    xlimitr=(-w2r10+w1r10)/l*(vz*t2h1dwt10+z)-w1rwt10;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xlimitr=-bwrwt10*sqrt(1-((z0wr10+(vz*t2h1dwt10+z))*(z0wr10+(vz*t2h1dwt10+z)))/a2wrwt10);
    }else{
    xlimitr=-sqrt(((vz*t2h1dwt10+z)-pbwrwt10)/-pawrwt10);
    }
  }
  if(linwl10==0 && loutwl10 == 0)
   {
      xlimitl=(w2l10-w1l10)/l*(vz*t2h1dwt10+z)+w1lwt10;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xlimitl=bwlwt10*sqrt(1-((z0wl10+(vz*t2h1dwt10+z))*(z0wl10+(vz*t2h1dwt10+z)))/a2wlwt10);
      }else{
      xlimitl=sqrt(((vz*t2h1dwt10+z)-pbwlwt10)/-pawlwt10);
      }
   }
  xtest=vx*t2h1dwt10+x;
  ytest=vy*t2w1lwt10+y;
  ylimitd=(-h2d10+h1d10)*(vz*t2h1dwt10+z)/l-h1dwt10;
  if (xtest>=xlimitr && xtest<=xlimitl && ytest<=ylimitd && mydOW10>0 ){
  i=433;
  }else{
  i=437;
  }
  }


  if (mxrOW10==-1 && t2w1rwt10 > 0 && t2w1rwt10 < t1 
  && t2w1rwt10 < t2w1r && t2w1rwt10 < t2w1l && t2w1rwt10 < t2h1u && t2w1rwt10 < t2h1d && t2w1rwt10 <t2w1rwt && t2w1rwt10 <t2w1lwt && t2w1rwt10 < t2h1uwt && t2w1rwt10 < t2h1dwt
  && t2w1rwt10 < t2w1r1 && t2w1rwt10 < t2w1l1 && t2w1rwt10 < t2h1u1 && t2w1rwt10 < t2h1d1 && t2w1rwt10 <t2w1rwt1 && t2w1rwt10 <t2w1lwt1 && t2w1rwt10 < t2h1uwt1 && t2w1rwt10 < t2h1dwt1
  && t2w1rwt10 < t2w1r2 && t2w1rwt10 < t2w1l2 && t2w1rwt10 < t2h1u2 && t2w1rwt10 < t2h1d2 && t2w1rwt10 <t2w1rwt2 && t2w1rwt10 <t2w1lwt2 && t2w1rwt10 < t2h1uwt2 && t2w1rwt10 < t2h1dwt2
  && t2w1rwt10 < t2w1r3 && t2w1rwt10 < t2w1l3 && t2w1rwt10 < t2h1u3 && t2w1rwt10 < t2h1d3 && t2w1rwt10 <t2w1rwt3 && t2w1rwt10 <t2w1lwt3 && t2w1rwt10 < t2h1uwt3 && t2w1rwt10 < t2h1dwt3
  && t2w1rwt10 < t2w1r4 && t2w1rwt10 < t2w1l4 && t2w1rwt10 < t2h1u4 && t2w1rwt10 < t2h1d4 && t2w1rwt10 <t2w1rwt4 && t2w1rwt10 <t2w1lwt4 && t2w1rwt10 < t2h1uwt4 && t2w1rwt10 < t2h1dwt4
  && t2w1rwt10 < t2w1r5 && t2w1rwt10 < t2w1l5 && t2w1rwt10 < t2h1u5 && t2w1rwt10 < t2h1d5 && t2w1rwt10 <t2w1rwt5 && t2w1rwt10 <t2w1lwt5 && t2w1rwt10 < t2h1uwt5 && t2w1rwt10 < t2h1dwt5
  && t2w1rwt10 < t2w1r6 && t2w1rwt10 < t2w1l6 && t2w1rwt10 < t2h1u6 && t2w1rwt10 < t2h1d6 && t2w1rwt10 <t2w1rwt6 && t2w1rwt10 <t2w1lwt6 && t2w1rwt10 < t2h1uwt6 && t2w1rwt10 < t2h1dwt6
  && t2w1rwt10 < t2w1r7 && t2w1rwt10 < t2w1l7 && t2w1rwt10 < t2h1u7 && t2w1rwt10 < t2h1d7 && t2w1rwt10 <t2w1rwt7 && t2w1rwt10 <t2w1lwt7 && t2w1rwt10 < t2h1uwt7 && t2w1rwt10 < t2h1dwt7
  && t2w1rwt10 < t2w1r8 && t2w1rwt10 < t2w1l8 && t2w1rwt10 < t2h1u8 && t2w1rwt10 < t2h1d8 && t2w1rwt10 <t2w1rwt8 && t2w1rwt10 <t2w1lwt8 && t2w1rwt10 < t2h1uwt8 && t2w1rwt10 < t2h1dwt8
  && t2w1rwt10 < t2w1r9 && t2w1rwt10 < t2w1l9 && t2w1rwt10 < t2h1u9 && t2w1rwt10 < t2h1d9 && t2w1rwt10 <t2w1rwt9 && t2w1rwt10 <t2w1lwt9 && t2w1rwt10 < t2h1uwt9 && t2w1rwt10 < t2h1dwt9
  && t2w1rwt10 < t2w1r10 && t2w1rwt10 < t2w1l10 && t2w1rwt10 < t2h1u10 && t2w1rwt10 < t2h1d10 && t2w1rwt10 <t2w1lwt10 && t2w1rwt10 < t2h1uwt10 && t2w1rwt10 < t2h1dwt10
  && ((linwr10!=0) && (loutwr10!=0) )){
  i=438;
  }

  if (mxrOW10==-1 && t2w1rwt10 > 0 && t2w1rwt10 < t1 
  && t2w1rwt10 < t2w1r && t2w1rwt10 < t2w1l && t2w1rwt10 < t2h1u && t2w1rwt10 < t2h1d && t2w1rwt10 <t2w1rwt && t2w1rwt10 <t2w1lwt && t2w1rwt10 < t2h1uwt && t2w1rwt10 < t2h1dwt
  && t2w1rwt10 < t2w1r1 && t2w1rwt10 < t2w1l1 && t2w1rwt10 < t2h1u1 && t2w1rwt10 < t2h1d1 && t2w1rwt10 <t2w1rwt1 && t2w1rwt10 <t2w1lwt1 && t2w1rwt10 < t2h1uwt1 && t2w1rwt10 < t2h1dwt1
  && t2w1rwt10 < t2w1r2 && t2w1rwt10 < t2w1l2 && t2w1rwt10 < t2h1u2 && t2w1rwt10 < t2h1d2 && t2w1rwt10 <t2w1rwt2 && t2w1rwt10 <t2w1lwt2 && t2w1rwt10 < t2h1uwt2 && t2w1rwt10 < t2h1dwt2
  && t2w1rwt10 < t2w1r3 && t2w1rwt10 < t2w1l3 && t2w1rwt10 < t2h1u3 && t2w1rwt10 < t2h1d3 && t2w1rwt10 <t2w1rwt3 && t2w1rwt10 <t2w1lwt3 && t2w1rwt10 < t2h1uwt3 && t2w1rwt10 < t2h1dwt3
  && t2w1rwt10 < t2w1r4 && t2w1rwt10 < t2w1l4 && t2w1rwt10 < t2h1u4 && t2w1rwt10 < t2h1d4 && t2w1rwt10 <t2w1rwt4 && t2w1rwt10 <t2w1lwt4 && t2w1rwt10 < t2h1uwt4 && t2w1rwt10 < t2h1dwt4
  && t2w1rwt10 < t2w1r5 && t2w1rwt10 < t2w1l5 && t2w1rwt10 < t2h1u5 && t2w1rwt10 < t2h1d5 && t2w1rwt10 <t2w1rwt5 && t2w1rwt10 <t2w1lwt5 && t2w1rwt10 < t2h1uwt5 && t2w1rwt10 < t2h1dwt5
  && t2w1rwt10 < t2w1r6 && t2w1rwt10 < t2w1l6 && t2w1rwt10 < t2h1u6 && t2w1rwt10 < t2h1d6 && t2w1rwt10 <t2w1rwt6 && t2w1rwt10 <t2w1lwt6 && t2w1rwt10 < t2h1uwt6 && t2w1rwt10 < t2h1dwt6
  && t2w1rwt10 < t2w1r7 && t2w1rwt10 < t2w1l7 && t2w1rwt10 < t2h1u7 && t2w1rwt10 < t2h1d7 && t2w1rwt10 <t2w1rwt7 && t2w1rwt10 <t2w1lwt7 && t2w1rwt10 < t2h1uwt7 && t2w1rwt10 < t2h1dwt7
  && t2w1rwt10 < t2w1r8 && t2w1rwt10 < t2w1l8 && t2w1rwt10 < t2h1u8 && t2w1rwt10 < t2h1d8 && t2w1rwt10 <t2w1rwt8 && t2w1rwt10 <t2w1lwt8 && t2w1rwt10 < t2h1uwt8 && t2w1rwt10 < t2h1dwt8
  && t2w1rwt10 < t2w1r9 && t2w1rwt10 < t2w1l9 && t2w1rwt10 < t2h1u9 && t2w1rwt10 < t2h1d9 && t2w1rwt10 <t2w1rwt9 && t2w1rwt10 <t2w1lwt9 && t2w1rwt10 < t2h1uwt9 && t2w1rwt10 < t2h1dwt9
  && t2w1rwt10 < t2w1r10 && t2w1rwt10 < t2w1l10 && t2w1rwt10 < t2h1u10 && t2w1rwt10 < t2h1d10 && t2w1rwt10 <t2w1lwt10 && t2w1rwt10 < t2h1uwt10 && t2w1rwt10 < t2h1dwt10
  && ((loutwr10!=0 && linwr10==0) || (loutwr10==0 && linwr10!=0))){
  i=438;
  }

  if (mxrOW10==-1 && t2w1rwt10 > 0 && t2w1rwt10 < t1 
  && t2w1rwt10 < t2w1r && t2w1rwt10 < t2w1l && t2w1rwt10 < t2h1u && t2w1rwt10 < t2h1d && t2w1rwt10 <t2w1rwt && t2w1rwt10 <t2w1lwt && t2w1rwt10 < t2h1uwt && t2w1rwt10 < t2h1dwt
  && t2w1rwt10 < t2w1r1 && t2w1rwt10 < t2w1l1 && t2w1rwt10 < t2h1u1 && t2w1rwt10 < t2h1d1 && t2w1rwt10 <t2w1rwt1 && t2w1rwt10 <t2w1lwt1 && t2w1rwt10 < t2h1uwt1 && t2w1rwt10 < t2h1dwt1
  && t2w1rwt10 < t2w1r2 && t2w1rwt10 < t2w1l2 && t2w1rwt10 < t2h1u2 && t2w1rwt10 < t2h1d2 && t2w1rwt10 <t2w1rwt2 && t2w1rwt10 <t2w1lwt2 && t2w1rwt10 < t2h1uwt2 && t2w1rwt10 < t2h1dwt2
  && t2w1rwt10 < t2w1r3 && t2w1rwt10 < t2w1l3 && t2w1rwt10 < t2h1u3 && t2w1rwt10 < t2h1d3 && t2w1rwt10 <t2w1rwt3 && t2w1rwt10 <t2w1lwt3 && t2w1rwt10 < t2h1uwt3 && t2w1rwt10 < t2h1dwt3
  && t2w1rwt10 < t2w1r4 && t2w1rwt10 < t2w1l4 && t2w1rwt10 < t2h1u4 && t2w1rwt10 < t2h1d4 && t2w1rwt10 <t2w1rwt4 && t2w1rwt10 <t2w1lwt4 && t2w1rwt10 < t2h1uwt4 && t2w1rwt10 < t2h1dwt4
  && t2w1rwt10 < t2w1r5 && t2w1rwt10 < t2w1l5 && t2w1rwt10 < t2h1u5 && t2w1rwt10 < t2h1d5 && t2w1rwt10 <t2w1rwt5 && t2w1rwt10 <t2w1lwt5 && t2w1rwt10 < t2h1uwt5 && t2w1rwt10 < t2h1dwt5
  && t2w1rwt10 < t2w1r6 && t2w1rwt10 < t2w1l6 && t2w1rwt10 < t2h1u6 && t2w1rwt10 < t2h1d6 && t2w1rwt10 <t2w1rwt6 && t2w1rwt10 <t2w1lwt6 && t2w1rwt10 < t2h1uwt6 && t2w1rwt10 < t2h1dwt6
  && t2w1rwt10 < t2w1r7 && t2w1rwt10 < t2w1l7 && t2w1rwt10 < t2h1u7 && t2w1rwt10 < t2h1d7 && t2w1rwt10 <t2w1rwt7 && t2w1rwt10 <t2w1lwt7 && t2w1rwt10 < t2h1uwt7 && t2w1rwt10 < t2h1dwt7
  && t2w1rwt10 < t2w1r8 && t2w1rwt10 < t2w1l8 && t2w1rwt10 < t2h1u8 && t2w1rwt10 < t2h1d8 && t2w1rwt10 <t2w1rwt8 && t2w1rwt10 <t2w1lwt8 && t2w1rwt10 < t2h1uwt8 && t2w1rwt10 < t2h1dwt8
  && t2w1rwt10 < t2w1r9 && t2w1rwt10 < t2w1l9 && t2w1rwt10 < t2h1u9 && t2w1rwt10 < t2h1d9 && t2w1rwt10 <t2w1rwt9 && t2w1rwt10 <t2w1lwt9 && t2w1rwt10 < t2h1uwt9 && t2w1rwt10 < t2h1dwt9
  && t2w1rwt10 < t2w1r10 && t2w1rwt10 < t2w1l10 && t2w1rwt10 < t2h1u10 && t2w1rwt10 < t2h1d10 && t2w1rwt10 <t2w1lwt10 && t2w1rwt10 < t2h1uwt10 && t2w1rwt10 < t2h1dwt10
  && (loutwr10==0 && linwr10==0)){
  i=438;
  }

  if (mxlOW10==-1 && t2w1lwt10 > 0 && t2w1lwt10 < t1 
  && t2w1lwt10 < t2w1r && t2w1lwt10 < t2w1l && t2w1lwt10 < t2h1u && t2w1lwt10 < t2h1d && t2w1lwt10 <t2w1rwt && t2w1lwt10 <t2w1lwt && t2w1lwt10 < t2h1uwt && t2w1lwt10 < t2h1dwt
  && t2w1lwt10 < t2w1r1 && t2w1lwt10 < t2w1l1 && t2w1lwt10 < t2h1u1 && t2w1lwt10 < t2h1d1 && t2w1lwt10 <t2w1rwt1 && t2w1lwt10 <t2w1lwt1 && t2w1lwt10 < t2h1uwt1 && t2w1lwt10 < t2h1dwt1
  && t2w1lwt10 < t2w1r2 && t2w1lwt10 < t2w1l2 && t2w1lwt10 < t2h1u2 && t2w1lwt10 < t2h1d2 && t2w1lwt10 <t2w1rwt2 && t2w1lwt10 <t2w1lwt2 && t2w1lwt10 < t2h1uwt2 && t2w1lwt10 < t2h1dwt2
  && t2w1lwt10 < t2w1r3 && t2w1lwt10 < t2w1l3 && t2w1lwt10 < t2h1u3 && t2w1lwt10 < t2h1d3 && t2w1lwt10 <t2w1rwt3 && t2w1lwt10 <t2w1lwt3 && t2w1lwt10 < t2h1uwt3 && t2w1lwt10 < t2h1dwt3
  && t2w1lwt10 < t2w1r4 && t2w1lwt10 < t2w1l4 && t2w1lwt10 < t2h1u4 && t2w1lwt10 < t2h1d4 && t2w1lwt10 <t2w1rwt4 && t2w1lwt10 <t2w1lwt4 && t2w1lwt10 < t2h1uwt4 && t2w1lwt10 < t2h1dwt4
  && t2w1lwt10 < t2w1r5 && t2w1lwt10 < t2w1l5 && t2w1lwt10 < t2h1u5 && t2w1lwt10 < t2h1d5 && t2w1lwt10 <t2w1rwt5 && t2w1lwt10 <t2w1lwt5 && t2w1lwt10 < t2h1uwt5 && t2w1lwt10 < t2h1dwt5
  && t2w1lwt10 < t2w1r6 && t2w1lwt10 < t2w1l6 && t2w1lwt10 < t2h1u6 && t2w1lwt10 < t2h1d6 && t2w1lwt10 <t2w1rwt6 && t2w1lwt10 <t2w1lwt6 && t2w1lwt10 < t2h1uwt6 && t2w1lwt10 < t2h1dwt6
  && t2w1lwt10 < t2w1r7 && t2w1lwt10 < t2w1l7 && t2w1lwt10 < t2h1u7 && t2w1lwt10 < t2h1d7 && t2w1lwt10 <t2w1rwt7 && t2w1lwt10 <t2w1lwt7 && t2w1lwt10 < t2h1uwt7 && t2w1lwt10 < t2h1dwt7
  && t2w1lwt10 < t2w1r8 && t2w1lwt10 < t2w1l8 && t2w1lwt10 < t2h1u8 && t2w1lwt10 < t2h1d8 && t2w1lwt10 <t2w1rwt8 && t2w1lwt10 <t2w1lwt8 && t2w1lwt10 < t2h1uwt8 && t2w1lwt10 < t2h1dwt8
  && t2w1lwt10 < t2w1r9 && t2w1lwt10 < t2w1l9 && t2w1lwt10 < t2h1u9 && t2w1lwt10 < t2h1d9 && t2w1lwt10 <t2w1rwt9 && t2w1lwt10 <t2w1lwt9 && t2w1lwt10 < t2h1uwt9 && t2w1lwt10 < t2h1dwt9
  && t2w1lwt10 < t2w1r10 && t2w1lwt10 < t2w1l10 && t2w1lwt10 < t2h1u10 && t2w1lwt10 < t2h1d10 && t2w1lwt10 <t2w1rwt10 && t2w1lwt10 < t2h1uwt10 && t2w1lwt10 < t2h1dwt10
  && ((linwl10!=0) && (loutwl10!=0) )){
  i=439;
  }

  if (mxlOW10==-1 && t2w1lwt10 > 0 && t2w1lwt10 < t1 
  && t2w1lwt10 < t2w1r && t2w1lwt10 < t2w1l && t2w1lwt10 < t2h1u && t2w1lwt10 < t2h1d && t2w1lwt10 <t2w1rwt && t2w1lwt10 <t2w1lwt && t2w1lwt10 < t2h1uwt && t2w1lwt10 < t2h1dwt
  && t2w1lwt10 < t2w1r1 && t2w1lwt10 < t2w1l1 && t2w1lwt10 < t2h1u1 && t2w1lwt10 < t2h1d1 && t2w1lwt10 <t2w1rwt1 && t2w1lwt10 <t2w1lwt1 && t2w1lwt10 < t2h1uwt1 && t2w1lwt10 < t2h1dwt1
  && t2w1lwt10 < t2w1r2 && t2w1lwt10 < t2w1l2 && t2w1lwt10 < t2h1u2 && t2w1lwt10 < t2h1d2 && t2w1lwt10 <t2w1rwt2 && t2w1lwt10 <t2w1lwt2 && t2w1lwt10 < t2h1uwt2 && t2w1lwt10 < t2h1dwt2
  && t2w1lwt10 < t2w1r3 && t2w1lwt10 < t2w1l3 && t2w1lwt10 < t2h1u3 && t2w1lwt10 < t2h1d3 && t2w1lwt10 <t2w1rwt3 && t2w1lwt10 <t2w1lwt3 && t2w1lwt10 < t2h1uwt3 && t2w1lwt10 < t2h1dwt3
  && t2w1lwt10 < t2w1r4 && t2w1lwt10 < t2w1l4 && t2w1lwt10 < t2h1u4 && t2w1lwt10 < t2h1d4 && t2w1lwt10 <t2w1rwt4 && t2w1lwt10 <t2w1lwt4 && t2w1lwt10 < t2h1uwt4 && t2w1lwt10 < t2h1dwt4
  && t2w1lwt10 < t2w1r5 && t2w1lwt10 < t2w1l5 && t2w1lwt10 < t2h1u5 && t2w1lwt10 < t2h1d5 && t2w1lwt10 <t2w1rwt5 && t2w1lwt10 <t2w1lwt5 && t2w1lwt10 < t2h1uwt5 && t2w1lwt10 < t2h1dwt5
  && t2w1lwt10 < t2w1r6 && t2w1lwt10 < t2w1l6 && t2w1lwt10 < t2h1u6 && t2w1lwt10 < t2h1d6 && t2w1lwt10 <t2w1rwt6 && t2w1lwt10 <t2w1lwt6 && t2w1lwt10 < t2h1uwt6 && t2w1lwt10 < t2h1dwt6
  && t2w1lwt10 < t2w1r7 && t2w1lwt10 < t2w1l7 && t2w1lwt10 < t2h1u7 && t2w1lwt10 < t2h1d7 && t2w1lwt10 <t2w1rwt7 && t2w1lwt10 <t2w1lwt7 && t2w1lwt10 < t2h1uwt7 && t2w1lwt10 < t2h1dwt7
  && t2w1lwt10 < t2w1r8 && t2w1lwt10 < t2w1l8 && t2w1lwt10 < t2h1u8 && t2w1lwt10 < t2h1d8 && t2w1lwt10 <t2w1rwt8 && t2w1lwt10 <t2w1lwt8 && t2w1lwt10 < t2h1uwt8 && t2w1lwt10 < t2h1dwt8
  && t2w1lwt10 < t2w1r9 && t2w1lwt10 < t2w1l9 && t2w1lwt10 < t2h1u9 && t2w1lwt10 < t2h1d9 && t2w1lwt10 <t2w1rwt9 && t2w1lwt10 <t2w1lwt9 && t2w1lwt10 < t2h1uwt9 && t2w1lwt10 < t2h1dwt9
  && t2w1lwt10 < t2w1r10 && t2w1lwt10 < t2w1l10 && t2w1lwt10 < t2h1u10 && t2w1lwt10 < t2h1d10 && t2w1lwt10 <t2w1rwt10 && t2w1lwt10 < t2h1uwt10 && t2w1lwt10 < t2h1dwt10
  && ((loutwl10!=0 && linwl10==0) || (loutwl10==0 && linwl10!=0))){
  i=439;
  }

  if (mxlOW10==-1 && t2w1lwt10 > 0 && t2w1lwt10 < t1 
  && t2w1lwt10 < t2w1r && t2w1lwt10 < t2w1l && t2w1lwt10 < t2h1u && t2w1lwt10 < t2h1d && t2w1lwt10 <t2w1rwt && t2w1lwt10 <t2w1lwt && t2w1lwt10 < t2h1uwt && t2w1lwt10 < t2h1dwt
  && t2w1lwt10 < t2w1r1 && t2w1lwt10 < t2w1l1 && t2w1lwt10 < t2h1u1 && t2w1lwt10 < t2h1d1 && t2w1lwt10 <t2w1rwt1 && t2w1lwt10 <t2w1lwt1 && t2w1lwt10 < t2h1uwt1 && t2w1lwt10 < t2h1dwt1
  && t2w1lwt10 < t2w1r2 && t2w1lwt10 < t2w1l2 && t2w1lwt10 < t2h1u2 && t2w1lwt10 < t2h1d2 && t2w1lwt10 <t2w1rwt2 && t2w1lwt10 <t2w1lwt2 && t2w1lwt10 < t2h1uwt2 && t2w1lwt10 < t2h1dwt2
  && t2w1lwt10 < t2w1r3 && t2w1lwt10 < t2w1l3 && t2w1lwt10 < t2h1u3 && t2w1lwt10 < t2h1d3 && t2w1lwt10 <t2w1rwt3 && t2w1lwt10 <t2w1lwt3 && t2w1lwt10 < t2h1uwt3 && t2w1lwt10 < t2h1dwt3
  && t2w1lwt10 < t2w1r4 && t2w1lwt10 < t2w1l4 && t2w1lwt10 < t2h1u4 && t2w1lwt10 < t2h1d4 && t2w1lwt10 <t2w1rwt4 && t2w1lwt10 <t2w1lwt4 && t2w1lwt10 < t2h1uwt4 && t2w1lwt10 < t2h1dwt4
  && t2w1lwt10 < t2w1r5 && t2w1lwt10 < t2w1l5 && t2w1lwt10 < t2h1u5 && t2w1lwt10 < t2h1d5 && t2w1lwt10 <t2w1rwt5 && t2w1lwt10 <t2w1lwt5 && t2w1lwt10 < t2h1uwt5 && t2w1lwt10 < t2h1dwt5
  && t2w1lwt10 < t2w1r6 && t2w1lwt10 < t2w1l6 && t2w1lwt10 < t2h1u6 && t2w1lwt10 < t2h1d6 && t2w1lwt10 <t2w1rwt6 && t2w1lwt10 <t2w1lwt6 && t2w1lwt10 < t2h1uwt6 && t2w1lwt10 < t2h1dwt6
  && t2w1lwt10 < t2w1r7 && t2w1lwt10 < t2w1l7 && t2w1lwt10 < t2h1u7 && t2w1lwt10 < t2h1d7 && t2w1lwt10 <t2w1rwt7 && t2w1lwt10 <t2w1lwt7 && t2w1lwt10 < t2h1uwt7 && t2w1lwt10 < t2h1dwt7
  && t2w1lwt10 < t2w1r8 && t2w1lwt10 < t2w1l8 && t2w1lwt10 < t2h1u8 && t2w1lwt10 < t2h1d8 && t2w1lwt10 <t2w1rwt8 && t2w1lwt10 <t2w1lwt8 && t2w1lwt10 < t2h1uwt8 && t2w1lwt10 < t2h1dwt8
  && t2w1lwt10 < t2w1r9 && t2w1lwt10 < t2w1l9 && t2w1lwt10 < t2h1u9 && t2w1lwt10 < t2h1d9 && t2w1lwt10 <t2w1rwt9 && t2w1lwt10 <t2w1lwt9 && t2w1lwt10 < t2h1uwt9 && t2w1lwt10 < t2h1dwt9
  && t2w1lwt10 < t2w1r10 && t2w1lwt10 < t2w1l10 && t2w1lwt10 < t2h1u10 && t2w1lwt10 < t2h1d10 && t2w1lwt10 <t2w1rwt10 && t2w1lwt10 < t2h1uwt10 && t2w1lwt10 < t2h1dwt10
  && (loutwl10==0 && linwl10==0)){
  i=439;}

  if (myuOW10==-1 && t2h1uwt10 > 0 && t2h1uwt10 < t1 
  && t2h1uwt10 < t2w1r && t2h1uwt10 < t2w1l && t2h1uwt10 < t2h1u && t2h1uwt10 < t2h1d && t2h1uwt10 < t2w1rwt && t2h1uwt10 < t2w1lwt && t2h1uwt10 < t2h1uwt && t2h1uwt10 < t2h1dwt 
  && t2h1uwt10 < t2w1r1 && t2h1uwt10 < t2w1l1 && t2h1uwt10 < t2h1u1 && t2h1uwt10 < t2h1d1 && t2h1uwt10 < t2w1rwt1 && t2h1uwt10 < t2w1lwt1 && t2h1uwt10 < t2h1uwt1 && t2h1uwt10 < t2h1dwt1
  && t2h1uwt10 < t2w1r2 && t2h1uwt10 < t2w1l2 && t2h1uwt10 < t2h1u2 && t2h1uwt10 < t2h1d2 && t2h1uwt10 < t2w1rwt2 && t2h1uwt10 < t2w1lwt2 && t2h1uwt10 < t2h1uwt2 && t2h1uwt10 < t2h1dwt2
  && t2h1uwt10 < t2w1r3 && t2h1uwt10 < t2w1l3 && t2h1uwt10 < t2h1u3 && t2h1uwt10 < t2h1d3 && t2h1uwt10 < t2w1rwt3 && t2h1uwt10 < t2w1lwt3 && t2h1uwt10 < t2h1uwt3 && t2h1uwt10 < t2h1dwt3
  && t2h1uwt10 < t2w1r4 && t2h1uwt10 < t2w1l4 && t2h1uwt10 < t2h1u4 && t2h1uwt10 < t2h1d4 && t2h1uwt10 < t2w1rwt4 && t2h1uwt10 < t2w1lwt4 && t2h1uwt10 < t2h1uwt4 && t2h1uwt10 < t2h1dwt4
  && t2h1uwt10 < t2w1r5 && t2h1uwt10 < t2w1l5 && t2h1uwt10 < t2h1u5 && t2h1uwt10 < t2h1d5 && t2h1uwt10 < t2w1rwt5 && t2h1uwt10 < t2w1lwt5 && t2h1uwt10 < t2h1uwt5 && t2h1uwt10 < t2h1dwt5
  && t2h1uwt10 < t2w1r6 && t2h1uwt10 < t2w1l6 && t2h1uwt10 < t2h1u6 && t2h1uwt10 < t2h1d6 && t2h1uwt10 < t2w1rwt6 && t2h1uwt10 < t2w1lwt6 && t2h1uwt10 < t2h1uwt6 && t2h1uwt10 < t2h1dwt6
  && t2h1uwt10 < t2w1r7 && t2h1uwt10 < t2w1l7 && t2h1uwt10 < t2h1u7 && t2h1uwt10 < t2h1d7 && t2h1uwt10 < t2w1rwt7 && t2h1uwt10 < t2w1lwt7 && t2h1uwt10 < t2h1uwt7 && t2h1uwt10 < t2h1dwt7
  && t2h1uwt10 < t2w1r8 && t2h1uwt10 < t2w1l8 && t2h1uwt10 < t2h1u8 && t2h1uwt10 < t2h1d8 && t2h1uwt10 < t2w1rwt8 && t2h1uwt10 < t2w1lwt8 && t2h1uwt10 < t2h1uwt8 && t2h1uwt10 < t2h1dwt8
  && t2h1uwt10 < t2w1r9 && t2h1uwt10 < t2w1l9 && t2h1uwt10 < t2h1u9 && t2h1uwt10 < t2h1d9 && t2h1uwt10 < t2w1rwt9 && t2h1uwt10 < t2w1lwt9 && t2h1uwt10 < t2h1uwt9 && t2h1uwt10 < t2h1dwt9
  && t2h1uwt10 < t2w1r10 && t2h1uwt10 < t2w1l10 && t2h1uwt10 < t2h1u10 && t2h1uwt10 < t2h1d10 && t2h1uwt10 < t2w1rwt10 && t2h1uwt10 < t2w1lwt10 && t2h1uwt10 < t2h1dwt10
  && (louthu10 !=0 && linhu10!=0)){
  i=440;
  }

  if (myuOW10==-1 && t2h1uwt10 > 0 && t2h1uwt10 < t1 
  && t2h1uwt10 < t2w1r && t2h1uwt10 < t2w1l && t2h1uwt10 < t2h1u && t2h1uwt10 < t2h1d && t2h1uwt10 < t2w1rwt && t2h1uwt10 < t2w1lwt && t2h1uwt10 < t2h1uwt && t2h1uwt10 < t2h1dwt 
  && t2h1uwt10 < t2w1r1 && t2h1uwt10 < t2w1l1 && t2h1uwt10 < t2h1u1 && t2h1uwt10 < t2h1d1 && t2h1uwt10 < t2w1rwt1 && t2h1uwt10 < t2w1lwt1 && t2h1uwt10 < t2h1uwt1 && t2h1uwt10 < t2h1dwt1
  && t2h1uwt10 < t2w1r2 && t2h1uwt10 < t2w1l2 && t2h1uwt10 < t2h1u2 && t2h1uwt10 < t2h1d2 && t2h1uwt10 < t2w1rwt2 && t2h1uwt10 < t2w1lwt2 && t2h1uwt10 < t2h1uwt2 && t2h1uwt10 < t2h1dwt2
  && t2h1uwt10 < t2w1r3 && t2h1uwt10 < t2w1l3 && t2h1uwt10 < t2h1u3 && t2h1uwt10 < t2h1d3 && t2h1uwt10 < t2w1rwt3 && t2h1uwt10 < t2w1lwt3 && t2h1uwt10 < t2h1uwt3 && t2h1uwt10 < t2h1dwt3
  && t2h1uwt10 < t2w1r4 && t2h1uwt10 < t2w1l4 && t2h1uwt10 < t2h1u4 && t2h1uwt10 < t2h1d4 && t2h1uwt10 < t2w1rwt4 && t2h1uwt10 < t2w1lwt4 && t2h1uwt10 < t2h1uwt4 && t2h1uwt10 < t2h1dwt4
  && t2h1uwt10 < t2w1r5 && t2h1uwt10 < t2w1l5 && t2h1uwt10 < t2h1u5 && t2h1uwt10 < t2h1d5 && t2h1uwt10 < t2w1rwt5 && t2h1uwt10 < t2w1lwt5 && t2h1uwt10 < t2h1uwt5 && t2h1uwt10 < t2h1dwt5
  && t2h1uwt10 < t2w1r6 && t2h1uwt10 < t2w1l6 && t2h1uwt10 < t2h1u6 && t2h1uwt10 < t2h1d6 && t2h1uwt10 < t2w1rwt6 && t2h1uwt10 < t2w1lwt6 && t2h1uwt10 < t2h1uwt6 && t2h1uwt10 < t2h1dwt6
  && t2h1uwt10 < t2w1r7 && t2h1uwt10 < t2w1l7 && t2h1uwt10 < t2h1u7 && t2h1uwt10 < t2h1d7 && t2h1uwt10 < t2w1rwt7 && t2h1uwt10 < t2w1lwt7 && t2h1uwt10 < t2h1uwt7 && t2h1uwt10 < t2h1dwt7
  && t2h1uwt10 < t2w1r8 && t2h1uwt10 < t2w1l8 && t2h1uwt10 < t2h1u8 && t2h1uwt10 < t2h1d8 && t2h1uwt10 < t2w1rwt8 && t2h1uwt10 < t2w1lwt8 && t2h1uwt10 < t2h1uwt8 && t2h1uwt10 < t2h1dwt8
  && t2h1uwt10 < t2w1r9 && t2h1uwt10 < t2w1l9 && t2h1uwt10 < t2h1u9 && t2h1uwt10 < t2h1d9 && t2h1uwt10 < t2w1rwt9 && t2h1uwt10 < t2w1lwt9 && t2h1uwt10 < t2h1uwt9 && t2h1uwt10 < t2h1dwt9
  && t2h1uwt10 < t2w1r10 && t2h1uwt10 < t2w1l10 && t2h1uwt10 < t2h1u10 && t2h1uwt10 < t2h1d10 && t2h1uwt10 < t2w1rwt10 && t2h1uwt10 < t2w1lwt10 && t2h1uwt10 < t2h1dwt10
  && ((louthu10!=0 && linhu10==0) || (louthu10==0 && linhu10!=0))){
  i=440;
  }

  if (myuOW10==-1 && t2h1uwt10 > 0 && t2h1uwt10 < t1 
  && t2h1uwt10 < t2w1r && t2h1uwt10 < t2w1l && t2h1uwt10 < t2h1u && t2h1uwt10 < t2h1d && t2h1uwt10 < t2w1rwt && t2h1uwt10 < t2w1lwt && t2h1uwt10 < t2h1uwt && t2h1uwt10 < t2h1dwt 
  && t2h1uwt10 < t2w1r1 && t2h1uwt10 < t2w1l1 && t2h1uwt10 < t2h1u1 && t2h1uwt10 < t2h1d1 && t2h1uwt10 < t2w1rwt1 && t2h1uwt10 < t2w1lwt1 && t2h1uwt10 < t2h1uwt1 && t2h1uwt10 < t2h1dwt1
  && t2h1uwt10 < t2w1r2 && t2h1uwt10 < t2w1l2 && t2h1uwt10 < t2h1u2 && t2h1uwt10 < t2h1d2 && t2h1uwt10 < t2w1rwt2 && t2h1uwt10 < t2w1lwt2 && t2h1uwt10 < t2h1uwt2 && t2h1uwt10 < t2h1dwt2
  && t2h1uwt10 < t2w1r3 && t2h1uwt10 < t2w1l3 && t2h1uwt10 < t2h1u3 && t2h1uwt10 < t2h1d3 && t2h1uwt10 < t2w1rwt3 && t2h1uwt10 < t2w1lwt3 && t2h1uwt10 < t2h1uwt3 && t2h1uwt10 < t2h1dwt3
  && t2h1uwt10 < t2w1r4 && t2h1uwt10 < t2w1l4 && t2h1uwt10 < t2h1u4 && t2h1uwt10 < t2h1d4 && t2h1uwt10 < t2w1rwt4 && t2h1uwt10 < t2w1lwt4 && t2h1uwt10 < t2h1uwt4 && t2h1uwt10 < t2h1dwt4
  && t2h1uwt10 < t2w1r5 && t2h1uwt10 < t2w1l5 && t2h1uwt10 < t2h1u5 && t2h1uwt10 < t2h1d5 && t2h1uwt10 < t2w1rwt5 && t2h1uwt10 < t2w1lwt5 && t2h1uwt10 < t2h1uwt5 && t2h1uwt10 < t2h1dwt5
  && t2h1uwt10 < t2w1r6 && t2h1uwt10 < t2w1l6 && t2h1uwt10 < t2h1u6 && t2h1uwt10 < t2h1d6 && t2h1uwt10 < t2w1rwt6 && t2h1uwt10 < t2w1lwt6 && t2h1uwt10 < t2h1uwt6 && t2h1uwt10 < t2h1dwt6
  && t2h1uwt10 < t2w1r7 && t2h1uwt10 < t2w1l7 && t2h1uwt10 < t2h1u7 && t2h1uwt10 < t2h1d7 && t2h1uwt10 < t2w1rwt7 && t2h1uwt10 < t2w1lwt7 && t2h1uwt10 < t2h1uwt7 && t2h1uwt10 < t2h1dwt7
  && t2h1uwt10 < t2w1r8 && t2h1uwt10 < t2w1l8 && t2h1uwt10 < t2h1u8 && t2h1uwt10 < t2h1d8 && t2h1uwt10 < t2w1rwt8 && t2h1uwt10 < t2w1lwt8 && t2h1uwt10 < t2h1uwt8 && t2h1uwt10 < t2h1dwt8
  && t2h1uwt10 < t2w1r9 && t2h1uwt10 < t2w1l9 && t2h1uwt10 < t2h1u9 && t2h1uwt10 < t2h1d9 && t2h1uwt10 < t2w1rwt9 && t2h1uwt10 < t2w1lwt9 && t2h1uwt10 < t2h1uwt9 && t2h1uwt10 < t2h1dwt9
  && t2h1uwt10 < t2w1r10 && t2h1uwt10 < t2w1l10 && t2h1uwt10 < t2h1u10 && t2h1uwt10 < t2h1d10 && t2h1uwt10 < t2w1rwt10 && t2h1uwt10 < t2w1lwt10 && t2h1uwt10 < t2h1dwt10
  && (louthu10 == 0 && linhu10 == 0)){
  i=440;
  }

  if (mydOW10==-1 && t2h1dwt10 > 0 && t2h1dwt10 < t1 
  && t2h1dwt10 < t2w1r && t2h1dwt10 < t2w1l && t2h1dwt10 < t2h1u && t2h1dwt10 < t2h1d && t2h1dwt10 < t2w1rwt && t2h1dwt10 < t2w1lwt && t2h1dwt10 < t2h1uwt && t2h1dwt10 < t2h1dwt 
  && t2h1dwt10 < t2w1r1 && t2h1dwt10 < t2w1l1 && t2h1dwt10 < t2h1u1 && t2h1dwt10 < t2h1d1 && t2h1dwt10 < t2w1rwt1 && t2h1dwt10 < t2w1lwt1 && t2h1dwt10 < t2h1uwt1 && t2h1dwt10 < t2h1dwt1
  && t2h1dwt10 < t2w1r2 && t2h1dwt10 < t2w1l2 && t2h1dwt10 < t2h1u2 && t2h1dwt10 < t2h1d2 && t2h1dwt10 < t2w1rwt2 && t2h1dwt10 < t2w1lwt2 && t2h1dwt10 < t2h1uwt2 && t2h1dwt10 < t2h1dwt2 
  && t2h1dwt10 < t2w1r3 && t2h1dwt10 < t2w1l3 && t2h1dwt10 < t2h1u3 && t2h1dwt10 < t2h1d3 && t2h1dwt10 < t2w1rwt3 && t2h1dwt10 < t2w1lwt3 && t2h1dwt10 < t2h1uwt3 && t2h1dwt10 < t2h1dwt3
  && t2h1dwt10 < t2w1r4 && t2h1dwt10 < t2w1l4 && t2h1dwt10 < t2h1u4 && t2h1dwt10 < t2h1d4 && t2h1dwt10 < t2w1rwt4 && t2h1dwt10 < t2w1lwt4 && t2h1dwt10 < t2h1uwt4 && t2h1dwt10 < t2h1dwt4
  && t2h1dwt10 < t2w1r5 && t2h1dwt10 < t2w1l5 && t2h1dwt10 < t2h1u5 && t2h1dwt10 < t2h1d5 && t2h1dwt10 < t2w1rwt5 && t2h1dwt10 < t2w1lwt5 && t2h1dwt10 < t2h1uwt5 && t2h1dwt10 < t2h1dwt5
  && t2h1dwt10 < t2w1r6 && t2h1dwt10 < t2w1l6 && t2h1dwt10 < t2h1u6 && t2h1dwt10 < t2h1d6 && t2h1dwt10 < t2w1rwt6 && t2h1dwt10 < t2w1lwt6 && t2h1dwt10 < t2h1uwt6 && t2h1dwt10 < t2h1dwt6
  && t2h1dwt10 < t2w1r7 && t2h1dwt10 < t2w1l7 && t2h1dwt10 < t2h1u7 && t2h1dwt10 < t2h1d7 && t2h1dwt10 < t2w1rwt7 && t2h1dwt10 < t2w1lwt7 && t2h1dwt10 < t2h1uwt7 && t2h1dwt10 < t2h1dwt7 
  && t2h1dwt10 < t2w1r8 && t2h1dwt10 < t2w1l8 && t2h1dwt10 < t2h1u8 && t2h1dwt10 < t2h1d8 && t2h1dwt10 < t2w1rwt8 && t2h1dwt10 < t2w1lwt8 && t2h1dwt10 < t2h1uwt8 && t2h1dwt10 < t2h1dwt8
  && t2h1dwt10 < t2w1r9 && t2h1dwt10 < t2w1l9 && t2h1dwt10 < t2h1u9 && t2h1dwt10 < t2h1d9 && t2h1dwt10 < t2w1rwt9 && t2h1dwt10 < t2w1lwt9 && t2h1dwt10 < t2h1uwt9 && t2h1dwt10 < t2h1dwt9 
  && t2h1dwt10 < t2w1r10 && t2h1dwt10 < t2w1l10 && t2h1dwt10 < t2h1u10 && t2h1dwt10 < t2h1d10 && t2h1dwt10 < t2w1rwt10 && t2h1dwt10 < t2w1lwt10 && t2h1dwt10 < t2h1uwt10   
  && (louthd10 !=0 && linhd10!=0)){
  i=441;
  }

  if (mydOW10==-1 && t2h1dwt10 > 0 && t2h1dwt10 < t1 
  && t2h1dwt10 < t2w1r && t2h1dwt10 < t2w1l && t2h1dwt10 < t2h1u && t2h1dwt10 < t2h1d && t2h1dwt10 < t2w1rwt && t2h1dwt10 < t2w1lwt && t2h1dwt10 < t2h1uwt && t2h1dwt10 < t2h1dwt 
  && t2h1dwt10 < t2w1r1 && t2h1dwt10 < t2w1l1 && t2h1dwt10 < t2h1u1 && t2h1dwt10 < t2h1d1 && t2h1dwt10 < t2w1rwt1 && t2h1dwt10 < t2w1lwt1 && t2h1dwt10 < t2h1uwt1 && t2h1dwt10 < t2h1dwt1
  && t2h1dwt10 < t2w1r2 && t2h1dwt10 < t2w1l2 && t2h1dwt10 < t2h1u2 && t2h1dwt10 < t2h1d2 && t2h1dwt10 < t2w1rwt2 && t2h1dwt10 < t2w1lwt2 && t2h1dwt10 < t2h1uwt2 && t2h1dwt10 < t2h1dwt2 
  && t2h1dwt10 < t2w1r3 && t2h1dwt10 < t2w1l3 && t2h1dwt10 < t2h1u3 && t2h1dwt10 < t2h1d3 && t2h1dwt10 < t2w1rwt3 && t2h1dwt10 < t2w1lwt3 && t2h1dwt10 < t2h1uwt3 && t2h1dwt10 < t2h1dwt3
  && t2h1dwt10 < t2w1r4 && t2h1dwt10 < t2w1l4 && t2h1dwt10 < t2h1u4 && t2h1dwt10 < t2h1d4 && t2h1dwt10 < t2w1rwt4 && t2h1dwt10 < t2w1lwt4 && t2h1dwt10 < t2h1uwt4 && t2h1dwt10 < t2h1dwt4
  && t2h1dwt10 < t2w1r5 && t2h1dwt10 < t2w1l5 && t2h1dwt10 < t2h1u5 && t2h1dwt10 < t2h1d5 && t2h1dwt10 < t2w1rwt5 && t2h1dwt10 < t2w1lwt5 && t2h1dwt10 < t2h1uwt5 && t2h1dwt10 < t2h1dwt5
  && t2h1dwt10 < t2w1r6 && t2h1dwt10 < t2w1l6 && t2h1dwt10 < t2h1u6 && t2h1dwt10 < t2h1d6 && t2h1dwt10 < t2w1rwt6 && t2h1dwt10 < t2w1lwt6 && t2h1dwt10 < t2h1uwt6 && t2h1dwt10 < t2h1dwt6
  && t2h1dwt10 < t2w1r7 && t2h1dwt10 < t2w1l7 && t2h1dwt10 < t2h1u7 && t2h1dwt10 < t2h1d7 && t2h1dwt10 < t2w1rwt7 && t2h1dwt10 < t2w1lwt7 && t2h1dwt10 < t2h1uwt7 && t2h1dwt10 < t2h1dwt7 
  && t2h1dwt10 < t2w1r8 && t2h1dwt10 < t2w1l8 && t2h1dwt10 < t2h1u8 && t2h1dwt10 < t2h1d8 && t2h1dwt10 < t2w1rwt8 && t2h1dwt10 < t2w1lwt8 && t2h1dwt10 < t2h1uwt8 && t2h1dwt10 < t2h1dwt8
  && t2h1dwt10 < t2w1r9 && t2h1dwt10 < t2w1l9 && t2h1dwt10 < t2h1u9 && t2h1dwt10 < t2h1d9 && t2h1dwt10 < t2w1rwt9 && t2h1dwt10 < t2w1lwt9 && t2h1dwt10 < t2h1uwt9 && t2h1dwt10 < t2h1dwt9 
  && t2h1dwt10 < t2w1r10 && t2h1dwt10 < t2w1l10 && t2h1dwt10 < t2h1u10 && t2h1dwt10 < t2h1d10 && t2h1dwt10 < t2w1rwt10 && t2h1dwt10 < t2w1lwt10 && t2h1dwt10 < t2h1uwt10 
  && ((louthd10 !=0 && linhd10==0) || (louthd10 ==0 && linhd10!=0))){
  i=441;
  }

  if (mydOW10==-1 && t2h1dwt10 > 0 && t2h1dwt10 < t1 
  && t2h1dwt10 < t2w1r && t2h1dwt10 < t2w1l && t2h1dwt10 < t2h1u && t2h1dwt10 < t2h1d && t2h1dwt10 < t2w1rwt && t2h1dwt10 < t2w1lwt && t2h1dwt10 < t2h1uwt && t2h1dwt10 < t2h1dwt 
  && t2h1dwt10 < t2w1r1 && t2h1dwt10 < t2w1l1 && t2h1dwt10 < t2h1u1 && t2h1dwt10 < t2h1d1 && t2h1dwt10 < t2w1rwt1 && t2h1dwt10 < t2w1lwt1 && t2h1dwt10 < t2h1uwt1 && t2h1dwt10 < t2h1dwt1
  && t2h1dwt10 < t2w1r2 && t2h1dwt10 < t2w1l2 && t2h1dwt10 < t2h1u2 && t2h1dwt10 < t2h1d2 && t2h1dwt10 < t2w1rwt2 && t2h1dwt10 < t2w1lwt2 && t2h1dwt10 < t2h1uwt2 && t2h1dwt10 < t2h1dwt2 
  && t2h1dwt10 < t2w1r3 && t2h1dwt10 < t2w1l3 && t2h1dwt10 < t2h1u3 && t2h1dwt10 < t2h1d3 && t2h1dwt10 < t2w1rwt3 && t2h1dwt10 < t2w1lwt3 && t2h1dwt10 < t2h1uwt3 && t2h1dwt10 < t2h1dwt3
  && t2h1dwt10 < t2w1r4 && t2h1dwt10 < t2w1l4 && t2h1dwt10 < t2h1u4 && t2h1dwt10 < t2h1d4 && t2h1dwt10 < t2w1rwt4 && t2h1dwt10 < t2w1lwt4 && t2h1dwt10 < t2h1uwt4 && t2h1dwt10 < t2h1dwt4
  && t2h1dwt10 < t2w1r5 && t2h1dwt10 < t2w1l5 && t2h1dwt10 < t2h1u5 && t2h1dwt10 < t2h1d5 && t2h1dwt10 < t2w1rwt5 && t2h1dwt10 < t2w1lwt5 && t2h1dwt10 < t2h1uwt5 && t2h1dwt10 < t2h1dwt5
  && t2h1dwt10 < t2w1r6 && t2h1dwt10 < t2w1l6 && t2h1dwt10 < t2h1u6 && t2h1dwt10 < t2h1d6 && t2h1dwt10 < t2w1rwt6 && t2h1dwt10 < t2w1lwt6 && t2h1dwt10 < t2h1uwt6 && t2h1dwt10 < t2h1dwt6
  && t2h1dwt10 < t2w1r7 && t2h1dwt10 < t2w1l7 && t2h1dwt10 < t2h1u7 && t2h1dwt10 < t2h1d7 && t2h1dwt10 < t2w1rwt7 && t2h1dwt10 < t2w1lwt7 && t2h1dwt10 < t2h1uwt7 && t2h1dwt10 < t2h1dwt7 
  && t2h1dwt10 < t2w1r8 && t2h1dwt10 < t2w1l8 && t2h1dwt10 < t2h1u8 && t2h1dwt10 < t2h1d8 && t2h1dwt10 < t2w1rwt8 && t2h1dwt10 < t2w1lwt8 && t2h1dwt10 < t2h1uwt8 && t2h1dwt10 < t2h1dwt8
  && t2h1dwt10 < t2w1r9 && t2h1dwt10 < t2w1l9 && t2h1dwt10 < t2h1u9 && t2h1dwt10 < t2h1d9 && t2h1dwt10 < t2w1rwt9 && t2h1dwt10 < t2w1lwt9 && t2h1dwt10 < t2h1uwt9 && t2h1dwt10 < t2h1dwt9 
  && t2h1dwt10 < t2w1r10 && t2h1dwt10 < t2w1l10 && t2h1dwt10 < t2h1u10 && t2h1dwt10 < t2h1d10 && t2h1dwt10 < t2w1rwt10 && t2h1dwt10 < t2w1lwt10 && t2h1dwt10 < t2h1uwt10 
  && (louthd10 == 0 && linhd10 == 0)){ 
  i=441;
  }


switch(i){ /* the principal for the calculation is in every case the same: 1.) one needs the surface normal vector at the intersection point. 2.) calculation of the velocity vector after the interaction by  */
           /* vector subrtation (the basic idea and explanations can be found in the 'Mcstas component manual' in the section 'straight guide') */

  case 1: 										/* no interaction, propagation to the end of the guide */
        PROP_DT(t1);
        break;

  case 2: 
        PROP_DT(t2w1r);									/* propagation to interaction point */
        vxin=vx;									/* saving the velocity vector before the interaction*/
        vyin=vy;
        vzin=vz;
        nx=-x;										/* surface normal vector components at the intersection point */
        nz=-x*x/((a2wr/(z+z0wr))-(z0wr+z));
        n2=sqrt(nx*nx+nz*nz);								/* lenght of the surface normal */
        pf=2.0*(vx*nx+vz*nz)/n2;							/* prefactor for the calculation of the velocity vector after the interaction */
        vx-=pf*nx/n2;									/* velocity vector after the interaction*/
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));	/* calculation the q-vector to calculated the reflectivity*/
        break;

 case 3: 
        PROP_DT(t2w1r);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 4: 
        PROP_DT(t2w1r);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r-w1r;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 5: 
        PROP_DT(t2w1l);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl/(z+z0wl))-(z0wl+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 6: 
        PROP_DT(t2w1l);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 7: 
        PROP_DT(t2w1l);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l-w1l;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 8: 
        PROP_DT(t2h1u);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu/(z+z0hu))-(z0hu+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 9: 
        PROP_DT(t2h1u);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 10: 
        PROP_DT(t2h1u);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u-h1u;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 11: 
        PROP_DT(t2h1d);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd/(z+z0hd))-(z0hd+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 12: 
        PROP_DT(t2h1d);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 13: 
        PROP_DT(t2h1d);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d-h1d;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 14:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r);
         break;

  case 15:
	 PROP_DT(t2w1l);
         break;

  case 16:
	 PROP_DT(t2h1u);
         break;

  case 17:
	 PROP_DT(t2h1d);
         break;
  
   case 18:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r);
         ABSORB;
         break;

  case 19:
	 PROP_DT(t2w1l);
         ABSORB;
         break;

  case 20:
	 PROP_DT(t2h1u);
         ABSORB;
         break;

  case 21:
	 PROP_DT(t2h1d);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 22: 
        PROP_DT(t2w1rwt);								/* propagation to interaction point */
        vxin=vx;									/* saving the velocity vector before the interaction*/
        vyin=vy;
        vzin=vz;
        nx=x;										/* surface normal vector components at the intersection point */
        nz=x*x/((a2wrwt/(z+z0wr))-(z0wr+z));
        n2=sqrt(nx*nx+nz*nz);								/* lenght of the surface normal */
        pf=2.0*(vx*nx+vz*nz)/n2;							/* prefactor for the calculation of the velocity vector after the interaction */
        vx-=pf*nx/n2;									/* velocity vector after the interaction*/
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));	/* calculation the q-vector to calculated the reflectivity*/
        break;

 case 23: 
        PROP_DT(t2w1rwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 24: 
        PROP_DT(t2w1rwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r-w1r);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 25: 
        PROP_DT(t2w1lwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt/(z+z0wl))-(z0wl+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 26: 
        PROP_DT(t2w1lwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 27: 
        PROP_DT(t2w1lwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l-w1l);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 28: 
        PROP_DT(t2h1uwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt/(z+z0hu))-(z0hu+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 29: 
        PROP_DT(t2h1uwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 30: 
        PROP_DT(t2h1uwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u-h1u);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 31: 
        PROP_DT(t2h1dwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt/(z+z0hd))-(z0hd+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 32: 
        PROP_DT(t2h1dwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 33: 
        PROP_DT(t2h1dwt);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d-h1d);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 34:
	 PROP_DT(t2w1rwt);
         ABSORB;
         break;

  case 35:
	 PROP_DT(t2w1lwt);
         ABSORB;
         break;

  case 36:
	 PROP_DT(t2h1uwt);
         ABSORB;
         break;

  case 37:
	 PROP_DT(t2h1dwt);
         ABSORB;
         break;

  case 38:
	 PROP_DT(t2w1rwt);
         break;

  case 39:
	 PROP_DT(t2w1lwt);
         break;

  case 40:
	 PROP_DT(t2h1uwt);
         break;

  case 41:
	 PROP_DT(t2h1dwt);
         break;

  case 42: 
        PROP_DT(t2w1r1);									/* propagation to interaction point */
        vxin=vx;									/* saving the velocity vector before the interaction*/
        vyin=vy;
        vzin=vz;
        nx=-x;										/* surface normal vector components at the intersection point */
        nz=-x*x/((a2wr1/(z+z0wr1))-(z0wr1+z));
        n2=sqrt(nx*nx+nz*nz);								/* lenght of the surface normal */
        pf=2.0*(vx*nx+vz*nz)/n2;							/* prefactor for the calculation of the velocity vector after the interaction */
        vx-=pf*nx/n2;									/* velocity vector after the interaction*/
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));	/* calculation the q-vector to calculated the reflectivity*/
        break;

 case 43: 
        PROP_DT(t2w1r1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr1;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 44: 
        PROP_DT(t2w1r1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r1-w1r1;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 45: 
        PROP_DT(t2w1l1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl1/(z+z0wl1))-(z0wl1+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 46: 
        PROP_DT(t2w1l1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl1;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 47: 
        PROP_DT(t2w1l1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l1-w1l1;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 48: 
        PROP_DT(t2h1u1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu1/(z+z0hu1))-(z0hu1+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 49: 
        PROP_DT(t2h1u1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu1;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 50: 
        PROP_DT(t2h1u1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u1-h1u1;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 51: 
        PROP_DT(t2h1d1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd1/(z+z0hd1))-(z0hd1+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 52: 
        PROP_DT(t2h1d1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd1;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 53: 
        PROP_DT(t2h1d1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d1-h1d1;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 54:	
	 PROP_DT(t2w1r1);
         ABSORB;
         break;

  case 55:
	 PROP_DT(t2w1l1);
         ABSORB;
         break;

  case 56:
	 PROP_DT(t2h1u1);
         ABSORB;
         break;

  case 57:
	 PROP_DT(t2h1d1);
         ABSORB;
         break;

  case 58:
         PROP_DT(t2w1r1);
         break;

  case 59:
         PROP_DT(t2w1l1);
         break;

  case 60:
         PROP_DT(t2h1u1);
         break;

  case 61:
	 PROP_DT(t2h1d1);
         break;


  case 62: 
        PROP_DT(t2w1rwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt1/(z+z0wr1))-(z0wr1+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 63: 
        PROP_DT(t2w1rwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt1;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 64: 
        PROP_DT(t2w1rwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r1-w1r1);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 65: 
        PROP_DT(t2w1lwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt1/(z+z0wl1))-(z0wl1+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 66: 
        PROP_DT(t2w1lwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt1;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 67: 
        PROP_DT(t2w1lwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l1-w1l1);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 68: 
        PROP_DT(t2h1uwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt1/(z+z0hu1))-(z0hu1+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 69: 
        PROP_DT(t2h1uwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt1;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 70: 
        PROP_DT(t2h1uwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u1-h1u1);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 71: 
        PROP_DT(t2h1dwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt1/(z+z0hd1))-(z0hd1+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 72: 
        PROP_DT(t2h1dwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt1;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 73: 
        PROP_DT(t2h1dwt1);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d1-h1d1);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 74:
	 PROP_DT(t2w1rwt1);
         ABSORB;
         break;

  case 75:
	 PROP_DT(t2w1lwt1);
         ABSORB;
         break;

  case 76:
	 PROP_DT(t2h1uwt1);
         ABSORB;
         break;

  case 77:
	 PROP_DT(t2h1dwt1);
         ABSORB;
         break;

  case 78:
	 PROP_DT(t2w1rwt1);
         break;

  case 79:
	 PROP_DT(t2w1lwt1);
         break;

  case 80:
	 PROP_DT(t2h1uwt1);
         break;

  case 81:
	 PROP_DT(t2h1dwt1);
         break;

 case 82: 
        PROP_DT(t2w1r2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr2/(z+z0wr2))-(z0wr2+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 83: 
        PROP_DT(t2w1r2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr2;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 84: 
        PROP_DT(t2w1r2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r2-w1r2;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 85: 
        PROP_DT(t2w1l2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl2/(z+z0wl2))-(z0wl2+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 86: 
        PROP_DT(t2w1l2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl2;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 87: 
        PROP_DT(t2w1l2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l2-w1l2;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 88: 
        PROP_DT(t2h1u2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu2/(z+z0hu2))-(z0hu2+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 89: 
        PROP_DT(t2h1u2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu2;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 90: 
        PROP_DT(t2h1u2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u2-h1u2;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 91: 
        PROP_DT(t2h1d2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd2/(z+z0hd2))-(z0hd2+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 92: 
        PROP_DT(t2h1d2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd2;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 93: 
        PROP_DT(t2h1d2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d2-h1d2;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 94:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r2);
         break;

  case 95:
	 PROP_DT(t2w1l2);
         break;

  case 96:
	 PROP_DT(t2h1u2);
         break;

  case 97:
	 PROP_DT(t2h1d2);
         break;
  
   case 98:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r2);
         ABSORB;
         break;

  case 99:
	 PROP_DT(t2w1l2);
         ABSORB;
         break;

  case 100:
	 PROP_DT(t2h1u2);
         ABSORB;
         break;

  case 101:
	 PROP_DT(t2h1d2);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 102: 
        PROP_DT(t2w1rwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt2/(z+z0wr2))-(z0wr2+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 103: 
        PROP_DT(t2w1rwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt2;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 104: 
        PROP_DT(t2w1rwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r2-w1r2);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 105: 
        PROP_DT(t2w1lwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt2/(z+z0wl2))-(z0wl2+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 106: 
        PROP_DT(t2w1lwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt2;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 107: 
        PROP_DT(t2w1lwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l2-w1l2);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 108: 
        PROP_DT(t2h1uwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt2/(z+z0hu2))-(z0hu2+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 109: 
        PROP_DT(t2h1uwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt2;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 110: 
        PROP_DT(t2h1uwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u2-h1u2);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 111: 
        PROP_DT(t2h1dwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt2/(z+z0hd2))-(z0hd2+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 112: 
        PROP_DT(t2h1dwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt2;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 113: 
        PROP_DT(t2h1dwt2);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d2-h1d2);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 114:
	 PROP_DT(t2w1rwt2);
         ABSORB;
         break;

  case 115:
	 PROP_DT(t2w1lwt2);
         ABSORB;
         break;

  case 116:
	 PROP_DT(t2h1uwt2);
         ABSORB;
         break;

  case 117:
	 PROP_DT(t2h1dwt2);
         ABSORB;
         break;

  case 118:
	 PROP_DT(t2w1rwt2);
         break;

  case 119:
	 PROP_DT(t2w1lwt2);
         break;

  case 120:
	 PROP_DT(t2h1uwt2);
         break;

  case 121:
	 PROP_DT(t2h1dwt2);
         break;

  case 122: 
        PROP_DT(t2w1r3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr3/(z+z0wr3))-(z0wr3+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 123: 
        PROP_DT(t2w1r3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr3;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 124: 
        PROP_DT(t2w1r3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r3-w1r3;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 125: 
        PROP_DT(t2w1l3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl3/(z+z0wl3))-(z0wl3+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 126: 
        PROP_DT(t2w1l3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl3;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 127: 
        PROP_DT(t2w1l3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l3-w1l3;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 128: 
        PROP_DT(t2h1u3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu3/(z+z0hu3))-(z0hu3+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 129: 
        PROP_DT(t2h1u3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu3;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 130: 
        PROP_DT(t2h1u3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u3-h1u3;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 131: 
        PROP_DT(t2h1d3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd3/(z+z0hd3))-(z0hd3+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 132: 
        PROP_DT(t2h1d3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd3;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 133: 
        PROP_DT(t2h1d3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d3-h1d3;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 134:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r3);
         break;

  case 135:
	 PROP_DT(t2w1l3);
         break;

  case 136:
	 PROP_DT(t2h1u3);
         break;

  case 137:
	 PROP_DT(t2h1d3);
         break;
  
   case 138:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r3);
         ABSORB;
         break;

  case 139:
	 PROP_DT(t2w1l3);
         ABSORB;
         break;

  case 140:
	 PROP_DT(t2h1u3);
         ABSORB;
         break;

  case 141:
	 PROP_DT(t2h1d3);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 142: 
        PROP_DT(t2w1rwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt3/(z+z0wr3))-(z0wr3+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 143: 
        PROP_DT(t2w1rwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt3;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 144: 
        PROP_DT(t2w1rwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r3-w1r3);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 145: 
        PROP_DT(t2w1lwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt3/(z+z0wl3))-(z0wl3+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 146: 
        PROP_DT(t2w1lwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt3;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 147: 
        PROP_DT(t2w1lwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l3-w1l3);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 148: 
        PROP_DT(t2h1uwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt3/(z+z0hu3))-(z0hu3+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 149: 
        PROP_DT(t2h1uwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt3;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 150: 
        PROP_DT(t2h1uwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u3-h1u3);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 151: 
        PROP_DT(t2h1dwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt3/(z+z0hd3))-(z0hd3+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 152: 
        PROP_DT(t2h1dwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt3;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 153: 
        PROP_DT(t2h1dwt3);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d3-h1d3);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 154:
	 PROP_DT(t2w1rwt3);
         ABSORB;
         break;

  case 155:
	 PROP_DT(t2w1lwt3);
         ABSORB;
         break;

  case 156:
	 PROP_DT(t2h1uwt3);
         ABSORB;
         break;

  case 157:
	 PROP_DT(t2h1dwt3);
         ABSORB;
         break;

  case 158:
	 PROP_DT(t2w1rwt3);
         break;

  case 159:
	 PROP_DT(t2w1lwt3);
         break;

  case 160:
	 PROP_DT(t2h1uwt3);
         break;

  case 161:
	 PROP_DT(t2h1dwt3);
         break;


  case 162: 
        PROP_DT(t2w1r4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr4/(z+z0wr4))-(z0wr4+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 163: 
        PROP_DT(t2w1r4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr4;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 164: 
        PROP_DT(t2w1r4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r4-w1r4;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 165: 
        PROP_DT(t2w1l4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl4/(z+z0wl4))-(z0wl4+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 166: 
        PROP_DT(t2w1l4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl4;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 167: 
        PROP_DT(t2w1l4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l4-w1l4;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 168: 
        PROP_DT(t2h1u4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu4/(z+z0hu4))-(z0hu4+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 169: 
        PROP_DT(t2h1u4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu4;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 170: 
        PROP_DT(t2h1u4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u4-h1u4;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 171: 
        PROP_DT(t2h1d4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd4/(z+z0hd4))-(z0hd4+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 172: 
        PROP_DT(t2h1d4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd4;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 173: 
        PROP_DT(t2h1d4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d4-h1d4;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 174:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r4);
         break;

  case 175:
	 PROP_DT(t2w1l4);
         break;

  case 176:
	 PROP_DT(t2h1u4);
         break;

  case 177:
	 PROP_DT(t2h1d4);
         break;
  
   case 178:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r4);
         ABSORB;
         break;

  case 179:
	 PROP_DT(t2w1l4);
         ABSORB;
         break;

  case 180:
	 PROP_DT(t2h1u4);
         ABSORB;
         break;

  case 181:
	 PROP_DT(t2h1d4);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 182: 
        PROP_DT(t2w1rwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt4/(z+z0wr4))-(z0wr4+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 183: 
        PROP_DT(t2w1rwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt4;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 184: 
        PROP_DT(t2w1rwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r4-w1r4);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 185: 
        PROP_DT(t2w1lwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt4/(z+z0wl4))-(z0wl4+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 186: 
        PROP_DT(t2w1lwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt4;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 187: 
        PROP_DT(t2w1lwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l4-w1l4);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 188: 
        PROP_DT(t2h1uwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt4/(z+z0hu4))-(z0hu4+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 189: 
        PROP_DT(t2h1uwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt4;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 190: 
        PROP_DT(t2h1uwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u4-h1u4);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 191: 
        PROP_DT(t2h1dwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt4/(z+z0hd4))-(z0hd4+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 192: 
        PROP_DT(t2h1dwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt4;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 193: 
        PROP_DT(t2h1dwt4);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d4-h1d4);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 194:
	 PROP_DT(t2w1rwt4);
         ABSORB;
         break;

  case 195:
	 PROP_DT(t2w1lwt4);
         ABSORB;
         break;

  case 196:
	 PROP_DT(t2h1uwt4);
         ABSORB;
         break;

  case 197:
	 PROP_DT(t2h1dwt4);
         ABSORB;
         break;

  case 3198:
	 PROP_DT(t2w1rwt4);
         break;

  case 199:
	 PROP_DT(t2w1lwt4);
         break;

  case 200:
	 PROP_DT(t2h1uwt4);
         break;

  case 201:
	 PROP_DT(t2h1dwt4);
         break;


  case 202: 
        PROP_DT(t2w1r5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr5/(z+z0wr5))-(z0wr5+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 203: 
        PROP_DT(t2w1r5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr5;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 204: 
        PROP_DT(t2w1r5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r5-w1r5;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 205: 
        PROP_DT(t2w1l5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl5/(z+z0wl5))-(z0wl5+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 206: 
        PROP_DT(t2w1l5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl5;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 207: 
        PROP_DT(t2w1l5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l5-w1l5;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 208: 
        PROP_DT(t2h1u5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu5/(z+z0hu5))-(z0hu5+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 209: 
        PROP_DT(t2h1u5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu5;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 210: 
        PROP_DT(t2h1u5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u5-h1u5;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 211: 
        PROP_DT(t2h1d5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd5/(z+z0hd5))-(z0hd5+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 212: 
        PROP_DT(t2h1d5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd5;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 213: 
        PROP_DT(t2h1d5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d5-h1d5;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 214:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r5);
         break;

  case 215:
	 PROP_DT(t2w1l5);
         break;

  case 216:
	 PROP_DT(t2h1u5);
         break;

  case 217:
	 PROP_DT(t2h1d5);
         break;
  
   case 218:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r5);
         ABSORB;
         break;

  case 219:
	 PROP_DT(t2w1l5);
         ABSORB;
         break;

  case 220:
	 PROP_DT(t2h1u5);
         ABSORB;
         break;

  case 221:
	 PROP_DT(t2h1d5);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 222: 
        PROP_DT(t2w1rwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt5/(z+z0wr5))-(z0wr5+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 223: 
        PROP_DT(t2w1rwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt5;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 224: 
        PROP_DT(t2w1rwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r5-w1r5);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 225: 
        PROP_DT(t2w1lwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt5/(z+z0wl5))-(z0wl5+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 226: 
        PROP_DT(t2w1lwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt5;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 227: 
        PROP_DT(t2w1lwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l5-w1l5);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 228: 
        PROP_DT(t2h1uwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt5/(z+z0hu5))-(z0hu5+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 229: 
        PROP_DT(t2h1uwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt5;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 230: 
        PROP_DT(t2h1uwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u5-h1u5);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 231: 
        PROP_DT(t2h1dwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt5/(z+z0hd5))-(z0hd5+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 232: 
        PROP_DT(t2h1dwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt5;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 233: 
        PROP_DT(t2h1dwt5);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d5-h1d5);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 234:
	 PROP_DT(t2w1rwt5);
         ABSORB;
         break;

  case 235:
	 PROP_DT(t2w1lwt5);
         ABSORB;
         break;

  case 236:
	 PROP_DT(t2h1uwt5);
         ABSORB;
         break;

  case 237:
	 PROP_DT(t2h1dwt5);
         ABSORB;
         break;

  case 238:
	 PROP_DT(t2w1rwt5);
         break;

  case 239:
	 PROP_DT(t2w1lwt5);
         break;

  case 240:
	 PROP_DT(t2h1uwt5);
         break;

  case 241:
	 PROP_DT(t2h1dwt5);
         break;

  case 242: 
        PROP_DT(t2w1r6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr6/(z+z0wr6))-(z0wr6+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 243: 
        PROP_DT(t2w1r6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr6;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 244: 
        PROP_DT(t2w1r6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r6-w1r6;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 245: 
        PROP_DT(t2w1l6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl6/(z+z0wl6))-(z0wl6+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 246: 
        PROP_DT(t2w1l6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl6;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 247: 
        PROP_DT(t2w1l6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l6-w1l6;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 248: 
        PROP_DT(t2h1u6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu6/(z+z0hu6))-(z0hu6+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 249: 
        PROP_DT(t2h1u6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu6;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 250: 
        PROP_DT(t2h1u6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u6-h1u6;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 251: 
        PROP_DT(t2h1d6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd6/(z+z0hd6))-(z0hd6+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 252: 
        PROP_DT(t2h1d6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd6;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 253: 
        PROP_DT(t2h1d6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d6-h1d6;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 254:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r6);
         break;

  case 255:
	 PROP_DT(t2w1l6);
         break;

  case 256:
	 PROP_DT(t2h1u6);
         break;

  case 257:
	 PROP_DT(t2h1d6);
         break;
  
   case 258:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r6);
         ABSORB;
         break;

  case 259:
	 PROP_DT(t2w1l6);
         ABSORB;
         break;

  case 260:
	 PROP_DT(t2h1u6);
         ABSORB;
         break;

  case 261:
	 PROP_DT(t2h1d6);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 262: 
        PROP_DT(t2w1rwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt6/(z+z0wr6))-(z0wr6+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 263: 
        PROP_DT(t2w1rwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt6;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 264: 
        PROP_DT(t2w1rwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r6-w1r6);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 265: 
        PROP_DT(t2w1lwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt6/(z+z0wl6))-(z0wl6+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 266: 
        PROP_DT(t2w1lwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt6;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 267: 
        PROP_DT(t2w1lwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l6-w1l6);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 268: 
        PROP_DT(t2h1uwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt6/(z+z0hu6))-(z0hu6+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 269: 
        PROP_DT(t2h1uwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt6;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 270: 
        PROP_DT(t2h1uwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u6-h1u6);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 271: 
        PROP_DT(t2h1dwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt6/(z+z0hd6))-(z0hd6+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 272: 
        PROP_DT(t2h1dwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt6;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 273: 
        PROP_DT(t2h1dwt6);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d6-h1d6);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 274:
	 PROP_DT(t2w1rwt6);
         ABSORB;
         break;

  case 275:
	 PROP_DT(t2w1lwt6);
         ABSORB;
         break;

  case 276:
	 PROP_DT(t2h1uwt6);
         ABSORB;
         break;

  case 277:
	 PROP_DT(t2h1dwt6);
         ABSORB;
         break;

  case 278:
	 PROP_DT(t2w1rwt6);
         break;

  case 279:
	 PROP_DT(t2w1lwt6);
         break;

  case 280:
	 PROP_DT(t2h1uwt6);
         break;

  case 281:
	 PROP_DT(t2h1dwt6);
         break;

 case 282: 
        PROP_DT(t2w1r7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr7/(z+z0wr7))-(z0wr7+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 283: 
        PROP_DT(t2w1r7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr7;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 284: 
        PROP_DT(t2w1r7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r7-w1r7;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 285: 
        PROP_DT(t2w1l7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl7/(z+z0wl7))-(z0wl7+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 286: 
        PROP_DT(t2w1l7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl7;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 287: 
        PROP_DT(t2w1l7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l7-w1l7;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 288: 
        PROP_DT(t2h1u7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu7/(z+z0hu7))-(z0hu7+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 289: 
        PROP_DT(t2h1u7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu7;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 290: 
        PROP_DT(t2h1u7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u7-h1u7;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 291: 
        PROP_DT(t2h1d7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd7/(z+z0hd7))-(z0hd7+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 292: 
        PROP_DT(t2h1d7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd7;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 293: 
        PROP_DT(t2h1d7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d7-h1d7;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 294:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r7);
         break;

  case 295:
	 PROP_DT(t2w1l7);
         break;

  case 296:
	 PROP_DT(t2h1u7);
         break;

  case 297:
	 PROP_DT(t2h1d7);
         break;
  
   case 298:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r7);
         ABSORB;
         break;

  case 299:
	 PROP_DT(t2w1l7);
         ABSORB;
         break;

  case 300:
	 PROP_DT(t2h1u7);
         ABSORB;
         break;

  case 301:
	 PROP_DT(t2h1d7);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 302: 
        PROP_DT(t2w1rwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt7/(z+z0wr7))-(z0wr7+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 303: 
        PROP_DT(t2w1rwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt7;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 304: 
        PROP_DT(t2w1rwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r7-w1r7);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 305: 
        PROP_DT(t2w1lwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt7/(z+z0wl7))-(z0wl7+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 306: 
        PROP_DT(t2w1lwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt7;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 307: 
        PROP_DT(t2w1lwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l7-w1l7);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 308: 
        PROP_DT(t2h1uwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt7/(z+z0hu7))-(z0hu7+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 309: 
        PROP_DT(t2h1uwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt7;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 310: 
        PROP_DT(t2h1uwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u7-h1u7);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 311: 
        PROP_DT(t2h1dwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt7/(z+z0hd7))-(z0hd7+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 312: 
        PROP_DT(t2h1dwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt7;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 313: 
        PROP_DT(t2h1dwt7);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d7-h1d7);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 314:
	 PROP_DT(t2w1rwt7);
         ABSORB;
         break;

  case 315:
	 PROP_DT(t2w1lwt7);
         ABSORB;
         break;

  case 316:
	 PROP_DT(t2h1uwt7);
         ABSORB;
         break;

  case 317:
	 PROP_DT(t2h1dwt7);
         ABSORB;
         break;

  case 318:
	 PROP_DT(t2w1rwt7);
         break;

  case 319:
	 PROP_DT(t2w1lwt7);
         break;

  case 320:
	 PROP_DT(t2h1uwt7);
         break;

  case 321:
	 PROP_DT(t2h1dwt7);
         break;

  case 322: 
        PROP_DT(t2w1r8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr8/(z+z0wr8))-(z0wr8+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 323: 
        PROP_DT(t2w1r8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr8;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 324: 
        PROP_DT(t2w1r8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r8-w1r8;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 325: 
        PROP_DT(t2w1l8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl8/(z+z0wl8))-(z0wl8+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 326: 
        PROP_DT(t2w1l8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl8;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 327: 
        PROP_DT(t2w1l8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l8-w1l8;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 328: 
        PROP_DT(t2h1u8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu8/(z+z0hu8))-(z0hu8+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 329: 
        PROP_DT(t2h1u8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu8;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 330: 
        PROP_DT(t2h1u8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u8-h1u8;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 331: 
        PROP_DT(t2h1d8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd8/(z+z0hd8))-(z0hd8+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 332: 
        PROP_DT(t2h1d8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd8;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 333: 
        PROP_DT(t2h1d8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d8-h1d8;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 334:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r8);
         break;

  case 335:
	 PROP_DT(t2w1l8);
         break;

  case 336:
	 PROP_DT(t2h1u8);
         break;

  case 337:
	 PROP_DT(t2h1d8);
         break;
  
   case 338:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r8);
         ABSORB;
         break;

  case 339:
	 PROP_DT(t2w1l8);
         ABSORB;
         break;

  case 340:
	 PROP_DT(t2h1u8);
         ABSORB;
         break;

  case 341:
	 PROP_DT(t2h1d8);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 342: 
        PROP_DT(t2w1rwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt8/(z+z0wr8))-(z0wr8+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 343: 
        PROP_DT(t2w1rwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt8;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 344: 
        PROP_DT(t2w1rwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r8-w1r8);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 345: 
        PROP_DT(t2w1lwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt8/(z+z0wl8))-(z0wl8+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 346: 
        PROP_DT(t2w1lwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt8;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 347: 
        PROP_DT(t2w1lwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l8-w1l8);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 348: 
        PROP_DT(t2h1uwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt8/(z+z0hu8))-(z0hu8+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 349: 
        PROP_DT(t2h1uwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt8;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 350: 
        PROP_DT(t2h1uwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u8-h1u8);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 351: 
        PROP_DT(t2h1dwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt8/(z+z0hd8))-(z0hd8+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 352: 
        PROP_DT(t2h1dwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt8;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 353: 
        PROP_DT(t2h1dwt8);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d8-h1d8);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 354:
	 PROP_DT(t2w1rwt8);
         ABSORB;
         break;

  case 355:
	 PROP_DT(t2w1lwt8);
         ABSORB;
         break;

  case 356:
	 PROP_DT(t2h1uwt8);
         ABSORB;
         break;

  case 357:
	 PROP_DT(t2h1dwt8);
         ABSORB;
         break;

  case 358:
	 PROP_DT(t2w1rwt8);
         break;

  case 359:
	 PROP_DT(t2w1lwt8);
         break;

  case 360:
	 PROP_DT(t2h1uwt8);
         break;

  case 361:
	 PROP_DT(t2h1dwt8);
         break;

case 362: 
        PROP_DT(t2w1r9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr9/(z+z0wr9))-(z0wr9+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 363: 
        PROP_DT(t2w1r9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr9;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 364: 
        PROP_DT(t2w1r9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r9-w1r9;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 365: 
        PROP_DT(t2w1l9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl9/(z+z0wl9))-(z0wl9+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 366: 
        PROP_DT(t2w1l9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl9;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 367: 
        PROP_DT(t2w1l9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l9-w1l9;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 368: 
        PROP_DT(t2h1u9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu9/(z+z0hu9))-(z0hu9+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 369: 
        PROP_DT(t2h1u9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu9;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 370: 
        PROP_DT(t2h1u9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u9-h1u9;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 371: 
        PROP_DT(t2h1d9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd9/(z+z0hd9))-(z0hd9+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 372: 
        PROP_DT(t2h1d9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd9;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 373: 
        PROP_DT(t2h1d9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d9-h1d9;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 374:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r9);
         break;

  case 375:
	 PROP_DT(t2w1l9);
         break;

  case 376:
	 PROP_DT(t2h1u9);
         break;

  case 377:
	 PROP_DT(t2h1d9);
         break;
  
   case 378:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r9);
         ABSORB;
         break;

  case 379:
	 PROP_DT(t2w1l9);
         ABSORB;
         break;

  case 380:
	 PROP_DT(t2h1u9);
         ABSORB;
         break;

  case 381:
	 PROP_DT(t2h1d9);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 382: 
        PROP_DT(t2w1rwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt9/(z+z0wr9))-(z0wr9+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 383: 
        PROP_DT(t2w1rwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt9;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 384: 
        PROP_DT(t2w1rwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r9-w1r9);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 385: 
        PROP_DT(t2w1lwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt9/(z+z0wl9))-(z0wl9+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 386: 
        PROP_DT(t2w1lwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt9;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 387: 
        PROP_DT(t2w1lwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l9-w1l9);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 388: 
        PROP_DT(t2h1uwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt9/(z+z0hu9))-(z0hu9+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 389: 
        PROP_DT(t2h1uwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt9;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 390: 
        PROP_DT(t2h1uwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u9-h1u9);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 391: 
        PROP_DT(t2h1dwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt9/(z+z0hd9))-(z0hd9+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 392: 
        PROP_DT(t2h1dwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt9;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 393: 
        PROP_DT(t2h1dwt9);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d9-h1d9);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 394:
	 PROP_DT(t2w1rwt9);
         ABSORB;
         break;

  case 395:
	 PROP_DT(t2w1lwt9);
         ABSORB;
         break;

  case 396:
	 PROP_DT(t2h1uwt9);
         ABSORB;
         break;

  case 397:
	 PROP_DT(t2h1dwt9);
         ABSORB;
         break;

  case 398:
	 PROP_DT(t2w1rwt9);
         break;

  case 399:
	 PROP_DT(t2w1lwt9);
         break;

  case 400:
	 PROP_DT(t2h1uwt9);
         break;

  case 401:
	 PROP_DT(t2h1dwt9);
         break;

  case 402: 
        PROP_DT(t2w1r10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wr10/(z+z0wr10))-(z0wr10+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 403: 
        PROP_DT(t2w1r10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawr10;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 404: 
        PROP_DT(t2w1r10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=w2r10-w1r10;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 405: 
        PROP_DT(t2w1l10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-x*x/((a2wl10/(z+z0wl10))-(z0wl10+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        SCATTER;
        break;

 case 406: 
        PROP_DT(t2w1l10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-x;
        nz=-0.5/pawl10;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 407: 
        PROP_DT(t2w1l10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=w2l10-w1l10;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 408: 
        PROP_DT(t2h1u10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hu10/(z+z0hu10))-(z0hu10+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 409: 
        PROP_DT(t2h1u10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahu10;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 410: 
        PROP_DT(t2h1u10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=h2u10-h1u10;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 411: 
        PROP_DT(t2h1d10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-y*y/((a2hd10/(z+z0hd10))-(z0hd10+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 412: 
        PROP_DT(t2h1d10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-y;
        nz=-0.5/pahd10;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 413: 
        PROP_DT(t2h1d10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=h2d10-h1d10;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 414:										/* transperent walls - no interaction */
	 PROP_DT(t2w1r10);
         break;

  case 415:
	 PROP_DT(t2w1l10);
         break;

  case 416:
	 PROP_DT(t2h1u10);
         break;

  case 417:
	 PROP_DT(t2h1d10);
         break;
  
   case 418:										/* absorbing walls - neutrons are absorbed at interaction point*/
	 PROP_DT(t2w1r10);
         ABSORB;
         break;

  case 419:
	 PROP_DT(t2w1l10);
         ABSORB;
         break;

  case 420:
	 PROP_DT(t2h1u10);
         ABSORB;
         break;

  case 421:
	 PROP_DT(t2h1d10);
         ABSORB;
         break;

											/* OUTER WALLS - analog to inner walls, but sign of surface normal vector is changed */

  case 422: 
        PROP_DT(t2w1rwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wrwt10/(z+z0wr10))-(z0wr10+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 423: 
        PROP_DT(t2w1rwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawrwt10;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 424: 
        PROP_DT(t2w1rwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=-l;
        nz=-(w2r10-w1r10);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 425: 
        PROP_DT(t2w1lwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=x*x/((a2wlwt10/(z+z0wl10))-(z0wl10+z));
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 426: 
        PROP_DT(t2w1lwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=x;
        nz=0.5/pawlwt10;
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 427: 
        PROP_DT(t2w1lwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        nx=l;
        nz=-(w2l10-w1l10);
        n2=sqrt(nx*nx+nz*nz);
        pf=2.0*(vx*nx+vz*nz)/n2;
        vx-=pf*nx/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 428: 
        PROP_DT(t2h1uwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2huwt10/(z+z0hu10))-(z0hu10+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 429: 
        PROP_DT(t2h1uwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahuwt10;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 430: 
        PROP_DT(t2h1uwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=l;
        nz=-(h2u10-h1u10);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 431: 
        PROP_DT(t2h1dwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=y*y/((a2hdwt10/(z+z0hd10))-(z0hd10+z));
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

 case 432: 
        PROP_DT(t2h1dwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=y;
        nz=0.5/pahdwt10;
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 433: 
        PROP_DT(t2h1dwt10);
        vxin=vx;
        vyin=vy;
        vzin=vz;
        ny=-l;
        nz=-(h2d10-h1d10);
        n2=sqrt(ny*ny+nz*nz);
        pf=2.0*(vy*ny+vz*nz)/n2;
        vy-=pf*ny/n2;
        vz-=pf*nz/n2;
        q=V2Q*sqrt((vxin-vx)*(vxin-vx)+(vyin-vy)*(vyin-vy)+(vzin-vz)*(vzin-vz));
        break;

  case 434:
	 PROP_DT(t2w1rwt10);
         ABSORB;
         break;

  case 435:
	 PROP_DT(t2w1lwt10);
         ABSORB;
         break;

  case 436:
	 PROP_DT(t2h1uwt10);
         ABSORB;
         break;

  case 437:
	 PROP_DT(t2h1dwt10);
         ABSORB;
         break;

  case 438:
	 PROP_DT(t2w1rwt10);
         break;

  case 439:
	 PROP_DT(t2w1lwt10);
         break;

  case 440:
	 PROP_DT(t2h1uwt10);
         break;

  case 441:
	 PROP_DT(t2h1dwt10);
         break;

 }




 if (((i==2) ||(i==3) || (i == 4 ))){								/* calculating the the probability that the neutron is reflected at the RIGHT INNER wall*/
          if (RIreflect && strlen(RIreflect))
              {
               p=Table_Value(riTable, q, 1);
              }else{
                 if(mxr > 0 && q > Qcxr){
                 double arg = (q - mxr*Qcxr)/Wxr;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr*(q-Qcxr));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==22) ||(i==23) || (i==24 ))){								/* calculating the the probability that the neutron is reflected at the RIGHT OUTER wall*/
          if (ROreflect && strlen(ROreflect))
              {
               p=Table_Value(roTable, q, 1);
              }else{
                 if(mxrOW > 0 && q > QcxrOW){
                   double arg = (q - mxrOW*QcxrOW)/WxrOW;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW*(q-QcxrOW));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==5) ||(i==6) || (i == 7 ) ) ){							/* calculating the the probability that the neutron is reflected at the LEFT INNER wall*/
          if (LIreflect && strlen(LIreflect))
              {
               p=Table_Value(liTable, q, 1);
              }else{
                 if(mxl > 0 && q > Qcxl){
                   double arg = (q - mxl*Qcxl)/Wxl;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl*(q-Qcxl));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==25) || (i==26) || (i==27 )) && mxlOW >0 && q > QcxlOW ){				/* calculating the the probability that the neutron is reflected at the LEFT OUTER wall*/
         if (LOreflect && strlen(LOreflect))
              {
               p=Table_Value(loTable, q, 1);
              }else{
                 if(mxlOW > 0 && q > QcxlOW){
                   double arg = (q - mxlOW*QcxlOW)/WxlOW;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW*(q-QcxlOW));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==8) ||(i==9) || (i == 10 ))){								/* calculating the the probability that the neutron is reflected at the TOP INNER wall*/
	  if (UIreflect && strlen(UIreflect))
              {
               p=Table_Value(uiTable, q, 1);
              }else{
                 if(myu > 0 && q > Qcyu){
                 double arg = (q - myu*Qcyu)/Wyu;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu*(q-Qcyu));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==28) || (i==29) || (i==30 )) ){							/* calculating the the probability that the neutron is reflected at the TOP OUTER wall*/
	  if (UOreflect && strlen(UOreflect))
              {
               p=Table_Value(uoTable, q, 1);
              }else{
                 if(myuOW > 0 && q > QcyuOW){
                   double arg = (q - myuOW*QcyuOW)/WyuOW;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW*(q-QcyuOW));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==11) ||(i==12) || (i == 13 ))){							/* calculating the the probability that the neutron is reflected at the BOTTOM INNER wall*/
          if (DIreflect && strlen(DIreflect))
              {
               p=Table_Value(diTable, q, 1);
              }else{
                 if(myd > 0 && q > Qcyd){
                   double arg = (q - myd*Qcyd)/Wyd;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd*(q-Qcyd));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==31) || (i==32) || (i==33 )) ){							/* calculating the the probability that the neutron is reflected at the BOTTOM OUTER wall*/
          if (DOreflect && strlen(DOreflect))
              {
               p=Table_Value(doTable, q, 1);
              }else{
                 if(mydOW > 0 && q > QcydOW){
                   double arg = (q - mydOW*QcydOW)/WydOW;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW*(q-QcydOW));
                   }else
                   ABSORB;
                   }
                 }
           }


  if (((i==42) ||(i==43) || (i == 44 )) ){					/* calculating the the probability that the neutron is reflected at the RIGHT INNER wall*/
          if (RIreflect1 && strlen(RIreflect1))
              {
               p=Table_Value(riTable1, q, 1);
              }else{
                 if(mxr1 > 0 && q > Qcxr1){
                   double arg = (q - mxr1*Qcxr1)/Wxr1;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr1*(q-Qcxr1));
                   }else
                   ABSORB;
                   }
               }
          }

  if (((i==45) ||(i==46) || (i == 47 ) )){					/* calculating the the probability that the neutron is reflected at the LEFT INNER wall*/
          if (LIreflect1 && strlen(LIreflect1))
              {
               p=Table_Value(liTable1, q, 1);
              }else{
                 if(mxl1 > 0 && q > Qcxl1){
                   double arg = (q - mxl1*Qcxl1)/Wxl1;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl1*(q-Qcxl1));
                   }else
                   ABSORB;
                  }
              }
           }

  if (((i==48) ||(i==49) || (i == 50 )) ){					/* calculating the the probability that the neutron is reflected at the TOP INNER wall*/
	  if (UIreflect1 && strlen(UIreflect1))
              {
               p=Table_Value(uiTable1, q, 1);
              }else{
                 if(myu1 > 0 && q > Qcyu1){
                   double arg = (q - myu1*Qcyu1)/Wyu1;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu1*(q-Qcyu1));
                   }else
                   ABSORB;
                   }
               }
            }

  if (((i==51) ||(i==52) || (i == 53 )) ){					/* calculating the the probability that the neutron is reflected at the BOTTOM INNER wall*/
          if (DIreflect1 && strlen(DIreflect1))
              {
               p=Table_Value(diTable1, q, 1);
              }else{
                 if(myd1 > 0 && q > Qcyd1){
                   double arg = (q - myd1*Qcyd1)/Wyd1;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd1*(q-Qcyd1));
                   }else
                   ABSORB;
                   }
               }
           }

   if (((i==62) ||(i==63) || (i==64 ))){	
          if (ROreflect1 && strlen(ROreflect1))
              {
               p=Table_Value(roTable1, q, 1);
              }else{
                 if(mxrOW1 > 0 && q > QcxrOW1){
                   double arg = (q - mxrOW1*QcxrOW1)/WxrOW1;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW1*(q-QcxrOW1));
                   }
                   else
                   ABSORB;
                  }
               }
             }

   if (((i==65) || (i==66) || (i==67 )) && mxlOW1 >0 && q > QcxlOW1 ){
         if (LOreflect1 && strlen(LOreflect1))
              {
               p=Table_Value(loTable1, q, 1);
              }else{
                 if(mxlOW1 > 0 && q > QcxlOW1){
                   double arg = (q - mxlOW1*QcxlOW1)/WxlOW1;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW1*(q-QcxlOW1));
                   }
                   else
                   ABSORB;
                 }
               }
          }

   if (((i==68) || (i==69) || (i==70 )) ){
	  if (UOreflect1 && strlen(UOreflect1))
              {
               p=Table_Value(uoTable1, q, 1);
              }else{
                 if(myuOW1 > 0 && q > QcyuOW1){
                   double arg = (q - myuOW1*QcyuOW1)/WyuOW1;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW1*(q-QcyuOW1));
                   }else
                   ABSORB;
                   }
               }
           }

    if (((i==71) || (i==72) || (i==73 )) ){
          if (DOreflect1 && strlen(DOreflect1))
              {
               p=Table_Value(doTable1, q, 1);
              }else{
                 if(mydOW1 > 0 && q > QcydOW1){
                   double arg = (q - mydOW1*QcydOW1)/WydOW1;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW1*(q-QcydOW1));
                   }else
                   ABSORB;
                   }
                 }
           }


    if (((i==82) ||(i==83) || (i == 84 ))){
          if (RIreflect2 && strlen(RIreflect2))
              {
               p=Table_Value(riTable2, q, 1);
              }else{
                 if(mxr2 > 0 && q > Qcxr2){
                 double arg = (q - mxr2*Qcxr2)/Wxr2;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr2*(q-Qcxr2));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==102) ||(i==103) || (i==104 ))){	
          if (ROreflect2 && strlen(ROreflect2))
              {
               p=Table_Value(roTable2, q, 1);
              }else{
                 if(mxrOW2 > 0 && q > QcxrOW2){
                   double arg = (q - mxrOW2*QcxrOW2)/WxrOW2;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW2*(q-QcxrOW2));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==85) ||(i==86) || (i == 87 ) ) ){
          if (LIreflect2 && strlen(LIreflect2))
              {
               p=Table_Value(liTable2, q, 1);
              }else{
                 if(mxl2 > 0 && q > Qcxl2){
                   double arg = (q - mxl2*Qcxl2)/Wxl2;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl2*(q-Qcxl2));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==105) || (i==106) || (i==107 )) && mxlOW2 >0 && q > QcxlOW2 ){
         if (LOreflect2 && strlen(LOreflect2))
              {
               p=Table_Value(loTable2, q, 1);
              }else{
                 if(mxlOW2 > 0 && q > QcxlOW2){
                   double arg = (q - mxlOW2*QcxlOW2)/WxlOW2;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW2*(q-QcxlOW2));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==88) ||(i==89) || (i == 90 ))){
	  if (UIreflect2 && strlen(UIreflect2))
              {
               p=Table_Value(uiTable2, q, 1);
              }else{
                 if(myu2 > 0 && q > Qcyu2){
                 double arg = (q - myu2*Qcyu2)/Wyu2;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu2*(q-Qcyu2));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==108) || (i==109) || (i==110 )) ){
	  if (UOreflect2 && strlen(UOreflect2))
              {
               p=Table_Value(uoTable2, q, 1);
              }else{
                 if(myuOW2 > 0 && q > QcyuOW2){
                   double arg = (q - myuOW2*QcyuOW2)/WyuOW2;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW2*(q-QcyuOW2));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==91) ||(i==92) || (i == 93 ))){
          if (DIreflect2 && strlen(DIreflect2))
              {
               p=Table_Value(diTable2, q, 1);
              }else{
                 if(myd2 > 0 && q > Qcyd2){
                   double arg = (q - myd2*Qcyd2)/Wyd2;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd2*(q-Qcyd2));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==111) || (i==112) || (i==113 )) ){
          if (DOreflect2 && strlen(DOreflect2))
              {
               p=Table_Value(doTable2, q, 1);
              }else{
                 if(mydOW2 > 0 && q > QcydOW2){
                   double arg = (q - mydOW2*QcydOW2)/WydOW2;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW2*(q-QcydOW2));
                   }else
                   ABSORB;
                   }
                 }
           }



if (((i==122) ||(i==123) || (i == 124 ))){
          if (RIreflect3 && strlen(RIreflect3))
              {
               p=Table_Value(riTable3, q, 1);
              }else{
                 if(mxr3 > 0 && q > Qcxr3){
                 double arg = (q - mxr3*Qcxr3)/Wxr3;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr3*(q-Qcxr3));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==142) ||(i==143) || (i==144 ))){	
          if (ROreflect3 && strlen(ROreflect3))
              {
               p=Table_Value(roTable3, q, 1);
              }else{
                 if(mxrOW3 > 0 && q > QcxrOW3){
                   double arg = (q - mxrOW3*QcxrOW3)/WxrOW3;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW3*(q-QcxrOW3));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==125) ||(i==126) || (i == 127 ) ) ){
          if (LIreflect3 && strlen(LIreflect3))
              {
               p=Table_Value(liTable3, q, 1);
              }else{
                 if(mxl3 > 0 && q > Qcxl3){
                   double arg = (q - mxl3*Qcxl3)/Wxl3;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl3*(q-Qcxl3));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==145) || (i==146) || (i==147 )) && mxlOW3 >0 && q > QcxlOW3 ){
         if (LOreflect3 && strlen(LOreflect3))
              {
               p=Table_Value(loTable3, q, 1);
              }else{
                 if(mxlOW3 > 0 && q > QcxlOW3){
                   double arg = (q - mxlOW3*QcxlOW3)/WxlOW3;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW3*(q-QcxlOW3));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==128) ||(i==129) || (i == 130 ))){
	  if (UIreflect3 && strlen(UIreflect3))
              {
               p=Table_Value(uiTable3, q, 1);
              }else{
                 if(myu3 > 0 && q > Qcyu3){
                 double arg = (q - myu3*Qcyu3)/Wyu3;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu3*(q-Qcyu3));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==148) || (i==149) || (i==150 )) ){
	  if (UOreflect3 && strlen(UOreflect3))
              {
               p=Table_Value(uoTable3, q, 1);
              }else{
                 if(myuOW3 > 0 && q > QcyuOW3){
                   double arg = (q - myuOW3*QcyuOW3)/WyuOW3;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW3*(q-QcyuOW3));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==131) ||(i==132) || (i == 133 ))){
          if (DIreflect3 && strlen(DIreflect3))
              {
               p=Table_Value(diTable3, q, 1);
              }else{
                 if(myd3 > 0 && q > Qcyd3){
                   double arg = (q - myd3*Qcyd3)/Wyd3;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd3*(q-Qcyd3));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==151) || (i==152) || (i==153 )) ){
          if (DOreflect3 && strlen(DOreflect3))
              {
               p=Table_Value(doTable3, q, 1);
              }else{
                 if(mydOW3 > 0 && q > QcydOW3){
                   double arg = (q - mydOW3*QcydOW3)/WydOW3;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW3*(q-QcydOW3));
                   }else
                   ABSORB;
                   }
                 }
           }

   
if (((i==162) ||(i==163) || (i == 164 ))){
          if (RIreflect4 && strlen(RIreflect4))
              {
               p=Table_Value(riTable4, q, 1);
              }else{
                 if(mxr4 > 0 && q > Qcxr4){
                 double arg = (q - mxr4*Qcxr4)/Wxr4;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr4*(q-Qcxr4));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==182) ||(i==183) || (i==184 ))){	
          if (ROreflect4 && strlen(ROreflect4))
              {
               p=Table_Value(roTable4, q, 1);
              }else{
                 if(mxrOW4 > 0 && q > QcxrOW4){
                   double arg = (q - mxrOW4*QcxrOW4)/WxrOW4;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW4*(q-QcxrOW4));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==165) ||(i==166) || (i == 167 ) ) ){
          if (LIreflect4 && strlen(LIreflect4))
              {
               p=Table_Value(liTable4, q, 1);
              }else{
                 if(mxl4 > 0 && q > Qcxl4){
                   double arg = (q - mxl4*Qcxl4)/Wxl4;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl4*(q-Qcxl4));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==185) || (i==186) || (i==187 )) && mxlOW4 >0 && q > QcxlOW4 ){
         if (LOreflect4 && strlen(LOreflect4))
              {
               p=Table_Value(loTable4, q, 1);
              }else{
                 if(mxlOW4 > 0 && q > QcxlOW4){
                   double arg = (q - mxlOW4*QcxlOW4)/WxlOW4;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW4*(q-QcxlOW4));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==168) ||(i==169) || (i == 170 ))){
	  if (UIreflect4 && strlen(UIreflect4))
              {
               p=Table_Value(uiTable4, q, 1);
              }else{
                 if(myu4 > 0 && q > Qcyu4){
                 double arg = (q - myu4*Qcyu4)/Wyu4;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu4*(q-Qcyu4));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==188) || (i==189) || (i==190 )) ){
	  if (UOreflect4 && strlen(UOreflect4))
              {
               p=Table_Value(uoTable4, q, 1);
              }else{
                 if(myuOW4 > 0 && q > QcyuOW4){
                   double arg = (q - myuOW4*QcyuOW4)/WyuOW4;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW4*(q-QcyuOW4));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==171) ||(i==172) || (i == 173 ))){
          if (DIreflect4 && strlen(DIreflect4))
              {
               p=Table_Value(diTable4, q, 1);
              }else{
                 if(myd4 > 0 && q > Qcyd4){
                   double arg = (q - myd4*Qcyd4)/Wyd4;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd4*(q-Qcyd4));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==191) || (i==192) || (i==193 )) ){
          if (DOreflect4 && strlen(DOreflect4))
              {
               p=Table_Value(doTable4, q, 1);
              }else{
                 if(mydOW4 > 0 && q > QcydOW4){
                   double arg = (q - mydOW4*QcydOW4)/WydOW4;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW4*(q-QcydOW4));
                   }else
                   ABSORB;
                   }
                 }
           }



  if (((i==202) ||(i==203) || (i == 204 ))){
          if (RIreflect5 && strlen(RIreflect5))
              {
               p=Table_Value(riTable5, q, 1);
              }else{
                 if(mxr5 > 0 && q > Qcxr5){
                 double arg = (q - mxr5*Qcxr5)/Wxr5;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr5*(q-Qcxr5));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==222) ||(i==223) || (i==224 ))){	
          if (ROreflect5 && strlen(ROreflect5))
              {
               p=Table_Value(roTable5, q, 1);
              }else{
                 if(mxrOW5 > 0 && q > QcxrOW5){
                   double arg = (q - mxrOW5*QcxrOW5)/WxrOW5;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW5*(q-QcxrOW5));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==205) ||(i==206) || (i == 207 ) ) ){
          if (LIreflect5 && strlen(LIreflect5))
              {
               p=Table_Value(liTable5, q, 1);
              }else{
                 if(mxl5 > 0 && q > Qcxl5){
                   double arg = (q - mxl5*Qcxl5)/Wxl5;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl5*(q-Qcxl5));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==225) || (i==226) || (i==227 )) && mxlOW5 >0 && q > QcxlOW5 ){
         if (LOreflect5 && strlen(LOreflect5))
              {
               p=Table_Value(loTable5, q, 1);
              }else{
                 if(mxlOW5 > 0 && q > QcxlOW5){
                   double arg = (q - mxlOW5*QcxlOW5)/WxlOW5;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW5*(q-QcxlOW5));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==208) ||(i==209) || (i == 210 ))){
	  if (UIreflect5 && strlen(UIreflect5))
              {
               p=Table_Value(uiTable5, q, 1);
              }else{
                 if(myu5 > 0 && q > Qcyu5){
                 double arg = (q - myu5*Qcyu5)/Wyu5;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu5*(q-Qcyu5));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==228) || (i==229) || (i==230 )) ){
	  if (UOreflect5 && strlen(UOreflect5))
              {
               p=Table_Value(uoTable5, q, 1);
              }else{
                 if(myuOW5 > 0 && q > QcyuOW5){
                   double arg = (q - myuOW5*QcyuOW5)/WyuOW5;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW5*(q-QcyuOW5));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==211) ||(i==212) || (i == 213 ))){
          if (DIreflect5 && strlen(DIreflect5))
              {
               p=Table_Value(diTable5, q, 1);
              }else{
                 if(myd5 > 0 && q > Qcyd5){
                   double arg = (q - myd5*Qcyd5)/Wyd5;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd5*(q-Qcyd5));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==231) || (i==232) || (i==233 )) ){
          if (DOreflect5 && strlen(DOreflect5))
              {
               p=Table_Value(doTable5, q, 1);
              }else{
                 if(mydOW5 > 0 && q > QcydOW5){
                   double arg = (q - mydOW5*QcydOW5)/WydOW5;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW5*(q-QcydOW5));
                   }else
                   ABSORB;
                   }
                 }
           }

  if (((i==242) ||(i==243) || (i == 244 ))){
          if (RIreflect6 && strlen(RIreflect6))
              {
               p=Table_Value(riTable6, q, 1);
              }else{
                 if(mxr6 > 0 && q > Qcxr6){
                 double arg = (q - mxr6*Qcxr6)/Wxr6;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr6*(q-Qcxr6));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==262) ||(i==263) || (i==264 ))){	
          if (ROreflect6 && strlen(ROreflect6))
              {
               p=Table_Value(roTable6, q, 1);
              }else{
                 if(mxrOW6 > 0 && q > QcxrOW6){
                   double arg = (q - mxrOW6*QcxrOW6)/WxrOW6;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW6*(q-QcxrOW6));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==245) ||(i==246) || (i == 247 ) ) ){
          if (LIreflect6 && strlen(LIreflect6))
              {
               p=Table_Value(liTable6, q, 1);
              }else{
                 if(mxl6 > 0 && q > Qcxl6){
                   double arg = (q - mxl6*Qcxl6)/Wxl6;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl6*(q-Qcxl6));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==265) || (i==266) || (i==267 )) && mxlOW6 >0 && q > QcxlOW6 ){
         if (LOreflect6 && strlen(LOreflect6))
              {
               p=Table_Value(loTable6, q, 1);
              }else{
                 if(mxlOW6 > 0 && q > QcxlOW6){
                   double arg = (q - mxlOW6*QcxlOW6)/WxlOW6;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW6*(q-QcxlOW6));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==248) ||(i==249) || (i == 250 ))){
	  if (UIreflect6 && strlen(UIreflect6))
              {
               p=Table_Value(uiTable6, q, 1);
              }else{
                 if(myu6 > 0 && q > Qcyu6){
                 double arg = (q - myu6*Qcyu6)/Wyu6;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu6*(q-Qcyu6));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==268) || (i==269) || (i==270 )) ){
	  if (UOreflect6 && strlen(UOreflect6))
              {
               p=Table_Value(uoTable6, q, 1);
              }else{
                 if(myuOW6 > 0 && q > QcyuOW6){
                   double arg = (q - myuOW6*QcyuOW6)/WyuOW6;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW6*(q-QcyuOW6));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==251) ||(i==252) || (i == 253 ))){
          if (DIreflect6 && strlen(DIreflect6))
              {
               p=Table_Value(diTable6, q, 1);
              }else{
                 if(myd6 > 0 && q > Qcyd6){
                   double arg = (q - myd6*Qcyd6)/Wyd6;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd6*(q-Qcyd6));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==271) || (i==272) || (i==273 )) ){
          if (DOreflect6 && strlen(DOreflect6))
              {
               p=Table_Value(doTable6, q, 1);
              }else{
                 if(mydOW6 > 0 && q > QcydOW6){
                   double arg = (q - mydOW6*QcydOW6)/WydOW6;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW6*(q-QcydOW6));
                   }else
                   ABSORB;
                   }
                 }
           }

 if (((i==282) ||(i==283) || (i == 284 ))){
          if (RIreflect7 && strlen(RIreflect7))
              {
               p=Table_Value(riTable7, q, 1);
              }else{
                 if(mxr7 > 0 && q > Qcxr7){
                 double arg = (q - mxr7*Qcxr7)/Wxr7;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr7*(q-Qcxr7));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==302) ||(i==303) || (i==304 ))){	
          if (ROreflect7 && strlen(ROreflect7))
              {
               p=Table_Value(roTable7, q, 1);
              }else{
                 if(mxrOW7 > 0 && q > QcxrOW7){
                   double arg = (q - mxrOW7*QcxrOW7)/WxrOW7;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW7*(q-QcxrOW7));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==285) ||(i==286) || (i == 287 ) ) ){
          if (LIreflect7 && strlen(LIreflect7))
              {
               p=Table_Value(liTable7, q, 1);
              }else{
                 if(mxl7 > 0 && q > Qcxl7){
                   double arg = (q - mxl7*Qcxl7)/Wxl7;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl7*(q-Qcxl7));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==305) || (i==306) || (i==307 )) && mxlOW7 >0 && q > QcxlOW7 ){
         if (LOreflect7 && strlen(LOreflect7))
              {
               p=Table_Value(loTable7, q, 1);
              }else{
                 if(mxlOW7 > 0 && q > QcxlOW7){
                   double arg = (q - mxlOW7*QcxlOW7)/WxlOW7;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW7*(q-QcxlOW7));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==288) ||(i==289) || (i == 290 ))){
	  if (UIreflect7 && strlen(UIreflect7))
              {
               p=Table_Value(uiTable7, q, 1);
              }else{
                 if(myu7 > 0 && q > Qcyu7){
                 double arg = (q - myu7*Qcyu7)/Wyu7;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu7*(q-Qcyu7));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==308) || (i==309) || (i==310 )) ){
	  if (UOreflect7 && strlen(UOreflect7))
              {
               p=Table_Value(uoTable7, q, 1);
              }else{
                 if(myuOW7 > 0 && q > QcyuOW7){
                   double arg = (q - myuOW7*QcyuOW7)/WyuOW7;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW7*(q-QcyuOW7));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==291) ||(i==292) || (i == 293 ))){
          if (DIreflect7 && strlen(DIreflect7))
              {
               p=Table_Value(diTable7, q, 1);
              }else{
                 if(myd7 > 0 && q > Qcyd7){
                   double arg = (q - myd7*Qcyd7)/Wyd7;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd7*(q-Qcyd7));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==311) || (i==312) || (i==313 )) ){
          if (DOreflect7 && strlen(DOreflect7))
              {
               p=Table_Value(doTable7, q, 1);
              }else{
                 if(mydOW7 > 0 && q > QcydOW7){
                   double arg = (q - mydOW7*QcydOW7)/WydOW7;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW7*(q-QcydOW7));
                   }else
                   ABSORB;
                   }
                 }
           }

  
if (((i==322) ||(i==323) || (i == 324 ))){
          if (RIreflect8 && strlen(RIreflect8))
              {
               p=Table_Value(riTable8, q, 1);
              }else{
                 if(mxr8 > 0 && q > Qcxr8){
                 double arg = (q - mxr8*Qcxr8)/Wxr8;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr8*(q-Qcxr8));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==342) ||(i==343) || (i==344 ))){	
          if (ROreflect8 && strlen(ROreflect8))
              {
               p=Table_Value(roTable8, q, 1);
              }else{
                 if(mxrOW8 > 0 && q > QcxrOW8){
                   double arg = (q - mxrOW8*QcxrOW8)/WxrOW8;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW8*(q-QcxrOW8));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==325) ||(i==326) || (i == 327 ) ) ){
          if (LIreflect8 && strlen(LIreflect8))
              {
               p=Table_Value(liTable8, q, 1);
              }else{
                 if(mxl8 > 0 && q > Qcxl8){
                   double arg = (q - mxl8*Qcxl8)/Wxl8;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl8*(q-Qcxl8));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==345) || (i==346) || (i==347 )) && mxlOW8 >0 && q > QcxlOW8 ){
         if (LOreflect8 && strlen(LOreflect8))
              {
               p=Table_Value(loTable8, q, 1);
              }else{
                 if(mxlOW8 > 0 && q > QcxlOW8){
                   double arg = (q - mxlOW8*QcxlOW8)/WxlOW8;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW8*(q-QcxlOW8));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==328) ||(i==329) || (i == 330 ))){
	  if (UIreflect8 && strlen(UIreflect8))
              {
               p=Table_Value(uiTable8, q, 1);
              }else{
                 if(myu8 > 0 && q > Qcyu8){
                 double arg = (q - myu8*Qcyu8)/Wyu8;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu8*(q-Qcyu8));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==348) || (i==349) || (i==350 )) ){
	  if (UOreflect8 && strlen(UOreflect8))
              {
               p=Table_Value(uoTable8, q, 1);
              }else{
                 if(myuOW8 > 0 && q > QcyuOW8){
                   double arg = (q - myuOW8*QcyuOW8)/WyuOW8;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW8*(q-QcyuOW8));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==331) ||(i==332) || (i == 333 ))){
          if (DIreflect8 && strlen(DIreflect8))
              {
               p=Table_Value(diTable8, q, 1);
              }else{
                 if(myd8 > 0 && q > Qcyd8){
                   double arg = (q - myd8*Qcyd8)/Wyd8;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd8*(q-Qcyd8));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==351) || (i==352) || (i==353 )) ){
          if (DOreflect8 && strlen(DOreflect8))
              {
               p=Table_Value(doTable8, q, 1);
              }else{
                 if(mydOW8 > 0 && q > QcydOW8){
                   double arg = (q - mydOW8*QcydOW8)/WydOW8;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW8*(q-QcydOW8));
                   }else
                   ABSORB;
                   }
                 }
           }


if (((i==362) ||(i==363) || (i == 364 ))){
          if (RIreflect9 && strlen(RIreflect9))
              {
               p=Table_Value(riTable9, q, 1);
              }else{
                 if(mxr9 > 0 && q > Qcxr9){
                 double arg = (q - mxr9*Qcxr9)/Wxr9;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr9*(q-Qcxr9));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==382) ||(i==383) || (i==384 ))){	
          if (ROreflect9 && strlen(ROreflect9))
              {
               p=Table_Value(roTable9, q, 1);
              }else{
                 if(mxrOW9 > 0 && q > QcxrOW9){
                   double arg = (q - mxrOW9*QcxrOW9)/WxrOW9;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW9*(q-QcxrOW9));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==365) ||(i==366) || (i == 367 ) ) ){
          if (LIreflect9 && strlen(LIreflect9))
              {
               p=Table_Value(liTable9, q, 1);
              }else{
                 if(mxl9 > 0 && q > Qcxl9){
                   double arg = (q - mxl9*Qcxl9)/Wxl9;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl9*(q-Qcxl9));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==385) || (i==386) || (i==387 )) && mxlOW9 >0 && q > QcxlOW9 ){
         if (LOreflect9 && strlen(LOreflect9))
              {
               p=Table_Value(loTable9, q, 1);
              }else{
                 if(mxlOW9 > 0 && q > QcxlOW9){
                   double arg = (q - mxlOW9*QcxlOW9)/WxlOW9;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW9*(q-QcxlOW9));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==368) ||(i==369) || (i == 370 ))){
	  if (UIreflect9 && strlen(UIreflect9))
              {
               p=Table_Value(uiTable9, q, 1);
              }else{
                 if(myu9 > 0 && q > Qcyu9){
                 double arg = (q - myu9*Qcyu9)/Wyu9;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu9*(q-Qcyu9));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==388) || (i==389) || (i==390 )) ){
	  if (UOreflect9 && strlen(UOreflect9))
              {
               p=Table_Value(uoTable9, q, 1);
              }else{
                 if(myuOW9 > 0 && q > QcyuOW9){
                   double arg = (q - myuOW9*QcyuOW9)/WyuOW9;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW9*(q-QcyuOW9));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==371) ||(i==372) || (i == 373 ))){
          if (DIreflect9 && strlen(DIreflect9))
              {
               p=Table_Value(diTable9, q, 1);
              }else{
                 if(myd9 > 0 && q > Qcyd9){
                   double arg = (q - myd9*Qcyd9)/Wyd9;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd9*(q-Qcyd9));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==391) || (i==392) || (i==393 )) ){
          if (DOreflect9 && strlen(DOreflect9))
              {
               p=Table_Value(doTable9, q, 1);
              }else{
                 if(mydOW9 > 0 && q > QcydOW9){
                   double arg = (q - mydOW9*QcydOW9)/WydOW9;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW9*(q-QcydOW9));
                   }else
                   ABSORB;
                   }
                 }
           }

  if (((i==402) ||(i==403) || (i == 404 ))){
          if (RIreflect10 && strlen(RIreflect10))
              {
               p=Table_Value(riTable10, q, 1);
              }else{
                 if(mxr10 > 0 && q > Qcxr10){
                 double arg = (q - mxr10*Qcxr10)/Wxr10;
                 if(arg<10){
                   p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxr10*(q-Qcxr10));
                 }else
                 ABSORB;
                }
              }
           }

  if (((i==422) ||(i==423) || (i==424 ))){	
          if (ROreflect10 && strlen(ROreflect10))
              {
               p=Table_Value(roTable10, q, 1);
              }else{
                 if(mxrOW10 > 0 && q > QcxrOW10){
                   double arg = (q - mxrOW10*QcxrOW10)/WxrOW10;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxrOW10*(q-QcxrOW10));
                   }
                   else
                   ABSORB;
                  }
               }
             }

  if (((i==405) ||(i==406) || (i == 407 ) ) ){
          if (LIreflect10 && strlen(LIreflect10))
              {
               p=Table_Value(liTable10, q, 1);
              }else{
                 if(mxl10 > 0 && q > Qcxl10){
                   double arg = (q - mxl10*Qcxl10)/Wxl10;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxl10*(q-Qcxl10));
                   }else
                   ABSORB;
                }
               }
          }

  if (((i==425) || (i==426) || (i==427 )) && mxlOW10 >0 && q > QcxlOW10 ){
         if (LOreflect10 && strlen(LOreflect10))
              {
               p=Table_Value(loTable10, q, 1);
              }else{
                 if(mxlOW10 > 0 && q > QcxlOW10){
                   double arg = (q - mxlOW10*QcxlOW10)/WxlOW10;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaxlOW10*(q-QcxlOW10));
                   }
                   else
                   ABSORB;
                 }
               }
          }

  if (((i==408) ||(i==409) || (i == 410 ))){
	  if (UIreflect10 && strlen(UIreflect10))
              {
               p=Table_Value(uiTable10, q, 1);
              }else{
                 if(myu10 > 0 && q > Qcyu10){
                 double arg = (q - myu10*Qcyu10)/Wyu10;
                   if(arg<10){
                     p *= 0.5*(1.0-tanh(arg))*(1.0-alphayu10*(q-Qcyu10));
                   }else
                   ABSORB;
                 }
              }
            }

  if (((i==428) || (i==429) || (i==430 )) ){
	  if (UOreflect10 && strlen(UOreflect10))
              {
               p=Table_Value(uoTable10, q, 1);
              }else{
                 if(myuOW10 > 0 && q > QcyuOW10){
                   double arg = (q - myuOW10*QcyuOW10)/WyuOW10;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayuOW10*(q-QcyuOW10));
                   }else
                   ABSORB;
                   }
               }
           }

  if (((i==411) ||(i==412) || (i == 413 ))){
          if (DIreflect10 && strlen(DIreflect10))
              {
               p=Table_Value(diTable10, q, 1);
              }else{
                 if(myd10 > 0 && q > Qcyd10){
                   double arg = (q - myd10*Qcyd10)/Wyd10;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphayd10*(q-Qcyd10));
                   }else
                   ABSORB;
                   }
               }
            }

   if (((i==431) || (i==432) || (i==433 )) ){
          if (DOreflect10 && strlen(DOreflect10))
              {
               p=Table_Value(doTable10, q, 1);
              }else{
                 if(mydOW10 > 0 && q > QcydOW10){
                   double arg = (q - mydOW10*QcydOW10)/WydOW10;
                   if(arg<10){
                      p *= 0.5*(1.0-tanh(arg))*(1.0-alphaydOW10*(q-QcydOW10));
                   }else
                   ABSORB;
                   }
                 }
           }


  p *= R0;
  SCATTER;

} while (z<l);												/* repeat the interaction loop untill the neutron pass the end of guide */


  if(x <= -w2r && x >= -w2rwt && y <= mru2*x+nru2 && y >= mrd2*x+nrd2 && mxr!=-1 && mxrOW!=-1)		/* absorbing the neutron if it hit the RIGHT exit wall and the wall is not transparent*/
      ABSORB;
  if(x >=  w2l && x <=  w2lwt && y <= mlu2*x+nlu2 && y >= mld2*x+nld2 && mxl!=-1 && mxlOW!=-1) 		/* absorbing the neutron if it hit the LEFT exit wall and the wall is not transparent*/
      ABSORB;
  if(y <= -h2d && y >= -h2dwt && x <= (y-nld2)/mld2 && x>= (y-nrd2)/mrd2 && myd!=-1 && mydOW!=-1) 	/* absorbing the neutron if it hit the BOTTOM exit wall and the wall is not transparent*/
      ABSORB; 
  if(y >=  h2u && y <=  h2uwt && x <= (y-nlu2)/mlu2 && x>= (y-nru2)/mru2 && myu!=-1 && myuOW!=-1)	/* absorbing the neutron if it hit the TOP exit wall and the wall is not transparent*/
      ABSORB;

  if(x <= -w2r1 && x >= -w2rwt1 && y <= mru21*x+nru21 && y >= mrd21*x+nrd21 && mxr1!=-1 && mxrOW1!=-1)
      ABSORB;
  if(x >=  w2l1 && x <=  w2lwt1 && y <= mlu21*x+nlu21 && y >= mld21*x+nld21 && mxl1!=-1 && mxlOW1!=-1) 
      ABSORB;
  if(y <= -h2d1 && y >= -h2dwt1 && x <= (y-nld21)/mld21 && x>= (y-nrd21)/mrd21 && myd1!=-1 && mydOW1!=-1) 
      ABSORB; 
  if(y >=  h2u1 && y <=  h2uwt1 && x <= (y-nlu21)/mlu21 && x>= (y-nru21)/mru21 && myu1!=-1 && myuOW1!=-1)
      ABSORB;

   if(x <= -w2r2 && x >= -w2rwt2 && y <= mru22*x+nru22 && y >= mrd22*x+nrd22 && mxr2!=-1 && mxrOW2!=-1)
      ABSORB;
  if(x >=  w2l2 && x <=  w2lwt2 && y <= mlu22*x+nlu22 && y >= mld22*x+nld22 && mxl2!=-1 && mxlOW2!=-1) 
      ABSORB;
  if(y <= -h2d2 && y >= -h2dwt2 && x <= (y-nld22)/mld22 && x>= (y-nrd22)/mrd22 && myd2!=-1 && mydOW2!=-1) 
      ABSORB; 
  if(y >=  h2u2 && y <=  h2uwt2 && x <= (y-nlu22)/mlu22 && x>= (y-nru22)/mru22 && myu2!=-1 && myuOW2!=-1)
      ABSORB;

  if(x <= -w2r3 && x >= -w2rwt3 && y <= mru23*x+nru23 && y >= mrd23*x+nrd23 && mxr3!=-1 && mxrOW3!=-1)
      ABSORB;
  if(x >=  w2l3 && x <=  w2lwt3 && y <= mlu23*x+nlu23 && y >= mld23*x+nld23 && mxl3!=-1 && mxlOW3!=-1) 
      ABSORB;
  if(y <= -h2d3 && y >= -h2dwt3 && x <= (y-nld23)/mld23 && x>= (y-nrd23)/mrd23 && myd3!=-1 && mydOW3!=-1) 
      ABSORB; 
  if(y >=  h2u3 && y <=  h2uwt3 && x <= (y-nlu23)/mlu23 && x>= (y-nru23)/mru23 && myu3!=-1 && myuOW3!=-1)
      ABSORB;

  if(x <= -w2r4 && x >= -w2rwt4 && y <= mru24*x+nru24 && y >= mrd24*x+nrd24 && mxr4!=-1 && mxrOW4!=-1)
      ABSORB;
  if(x >=  w2l4 && x <=  w2lwt4 && y <= mlu24*x+nlu24 && y >= mld24*x+nld24 && mxl4!=-1 && mxlOW4!=-1) 
      ABSORB;
  if(y <= -h2d4 && y >= -h2dwt4 && x <= (y-nld24)/mld24 && x>= (y-nrd24)/mrd24 && myd4!=-1 && mydOW4!=-1) 
      ABSORB; 
  if(y >=  h2u4 && y <=  h2uwt4 && x <= (y-nlu24)/mlu24 && x>= (y-nru24)/mru24 && myu4!=-1 && myuOW4!=-1)
      ABSORB;

  if(x <= -w2r5 && x >= -w2rwt5 && y <= mru25*x+nru25 && y >= mrd25*x+nrd25 && mxr5!=-1 && mxrOW5!=-1)
      ABSORB;
  if(x >=  w2l5 && x <=  w2lwt5 && y <= mlu25*x+nlu25 && y >= mld25*x+nld25 && mxl5!=-1 && mxlOW5!=-1) 
      ABSORB;
  if(y <= -h2d5 && y >= -h2dwt5 && x <= (y-nld25)/mld25 && x>= (y-nrd25)/mrd25 && myd5!=-1 && mydOW5!=-1) 
      ABSORB; 
  if(y >=  h2u5 && y <=  h2uwt5 && x <= (y-nlu25)/mlu25 && x>= (y-nru25)/mru25 && myu5!=-1 && myuOW5!=-1)
      ABSORB;


  if(x <= -w2r6 && x >= -w2rwt6 && y <= mru26*x+nru26 && y >= mrd26*x+nrd26 && mxr6!=-1 && mxrOW6!=-1)
      ABSORB;
  if(x >=  w2l6 && x <=  w2lwt6 && y <= mlu26*x+nlu26 && y >= mld26*x+nld26 && mxl6!=-1 && mxlOW6!=-1) 
      ABSORB;
  if(y <= -h2d6 && y >= -h2dwt6 && x <= (y-nld26)/mld26 && x>= (y-nrd26)/mrd26 && myd6!=-1 && mydOW6!=-1) 
      ABSORB; 
  if(y >=  h2u6 && y <=  h2uwt6 && x <= (y-nlu26)/mlu26 && x>= (y-nru26)/mru26 && myu6!=-1 && myuOW6!=-1)
      ABSORB;

  if(x <= -w2r7 && x >= -w2rwt7 && y <= mru27*x+nru27 && y >= mrd27*x+nrd27 && mxr7!=-1 && mxrOW7!=-1)
      ABSORB;
  if(x >=  w2l7 && x <=  w2lwt7 && y <= mlu27*x+nlu27 && y >= mld27*x+nld27 && mxl7!=-1 && mxlOW7!=-1) 
      ABSORB;
  if(y <= -h2d7 && y >= -h2dwt7 && x <= (y-nld27)/mld27 && x>= (y-nrd27)/mrd27 && myd7!=-1 && mydOW7!=-1) 
      ABSORB; 
  if(y >=  h2u7 && y <=  h2uwt7 && x <= (y-nlu27)/mlu27 && x>= (y-nru27)/mru27 && myu7!=-1 && myuOW7!=-1)
      ABSORB;

  if(x <= -w2r8 && x >= -w2rwt8 && y <= mru28*x+nru28 && y >= mrd28*x+nrd28 && mxr8!=-1 && mxrOW8!=-1)
      ABSORB;
  if(x >=  w2l8 && x <=  w2lwt8 && y <= mlu28*x+nlu28 && y >= mld28*x+nld28 && mxl8!=-1 && mxlOW8!=-1) 
      ABSORB;
  if(y <= -h2d8 && y >= -h2dwt8 && x <= (y-nld28)/mld28 && x>= (y-nrd28)/mrd28 && myd8!=-1 && mydOW8!=-1) 
      ABSORB; 
  if(y >=  h2u8 && y <=  h2uwt8 && x <= (y-nlu28)/mlu28 && x>= (y-nru28)/mru28 && myu8!=-1 && myuOW8!=-1)
      ABSORB;

  if(x <= -w2r9 && x >= -w2rwt9 && y <= mru29*x+nru29 && y >= mrd29*x+nrd29 && mxr9!=-1 && mxrOW9!=-1)
      ABSORB;
  if(x >=  w2l9 && x <=  w2lwt9 && y <= mlu29*x+nlu29 && y >= mld29*x+nld29 && mxl9!=-1 && mxlOW9!=-1) 
      ABSORB;
  if(y <= -h2d9 && y >= -h2dwt9 && x <= (y-nld29)/mld29 && x>= (y-nrd29)/mrd29 && myd9!=-1 && mydOW9!=-1) 
      ABSORB; 
  if(y >=  h2u9 && y <=  h2uwt9 && x <= (y-nlu29)/mlu29 && x>= (y-nru29)/mru29 && myu9!=-1 && myuOW9!=-1)
      ABSORB;

  if(x <= -w2r10 && x >= -w2rwt10 && y <= mru210*x+nru210 && y >= mrd210*x+nrd210 && mxr10!=-1 && mxrOW10!=-1)
      ABSORB;
  if(x >=  w2l10 && x <=  w2lwt10 && y <= mlu210*x+nlu210 && y >= mld210*x+nld210 && mxl10!=-1 && mxlOW10!=-1) 
      ABSORB;
  if(y <= -h2d10 && y >= -h2dwt10 && x <= (y-nld210)/mld210 && x>= (y-nrd210)/mrd210 && myd10!=-1 && mydOW10!=-1) 
      ABSORB; 
  if(y >=  h2u10 && y <=  h2uwt10 && x <= (y-nlu210)/mlu210 && x>= (y-nru210)/mru210 && myu10!=-1 && myuOW10!=-1)
      ABSORB;

%}



FINALLY
%{

%}

MCDISPLAY
%{
  int i,imax;
  double x1,y1,z,x2,y2,z1,z0wr,z0wl,z0hu,z0hd,xwt,ywt,x1wt,y1wt;
  double mr,ml,mu,md,nr1,nl1,nu1,nd1,nr2,nl2,nu2,nd2;
  double lbwl,lbwr,lbhu,lbhd;								/* length between focal points , needed for elliptic case */

  double x11,y11,x21,y21,z11,z0wr1,z0wl1,z0hu1,z0hd1,xwt1,ywt1,x1wt1,y1wt1;
  double mr1,ml1,mu1,md1,nr11,nl11,nu11,nd11,nr21,nl21,nu21,nd21;
  double lbwl1,lbwr1,lbhu1,lbhd1;

  double x12,y12,x22,y22,z12,z0wr2,z0wl2,z0hu2,z0hd2,xwt2,ywt2,x1wt2,y1wt2;
  double mr2,ml2,mu2,md2,nr12,nl12,nu12,nd12,nr22,nl22,nu22,nd22;
  double lbwl2,lbwr2,lbhu2,lbhd2;

  double x13,y13,x23,y23,z13,z0wr3,z0wl3,z0hu3,z0hd3,xwt3,ywt3,x1wt3,y1wt3;
  double mr3,ml3,mu3,md3,nr13,nl13,nu13,nd13,nr23,nl23,nu23,nd23;
  double lbwl3,lbwr3,lbhu3,lbhd3;

  double x14,y14,x24,y24,z14,z0wr4,z0wl4,z0hu4,z0hd4,xwt4,ywt4,x1wt4,y1wt4;
  double mr4,ml4,mu4,md4,nr14,nl14,nu14,nd14,nr24,nl24,nu24,nd24;
  double lbwl4,lbwr4,lbhu4,lbhd4;

  double x15,y15,x25,y25,z15,z0wr5,z0wl5,z0hu5,z0hd5,xwt5,ywt5,x1wt5,y1wt5;
  double mr5,ml5,mu5,md5,nr15,nl15,nu15,nd15,nr25,nl25,nu25,nd25;
  double lbwl5,lbwr5,lbhu5,lbhd5;

  double x16,y16,x26,y26,z16,z0wr6,z0wl6,z0hu6,z0hd6,xwt6,ywt6,x1wt6,y1wt6;
  double mr6,ml6,mu6,md6,nr16,nl16,nu16,nd16,nr26,nl26,nu26,nd26;
  double lbwl6,lbwr6,lbhu6,lbhd6;

  double x17,y17,x27,y27,z17,z0wr7,z0wl7,z0hu7,z0hd7,xwt7,ywt7,x1wt7,y1wt7;
  double mr7,ml7,mu7,md7,nr17,nl17,nu17,nd17,nr27,nl27,nu27,nd27;
  double lbwl7,lbwr7,lbhu7,lbhd7;

  double x18,y18,x28,y28,z18,z0wr8,z0wl8,z0hu8,z0hd8,xwt8,ywt8,x1wt8,y1wt8;
  double mr8,ml8,mu8,md8,nr18,nl18,nu18,nd18,nr28,nl28,nu28,nd28;
  double lbwl8,lbwr8,lbhu8,lbhd8;

  double x19,y19,x29,y29,z19,z0wr9,z0wl9,z0hu9,z0hd9,xwt9,ywt9,x1wt9,y1wt9;
  double mr9,ml9,mu9,md9,nr19,nl19,nu19,nd19,nr29,nl29,nu29,nd29;
  double lbwl9,lbwr9,lbhu9,lbhd9;

  double x110,y110,x210,y210,z110,z0wr10,z0wl10,z0hu10,z0hd10,xwt10,ywt10,x1wt10,y1wt10;
  double mr10,ml10,mu10,md10,nr110,nl110,nu110,nd110,nr210,nl210,nu210,nd210;
  double lbwl10,lbwr10,lbhu10,lbhd10;

  magnify("xy");


  imax=100;										/* maximum points for every line in z direction*/

  lbwr=linwr+l+loutwr;
  lbwl=linwl+l+loutwl;
  lbhu=linhu+l+louthu;
  lbhd=linhd+l+louthd;

  lbwr1=linwr1+l+loutwr1;
  lbwl1=linwl1+l+loutwl1;
  lbhu1=linhu1+l+louthu1;
  lbhd1=linhd1+l+louthd1;

  lbwr2=linwr2+l+loutwr2;
  lbwl2=linwl2+l+loutwl2;
  lbhu2=linhu2+l+louthu2;
  lbhd2=linhd2+l+louthd2;

  lbwr3=linwr3+l+loutwr3;
  lbwl3=linwl3+l+loutwl3;
  lbhu3=linhu3+l+louthu3;
  lbhd3=linhd3+l+louthd3;

  lbwr4=linwr4+l+loutwr4;
  lbwl4=linwl4+l+loutwl4;
  lbhu4=linhu4+l+louthu4;
  lbhd4=linhd4+l+louthd4;

  lbwr5=linwr5+l+loutwr5;
  lbwl5=linwl5+l+loutwl5;
  lbhu5=linhu5+l+louthu5;
  lbhd5=linhd5+l+louthd5;

  lbwr6=linwr6+l+loutwr6;
  lbwl6=linwl6+l+loutwl6;
  lbhu6=linhu6+l+louthu6;
  lbhd6=linhd6+l+louthd6;

  lbwr7=linwr7+l+loutwr7;
  lbwl7=linwl7+l+loutwl7;
  lbhu7=linhu7+l+louthu7;
  lbhd7=linhd7+l+louthd7;

  lbwr8=linwr8+l+loutwr8;
  lbwl8=linwl8+l+loutwl8;
  lbhu8=linhu8+l+louthu8;
  lbhd8=linhd8+l+louthd8;

  lbwr9=linwr9+l+loutwr9;
  lbwl9=linwl9+l+loutwl9;
  lbhu9=linhu9+l+louthu9;
  lbhd9=linhd9+l+louthd9;

  lbwr10=linwr10+l+loutwr10;
  lbwl10=linwl10+l+loutwl10;
  lbhu10=linhu10+l+louthu10;
  lbhd10=linhd10+l+louthd10;

  if (linwr==0 && loutwr==0){
   mr=(-w2r+w1r)/l;
   nr1=-w1r;
   nr2=-(w1rwt);
   }


if (linwl==0 && loutwl==0){
   ml=(w2l-w1l)/l;
   nl1=w1l;
   nl2=(w1lwt);
   }


if (linhu == 0 && louthu==0) 
  {
   mu=(h2u-h1u)/l;
   nu1=h1u;
   nu2=(h1uwt);
  }


if (linhd == 0 && louthd==0) 
  {
   md=(-h2d+h1d)/l;
   nd1=-h1d;
   nd2=-(h1dwt);
  }

  z0wr=(linwr-l-loutwr)/2.0;
  z0wl=(linwl-l-loutwl)/2.0;
  z0hu=lbhu/2.0-l-louthu;
  z0hd=lbhd/2.0-l-louthd;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd!=-1) line(w1l, -h1d, 0.0, -w1r, -h1d, 0.0);							/* entrance window given by the INNER walls*/
  if(myu!=-1)line(w1l, h1u, 0.0, -w1r, h1u, 0.0);
  if(mxl!=-1)line(w1l, -h1d, 0.0, w1l, h1u, 0.0);
  if(mxr!=-1)line( -w1r, h1u, 0.0, -w1r, -h1d, 0.0);

  if(myd!=-1)line(w2l, -h2d, l, -w2r, -h2d, l);								/* exit window given by the INNER walls*/
  if(myu!=-1)line(w2l, h2u,  l, -w2r, h2u, l);
  if(mxl!=-1)line(w2l, -h2d, l, w2l, h2u, l);
  if(mxr!=-1)line( -w2r, -h2d,  l, -w2r, h2u, l);

  if(mydOW!=-1) line((w1lwt), -(h1dwt), 0.0, -(w1rwt), -(h1dwt), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW!=-1)line((w1lwt), (h1uwt), 0.0, -(w1rwt), (h1uwt), 0.0);
  if(mxlOW!=-1)line((w1lwt), -(h1dwt), 0.0, (w1lwt), (h1uwt), 0.0);
  if(mxrOW!=-1)line( -(w1rwt), (h1uwt), 0.0, -(w1rwt), -(h1dwt), 0.0);

  if(mydOW!=-1)line((w2lwt), -(h2dwt), l, -(w2rwt), -(h2dwt), l);					/* exit windows given by the OUTER walls*/
  if(myuOW!=-1)line((w2lwt), (h2uwt),  l, -(w2rwt), (h2uwt), l);
  if(mxlOW!=-1)line((w2lwt), -(h2dwt), l, (w2lwt), (h2uwt), l);
  if(mxrOW!=-1)line( -(w2rwt), -(h2dwt),  l, -(w2rwt), (h2uwt), l);

  if((myd!=-1 && mydOW!=-1) || (mxl!=-1 && mxlOW!=-1)) line(w1l, -h1d, 0.0, (w1lwt), -(h1dwt), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu!=-1 && myuOW!=-1) || (mxl!=-1 && mxlOW!=-1)) line(w1l, h1u, 0.0, (w1lwt), (h1uwt), 0.0);
  if((myd!=-1 && mydOW!=-1) || (mxr!=-1 && mxrOW!=-1)) line(-w1r, -h1d, 0.0,-(w1rwt),  -(h1dwt), 0.0);
  if((myu!=-1 && myuOW!=-1) || (mxr!=-1 && mxrOW!=-1)) line( -w1r, h1u, 0.0, -(w1rwt), (h1uwt), 0.0);

  if((myd!=-1 && mydOW!=-1) || (mxl!=-1 && mxlOW!=-1)) line(w2l, -h2d, l, (w2lwt), -(h2dwt), l);	/* corner connection lines for the exit windows*/
  if((myu!=-1 && myuOW!=-1) || (mxl!=-1 && mxlOW!=-1)) line(w2l, h2u, l, (w2lwt), (h2uwt), l);
  if((myd!=-1 && mydOW!=-1) || (mxr!=-1 && mxrOW!=-1)) line(-w2r, -h2d, l,-(w2rwt),  -(h2dwt), l);
  if((myu!=-1 && myuOW!=-1) || (mxr!=-1 && mxrOW!=-1)) line( -w2r, h2u, l, -(w2rwt), (h2uwt), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z1=(i+1)*l/imax;
  if(linwl==0 && loutwl == 0)
   {
     x1=ml*z+nl1;
     x2=ml*z1+nl1;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      x1=bwl*sqrt(1-((z0wl+z)*(z0wl+z))/(awl*awl));
      x2=bwl*sqrt(1-((z0wl+z1)*(z0wl+z1))/(awl*awl));
      }else{
      x1=sqrt((z-pbwl)/-pawl);
      x2=sqrt((z1-pbwl)/-pawl);
      }
   }
  if(linhd==0 && louthd==0)
   {
     y1=md*z+nd1;
     y2=md*z1+nd1;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      y1=-bhd*sqrt(1-((z0hd+z)*(z0hd+z))/(ahd*ahd));
      y2=-bhd*sqrt(1-((z0hd+z1)*(z0hd+z1))/(ahd*ahd));
      }else{
      y1=-sqrt((z-pbhd)/-pahd);
      y2=-sqrt((z1-pbhd)/-pahd);
      }
   }
  if(mxl!=-1 || myd!=-1)line((double)x1, (double)y1, (double)z, (double)x2, (double)y2, (double)z1); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z1=(i+1)*l/imax;
  if(linwr==0 && loutwr==0)
  {
    x1=mr*z+nr1;
    x2=mr*z1+nr1;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    x1=-bwr*sqrt(1-((z0wr+z)*(z0wr+z))/(awr*awr));
    x2=-bwr*sqrt(1-((z0wr+z1)*(z0wr+z1))/(awr*awr));
    }else{
    x1=-sqrt((z-pbwr)/-pawr);
    x2=-sqrt((z1-pbwr)/-pawr);
    }
  }
  if(linhd==0 && louthd==0)
  {
    y1=md*z+nd1;
    y2=md*z1+nd1;
  }else{
    if(linhd!=0 && louthd!=0)
    {
    y1=-bhd*sqrt(1-((z0hd+z)*(z0hd+z))/(ahd*ahd));
    y2=-bhd*sqrt(1-((z0hd+z1)*(z0hd+z1))/(ahd*ahd));
    }else{
    y1=-sqrt((z-pbhd)/-pahd);
    y2=-sqrt((z1-pbhd)/-pahd);
    }
  }
  if(mxr!=-1 || myd!=-1) line((double)x1, (double)y1, (double)z, (double)x2, (double)y2, (double)z1); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z1=(i+1)*l/imax;
  if(linwr==0 && loutwr==0)
  {
    x1=mr*z+nr1;
    x2=mr*z1+nr1;
   }else{
     if(linwr!=0 && loutwr!=0){
     x1=-bwr*sqrt(1-((z0wr+z)*(z0wr+z))/(awr*awr));
     x2=-bwr*sqrt(1-((z0wr+z1)*(z0wr+z1))/(awr*awr));
     }else{
     x1=-sqrt((z-pbwr)/-pawr);
     x2=-sqrt((z1-pbwr)/-pawr);
     }
   }
   if(linhu==0 && louthu==0)
  {
    y1=mu*z+nu1;
    y2=mu*z1+nu1;
  }else{
    if(linhu!=0 && louthu!=0)
    {
    y1=bhu*sqrt(1-((z0hu+z)*(z0hu+z))/(ahu*ahu));
    y2=bhu*sqrt(1-((z0hu+z1)*(z0hu+z1))/(ahu*ahu));
    }else{
    y1=sqrt((z-pbhu)/-pahu);
    y2=sqrt((z1-pbhu)/-pahu);
    }
  }
  if(mxr!=-1 || myu!=-1)line((double)x1, (double)y1, (double)z, (double)x2, (double)y2, (double)z1); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z1=(i+1)*l/imax;
  if(linwl==0 && loutwl==0)
  {
    x1=ml*z+nl1;
    x2=ml*z1+nl1;
   }else{
     if(linwl!=0 && loutwl!=0)
     {
     x1=bwl*sqrt(1-((z0wl+z)*(z0wl+z))/(awl*awl));
     x2=bwl*sqrt(1-((z0wl+z1)*(z0wl+z1))/(awl*awl));
     }else{
     x1=sqrt((z-pbwl)/-pawl);
     x2=sqrt((z1-pbwl)/-pawl);
     }
   }
   if(linhu==0 && louthu==0)
  {
    y1=mu*z+nu1;
    y2=mu*z1+nu1;
  }else{
    if(linhu!=0 && louthu!=0)
    {
    y1=bhu*sqrt(1-((z0hu+z)*(z0hu+z))/(ahu*ahu));
    y2=bhu*sqrt(1-((z0hu+z1)*(z0hu+z1))/(ahu*ahu));
    }else{
    y1=sqrt((z-pbhu)/-pahu);
    y2=sqrt((z1-pbhu)/-pahu);
    }
  }
  if(mxl!=-1 || myu!=-1)line((double)x1, (double)y1, (double)z, (double)x2, (double)y2, (double)z1); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z1=(i+1)*l/imax;
  if(linwl==0 && loutwl == 0)
   {
     xwt=ml*z+nl2;
     x1wt=ml*z1+nl2;
   }else{
      if(linwl!=0 && loutwl != 0)
      {
      xwt=bwlwt*sqrt(1-((z0wl+z)*(z0wl+z))/(awlwt*awlwt));
      x1wt=bwlwt*sqrt(1-((z0wl+z1)*(z0wl+z1))/(awlwt*awlwt));
      }else{
      xwt=sqrt((z-pbwlwt)/-pawlwt);
      x1wt=sqrt((z1-pbwlwt)/-pawlwt);
      }
   }
  if(linhd==0 && louthd==0)
   {
     ywt=md*z+nd2;
     y1wt=md*z1+nd2;
    }else{
      if(linhd!=0 && louthd!=0)
      {
      ywt=-bhdwt*sqrt(1-((z0hd+z)*(z0hd+z))/(ahdwt*ahdwt));
      y1wt=-bhdwt*sqrt(1-((z0hd+z1)*(z0hd+z1))/(ahdwt*ahdwt));
      }else{
      ywt=-sqrt((z-pbhdwt)/-pahdwt);
      y1wt=-sqrt((z1-pbhdwt)/-pahdwt);
      }
   }
  if(mxlOW!=-1 || mydOW!=-1)line((double)xwt, (double)ywt, (double)z, (double)x1wt, (double)y1wt, (double)z1); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z1=(i+1)*l/imax;
  if(linwr==0 && loutwr==0)
  {
    xwt=mr*z+nr2;
    x1wt=mr*z1+nr2;
  }else{
    if(linwr!=0 && loutwr!=0)
    {
    xwt=-bwrwt*sqrt(1-((z0wr+z)*(z0wr+z))/(awrwt*awrwt));
    x1wt=-bwrwt*sqrt(1-((z0wr+z1)*(z0wr+z1))/(awrwt*awrwt));
    }else{
    xwt=-sqrt((z-pbwrwt)/-pawrwt);
    x1wt=-sqrt((z1-pbwrwt)/-pawrwt);
    }
  }
  if(linhd==0 && louthd==0)
  {
    ywt=md*z+nd2;
    y1wt=md*z1+nd2;
  }else{
    if(linhd!=0 && louthd!=0)
    {
    ywt=-bhdwt*sqrt(1-((z0hd+z)*(z0hd+z))/(ahdwt*ahdwt));
    y1wt=-bhdwt*sqrt(1-((z0hd+z1)*(z0hd+z1))/(ahdwt*ahdwt));
    }else{
    ywt=-sqrt((z-pbhdwt)/-pahdwt);
    y1wt=-sqrt((z1-pbhdwt)/-pahdwt);
    }
  }
  if(mxrOW!=-1 || mydOW!=-1) line((double)xwt, (double)ywt, (double)z, (double)x1wt, (double)y1wt, (double)z1); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z1=(i+1)*l/imax;
  if(linwr==0 && loutwr==0)
  {
    xwt=mr*z+nr2;
    x1wt=mr*z1+nr2;
   }else{
     if(linwr!=0 && loutwr!=0){
     xwt=-bwrwt*sqrt(1-((z0wr+z)*(z0wr+z))/(awrwt*awrwt));
     x1wt=-bwrwt*sqrt(1-((z0wr+z1)*(z0wr+z1))/(awrwt*awrwt));
     }else{
     xwt=-sqrt((z-pbwrwt)/-pawrwt);
     x1wt=-sqrt((z1-pbwrwt)/-pawrwt);
     }
   }
   if(linhu==0 && louthu==0)
  {
    ywt=mu*z+nu2;
    y1wt=mu*z1+nu2;
  }else{
    if(linhu!=0 && louthu!=0)
    {
    ywt=bhuwt*sqrt(1-((z0hu+z)*(z0hu+z))/(ahuwt*ahuwt));
    y1wt=bhuwt*sqrt(1-((z0hu+z1)*(z0hu+z1))/(ahuwt*ahuwt));
    }else{
    ywt=sqrt((z-pbhuwt)/-pahuwt);
    y1wt=sqrt((z1-pbhuwt)/-pahuwt);
    }
  }
   if(mxrOW!=-1 || myuOW!=-1)line((double)xwt, (double)ywt, (double)z, (double)x1wt, (double)y1wt, (double)z1); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z1=(i+1)*l/imax;
  if(linwl==0 && loutwl==0)
  {
    xwt=ml*z+nl2;
    x1wt=ml*z1+nl2;
   }else{
     if(linwl!=0 && loutwl!=0)
     {
     xwt=bwlwt*sqrt(1-((z0wl+z)*(z0wl+z))/(awlwt*awlwt));
     x1wt=bwlwt*sqrt(1-((z0wl+z1)*(z0wl+z1))/(awlwt*awlwt));
     }else{
     xwt=sqrt((z-pbwlwt)/-pawlwt);
     x1wt=sqrt((z1-pbwlwt)/-pawlwt);
     }
   }
   if(linhu==0 && louthu==0)
  {
    ywt=mu*z+nu2;
    y1wt=mu*z1+nu2;
  }else{
    if(linhu!=0 && louthu!=0)
    {
    ywt=bhuwt*sqrt(1-((z0hu+z)*(z0hu+z))/(ahuwt*ahuwt));
    y1wt=bhuwt*sqrt(1-((z0hu+z1)*(z0hu+z1))/(ahuwt*ahuwt));
    }else{
    ywt=sqrt((z-pbhuwt)/-pahuwt);
    y1wt=sqrt((z1-pbhuwt)/-pahuwt);
    }
  }
  if(mxlOW!=-1 || myuOW!=-1)line((double)xwt, (double)ywt, (double)z, (double)x1wt, (double)y1wt, (double)z1); 
}



  if (linwr1==0 && loutwr1==0){
   mr1=(-w2r1+w1r1)/l;
   nr11=-w1r1;
   nr21=-(w1rwt1);
   }


if (linwl1==0 && loutwl1==0){
   ml1=(w2l1-w1l1)/l;
   nl11=w1l1;
   nl21=(w1lwt1);
   }


if (linhu1 == 0 && louthu1==0) 
  {
   mu1=(h2u1-h1u1)/l;
   nu11=h1u1;
   nu21=(h1uwt1);
  }


if (linhd1 == 0 && louthd1==0) 
  {
   md1=(-h2d1+h1d1)/l;
   nd11=-h1d1;
   nd21=-(h1dwt1);
  }

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd1!=-1) line(w1l1, -h1d1, 0.0, -w1r1, -h1d1, 0.0);							/* entrance window given by the INNER walls*/
  if(myu1!=-1)line(w1l1, h1u1, 0.0, -w1r1, h1u1, 0.0);
  if(mxl1!=-1)line(w1l1, -h1d1, 0.0, w1l1, h1u1, 0.0);
  if(mxr1!=-1)line( -w1r1, h1u1, 0.0, -w1r1, -h1d1, 0.0);

  if(myd1!=-1)line(w2l1, -h2d1, l, -w2r1, -h2d1, l);								/* exit window given by the INNER walls*/
  if(myu1!=-1)line(w2l1, h2u1,  l, -w2r1, h2u1, l);
  if(mxl1!=-1)line(w2l1, -h2d1, l, w2l1, h2u1, l);
  if(mxr1!=-1)line( -w2r1, -h2d1,  l, -w2r1, h2u1, l);

  if(mydOW1!=-1) line((w1lwt1), -(h1dwt1), 0.0, -(w1rwt1), -(h1dwt1), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW1!=-1)line((w1lwt1), (h1uwt1), 0.0, -(w1rwt1), (h1uwt1), 0.0);
  if(mxlOW1!=-1)line((w1lwt1), -(h1dwt1), 0.0, (w1lwt1), (h1uwt1), 0.0);
  if(mxrOW1!=-1)line( -(w1rwt1), (h1uwt1), 0.0, -(w1rwt1), -(h1dwt1), 0.0);

  if(mydOW1!=-1)line((w2lwt1), -(h2dwt1), l, -(w2rwt1), -(h2dwt1), l);					/* exit windows given by the OUTER walls*/
  if(myuOW1!=-1)line((w2lwt1), (h2uwt1),  l, -(w2rwt1), (h2uwt1), l);
  if(mxlOW1!=-1)line((w2lwt1), -(h2dwt1), l, (w2lwt1), (h2uwt1), l);
  if(mxrOW1!=-1)line( -(w2rwt1), -(h2dwt1),  l, -(w2rwt1), (h2uwt1), l);

  if((myd1!=-1 && mydOW1!=-1) || (mxl1!=-1 && mxlOW1!=-1)) line(w1l1, -h1d1, 0.0, (w1lwt1), -(h1dwt1), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu1!=-1 && myuOW1!=-1) || (mxl1!=-1 && mxlOW1!=-1)) line(w1l1, h1u1, 0.0, (w1lwt1), (h1uwt1), 0.0);
  if((myd1!=-1 && mydOW1!=-1) || (mxr1!=-1 && mxrOW1!=-1)) line(-w1r1, -h1d1, 0.0,-(w1rwt1),  -(h1dwt1), 0.0);
  if((myu1!=-1 && myuOW1!=-1) || (mxr1!=-1 && mxrOW1!=-1)) line( -w1r1, h1u1, 0.0, -(w1rwt1), (h1uwt1), 0.0);

  if((myd1!=-1 && mydOW1!=-1) || (mxl1!=-1 && mxlOW1!=-1)) line(w2l1, -h2d1, l, (w2lwt1), -(h2dwt1), l);	/* corner connection lines for the exit windows*/
  if((myu1!=-1 && myuOW1!=-1) || (mxl1!=-1 && mxlOW1!=-1)) line(w2l1, h2u1, l, (w2lwt1), (h2uwt1), l);
  if((myd1!=-1 && mydOW1!=-1) || (mxr1!=-1 && mxrOW1!=-1)) line(-w2r1, -h2d1, l,-(w2rwt1),  -(h2dwt1), l);
  if((myu1!=-1 && myuOW1!=-1) || (mxr1!=-1 && mxrOW1!=-1)) line( -w2r1, h2u1, l, -(w2rwt1), (h2uwt1), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z11=(i+1)*l/imax;
  if(linwl1==0 && loutwl1 == 0)
   {
     x11=ml1*z+nl11;
     x21=ml1*z11+nl11;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      x11=bwl1*sqrt(1-((z0wl1+z)*(z0wl1+z))/(awl1*awl1));
      x21=bwl1*sqrt(1-((z0wl1+z11)*(z0wl1+z11))/(awl1*awl1));
      }else{
      x11=sqrt((z-pbwl1)/-pawl1);
      x21=sqrt((z11-pbwl1)/-pawl1);
      }
   }
  if(linhd1==0 && louthd1==0)
   {
     y11=md1*z+nd11;
     y21=md1*z11+nd11;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      y11=-bhd1*sqrt(1-((z0hd1+z)*(z0hd1+z))/(ahd1*ahd1));
      y21=-bhd1*sqrt(1-((z0hd1+z11)*(z0hd1+z11))/(ahd1*ahd1));
      }else{
      y11=-sqrt((z-pbhd1)/-pahd1);
      y21=-sqrt((z11-pbhd1)/-pahd1);
      }
   }
  if(mxl1!=-1 || myd1!=-1)line((double)x11, (double)y11, (double)z, (double)x21, (double)y21, (double)z11); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z11=(i+1)*l/imax;
  if(linwr1==0 && loutwr1==0)
  {
    x11=mr1*z+nr11;
    x21=mr1*z11+nr11;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    x11=-bwr1*sqrt(1-((z0wr1+z)*(z0wr1+z))/(awr1*awr1));
    x21=-bwr1*sqrt(1-((z0wr1+z11)*(z0wr1+z11))/(awr1*awr1));
    }else{
    x11=-sqrt((z-pbwr1)/-pawr1);
    x21=-sqrt((z11-pbwr1)/-pawr1);
    }
  }
  if(linhd1==0 && louthd1==0)
  {
    y11=md1*z+nd11;
    y21=md1*z11+nd11;
  }else{
    if(linhd1!=0 && louthd1!=0)
    {
    y11=-bhd1*sqrt(1-((z0hd1+z)*(z0hd1+z))/(ahd1*ahd1));
    y21=-bhd1*sqrt(1-((z0hd1+z11)*(z0hd1+z11))/(ahd1*ahd1));
    }else{
    y11=-sqrt((z-pbhd1)/-pahd1);
    y21=-sqrt((z11-pbhd1)/-pahd1);
    }
  }
  if(mxr1!=-1 || myd1!=-1) line((double)x11, (double)y11, (double)z, (double)x21, (double)y21, (double)z11); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z11=(i+1)*l/imax;
  if(linwr1==0 && loutwr1==0)
  {
    x11=mr1*z+nr11;
    x21=mr1*z11+nr11;
   }else{
     if(linwr1!=0 && loutwr1!=0){
     x11=-bwr1*sqrt(1-((z0wr1+z)*(z0wr1+z))/(awr1*awr1));
     x21=-bwr1*sqrt(1-((z0wr1+z11)*(z0wr1+z11))/(awr1*awr1));
     }else{
     x11=-sqrt((z-pbwr1)/-pawr1);
     x21=-sqrt((z11-pbwr1)/-pawr1);
     }
   }
   if(linhu1==0 && louthu1==0)
  {
    y11=mu1*z+nu11;
    y21=mu1*z11+nu11;
  }else{
    if(linhu1!=0 && louthu1!=0)
    {
    y11=bhu1*sqrt(1-((z0hu1+z)*(z0hu1+z))/(ahu1*ahu1));
    y21=bhu1*sqrt(1-((z0hu1+z11)*(z0hu1+z11))/(ahu1*ahu1));
    }else{
    y11=sqrt((z-pbhu1)/-pahu1);
    y21=sqrt((z11-pbhu1)/-pahu1);
    }
  }
  if(mxr1!=-1 || myu1!=-1)line((double)x11, (double)y11, (double)z, (double)x21, (double)y21, (double)z11); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z11=(i+1)*l/imax;
  if(linwl1==0 && loutwl1==0)
  {
    x11=ml1*z+nl11;
    x21=ml1*z11+nl11;
   }else{
     if(linwl1!=0 && loutwl1!=0)
     {
     x11=bwl1*sqrt(1-((z0wl1+z)*(z0wl1+z))/(awl1*awl1));
     x21=bwl1*sqrt(1-((z0wl1+z11)*(z0wl1+z11))/(awl1*awl1));
     }else{
     x11=sqrt((z-pbwl1)/-pawl1);
     x21=sqrt((z11-pbwl1)/-pawl1);
     }
   }
   if(linhu1==0 && louthu1==0)
  {
    y11=mu1*z+nu11;
    y21=mu1*z11+nu11;
  }else{
    if(linhu1!=0 && louthu1!=0)
    {
    y11=bhu1*sqrt(1-((z0hu1+z)*(z0hu1+z))/(ahu1*ahu1));
    y21=bhu1*sqrt(1-((z0hu1+z11)*(z0hu1+z11))/(ahu1*ahu1));
    }else{
    y11=sqrt((z-pbhu1)/-pahu1);
    y21=sqrt((z11-pbhu1)/-pahu1);
    }
  }
  if(mxl1!=-1 || myu1!=-1)line((double)x11, (double)y11, (double)z, (double)x21, (double)y21, (double)z11); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z11=(i+1)*l/imax;
  if(linwl1==0 && loutwl1 == 0)
   {
     xwt1=ml1*z+nl21;
     x1wt1=ml1*z11+nl21;
   }else{
      if(linwl1!=0 && loutwl1 != 0)
      {
      xwt1=bwlwt1*sqrt(1-((z0wl1+z)*(z0wl1+z))/(awlwt1*awlwt1));
      x1wt1=bwlwt1*sqrt(1-((z0wl1+z11)*(z0wl1+z11))/(awlwt1*awlwt1));
      }else{
      xwt1=sqrt((z-pbwlwt1)/-pawlwt1);
      x1wt1=sqrt((z11-pbwlwt1)/-pawlwt1);
      }
   }
  if(linhd1==0 && louthd1==0)
   {
     ywt1=md1*z+nd21;
     y1wt1=md1*z11+nd21;
    }else{
      if(linhd1!=0 && louthd1!=0)
      {
      ywt1=-bhdwt1*sqrt(1-((z0hd1+z)*(z0hd1+z))/(ahdwt1*ahdwt1));
      y1wt1=-bhdwt1*sqrt(1-((z0hd1+z11)*(z0hd1+z11))/(ahdwt1*ahdwt1));
      }else{
      ywt1=-sqrt((z-pbhdwt1)/-pahdwt1);
      y1wt1=-sqrt((z11-pbhdwt1)/-pahdwt1);
      }
   }
  if(mxlOW1!=-1 || mydOW1!=-1)line((double)xwt1, (double)ywt1, (double)z, (double)x1wt1, (double)y1wt1, (double)z11); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z11=(i+1)*l/imax;
  if(linwr1==0 && loutwr1==0)
  {
    xwt1=mr1*z+nr21;
    x1wt1=mr1*z11+nr21;
  }else{
    if(linwr1!=0 && loutwr1!=0)
    {
    xwt1=-bwrwt1*sqrt(1-((z0wr1+z)*(z0wr1+z))/(awrwt1*awrwt1));
    x1wt1=-bwrwt1*sqrt(1-((z0wr1+z11)*(z0wr1+z11))/(awrwt1*awrwt1));
    }else{
    xwt1=-sqrt((z-pbwrwt1)/-pawrwt1);
    x1wt1=-sqrt((z11-pbwrwt1)/-pawrwt1);
    }
  }
  if(linhd1==0 && louthd1==0)
  {
    ywt1=md1*z+nd21;
    y1wt1=md1*z11+nd21;
  }else{
    if(linhd1!=0 && louthd1!=0)
    {
    ywt1=-bhdwt1*sqrt(1-((z0hd1+z)*(z0hd1+z))/(ahdwt1*ahdwt1));
    y1wt1=-bhdwt1*sqrt(1-((z0hd1+z11)*(z0hd1+z11))/(ahdwt1*ahdwt1));
    }else{
    ywt1=-sqrt((z-pbhdwt1)/-pahdwt1);
    y1wt1=-sqrt((z11-pbhdwt1)/-pahdwt1);
    }
  }
  if(mxrOW1!=-1 || mydOW1!=-1) line((double)xwt1, (double)ywt1, (double)z, (double)x1wt1, (double)y1wt1, (double)z11); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z11=(i+1)*l/imax;
  if(linwr1==0 && loutwr1==0)
  {
    xwt1=mr1*z+nr21;
    x1wt1=mr1*z11+nr21;
   }else{
     if(linwr1!=0 && loutwr1!=0){
     xwt1=-bwrwt1*sqrt(1-((z0wr1+z)*(z0wr1+z))/(awrwt1*awrwt1));
     x1wt1=-bwrwt1*sqrt(1-((z0wr1+z11)*(z0wr1+z11))/(awrwt1*awrwt1));
     }else{
     xwt1=-sqrt((z-pbwrwt1)/-pawrwt1);
     x1wt1=-sqrt((z11-pbwrwt1)/-pawrwt1);
     }
   }
   if(linhu1==0 && louthu1==0)
  {
    ywt1=mu1*z+nu21;
    y1wt1=mu1*z11+nu21;
  }else{
    if(linhu1!=0 && louthu1!=0)
    {
    ywt1=bhuwt1*sqrt(1-((z0hu1+z)*(z0hu1+z))/(ahuwt1*ahuwt1));
    y1wt1=bhuwt1*sqrt(1-((z0hu1+z11)*(z0hu1+z11))/(ahuwt1*ahuwt1));
    }else{
    ywt1=sqrt((z-pbhuwt1)/-pahuwt1);
    y1wt1=sqrt((z11-pbhuwt1)/-pahuwt1);
    }
  }
   if(mxrOW1!=-1 || myuOW1!=-1)line((double)xwt1, (double)ywt1, (double)z, (double)x1wt1, (double)y1wt1, (double)z11); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z11=(i+1)*l/imax;
  if(linwl1==0 && loutwl1==0)
  {
    xwt1=ml1*z+nl21;
    x1wt1=ml1*z11+nl21;
   }else{
     if(linwl1!=0 && loutwl1!=0)
     {
     xwt1=bwlwt1*sqrt(1-((z0wl1+z)*(z0wl1+z))/(awlwt1*awlwt1));
     x1wt1=bwlwt1*sqrt(1-((z0wl1+z11)*(z0wl1+z11))/(awlwt1*awlwt1));
     }else{
     xwt1=sqrt((z-pbwlwt1)/-pawlwt1);
     x1wt1=sqrt((z11-pbwlwt1)/-pawlwt1);
     }
   }
   if(linhu1==0 && louthu1==0)
  {
    ywt1=mu1*z+nu21;
    y1wt1=mu1*z11+nu21;
  }else{
    if(linhu1!=0 && louthu1!=0)
    {
    ywt1=bhuwt1*sqrt(1-((z0hu1+z)*(z0hu1+z))/(ahuwt1*ahuwt1));
    y1wt1=bhuwt1*sqrt(1-((z0hu1+z11)*(z0hu1+z11))/(ahuwt1*ahuwt1));
    }else{
    ywt1=sqrt((z-pbhuwt1)/-pahuwt1);
    y1wt1=sqrt((z11-pbhuwt1)/-pahuwt1);
    }
  }
  if(mxlOW1!=-1 || myuOW1!=-1)line((double)xwt1, (double)ywt1, (double)z, (double)x1wt1, (double)y1wt1, (double)z11); 
}

 if (linwr2==0 && loutwr2==0){
   mr2=(-w2r2+w1r2)/l;
   nr12=-w1r2;
   nr22=-(w1rwt2);
   }


if (linwl2==0 && loutwl2==0){
   ml2=(w2l2-w1l2)/l;
   nl12=w1l2;
   nl22=(w1lwt2);
   }


if (linhu2 == 0 && louthu2==0) 
  {
   mu2=(h2u2-h1u2)/l;
   nu12=h1u2;
   nu22=(h1uwt2);
  }


if (linhd2 == 0 && louthd2==0) 
  {
   md2=(-h2d2+h1d2)/l;
   nd12=-h1d2;
   nd22=-(h1dwt2);
  }

  z0wr2=(linwr2-l-loutwr2)/2.0;
  z0wl2=(linwl2-l-loutwl2)/2.0;
  z0hu2=lbhu2/2.0-l-louthu2;
  z0hd2=lbhd2/2.0-l-louthd2;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd2!=-1) line(w1l2, -h1d2, 0.0, -w1r2, -h1d2, 0.0);							/* entrance window given by the INNER walls*/
  if(myu2!=-1)line(w1l2, h1u2, 0.0, -w1r2, h1u2, 0.0);
  if(mxl2!=-1)line(w1l2, -h1d2, 0.0, w1l2, h1u2, 0.0);
  if(mxr2!=-1)line( -w1r2, h1u2, 0.0, -w1r2, -h1d2, 0.0);

  if(myd2!=-1)line(w2l2, -h2d2, l, -w2r2, -h2d2, l);								/* exit window given by the INNER walls*/
  if(myu2!=-1)line(w2l2, h2u2,  l, -w2r2, h2u2, l);
  if(mxl2!=-1)line(w2l2, -h2d2, l, w2l2, h2u2, l);
  if(mxr2!=-1)line( -w2r2, -h2d2,  l, -w2r2, h2u2, l);

  if(mydOW2!=-1) line((w1lwt2), -(h1dwt2), 0.0, -(w1rwt2), -(h1dwt2), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW2!=-1)line((w1lwt2), (h1uwt2), 0.0, -(w1rwt2), (h1uwt2), 0.0);
  if(mxlOW2!=-1)line((w1lwt2), -(h1dwt2), 0.0, (w1lwt2), (h1uwt2), 0.0);
  if(mxrOW2!=-1)line( -(w1rwt2), (h1uwt2), 0.0, -(w1rwt2), -(h1dwt2), 0.0);

  if(mydOW2!=-1)line((w2lwt2), -(h2dwt2), l, -(w2rwt2), -(h2dwt2), l);					/* exit windows given by the OUTER walls*/
  if(myuOW2!=-1)line((w2lwt2), (h2uwt2),  l, -(w2rwt2), (h2uwt2), l);
  if(mxlOW2!=-1)line((w2lwt2), -(h2dwt2), l, (w2lwt2), (h2uwt2), l);
  if(mxrOW2!=-1)line( -(w2rwt2), -(h2dwt2),  l, -(w2rwt2), (h2uwt2), l);

  if((myd2!=-1 && mydOW2!=-1) || (mxl2!=-1 && mxlOW2!=-1)) line(w1l2, -h1d2, 0.0, (w1lwt2), -(h1dwt2), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu2!=-1 && myuOW2!=-1) || (mxl2!=-1 && mxlOW2!=-1)) line(w1l2, h1u2, 0.0, (w1lwt2), (h1uwt2), 0.0);
  if((myd2!=-1 && mydOW2!=-1) || (mxr2!=-1 && mxrOW2!=-1)) line(-w1r2, -h1d2, 0.0,-(w1rwt2),  -(h1dwt2), 0.0);
  if((myu2!=-1 && myuOW2!=-1) || (mxr2!=-1 && mxrOW2!=-1)) line( -w1r2, h1u2, 0.0, -(w1rwt2), (h1uwt2), 0.0);

  if((myd2!=-1 && mydOW2!=-1) || (mxl2!=-1 && mxlOW2!=-1)) line(w2l2, -h2d2, l, (w2lwt2), -(h2dwt2), l);	/* corner connection lines for the exit windows*/
  if((myu2!=-1 && myuOW2!=-1) || (mxl2!=-1 && mxlOW2!=-1)) line(w2l2, h2u2, l, (w2lwt2), (h2uwt2), l);
  if((myd2!=-1 && mydOW2!=-1) || (mxr2!=-1 && mxrOW2!=-1)) line(-w2r2, -h2d2, l,-(w2rwt2),  -(h2dwt2), l);
  if((myu2!=-1 && myuOW2!=-1) || (mxr2!=-1 && mxrOW2!=-1)) line( -w2r2, h2u2, l, -(w2rwt2), (h2uwt2), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z12=(i+1)*l/imax;
  if(linwl2==0 && loutwl2 == 0)
   {
     x12=ml2*z+nl12;
     x22=ml2*z12+nl12;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      x12=bwl2*sqrt(1-((z0wl2+z)*(z0wl2+z))/(awl2*awl2));
      x22=bwl2*sqrt(1-((z0wl2+z12)*(z0wl2+z12))/(awl2*awl2));
      }else{
      x12=sqrt((z-pbwl2)/-pawl2);
      x22=sqrt((z12-pbwl2)/-pawl2);
      }
   }
  if(linhd2==0 && louthd2==0)
   {
     y12=md2*z+nd12;
     y22=md2*z12+nd12;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      y12=-bhd2*sqrt(1-((z0hd2+z)*(z0hd2+z))/(ahd2*ahd2));
      y22=-bhd2*sqrt(1-((z0hd2+z12)*(z0hd2+z12))/(ahd2*ahd2));
      }else{
      y12=-sqrt((z-pbhd2)/-pahd2);
      y22=-sqrt((z12-pbhd2)/-pahd2);
      }
   }
  if(mxl2!=-1 || myd2!=-1)line((double)x12, (double)y12, (double)z, (double)x22, (double)y22, (double)z12); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z12=(i+1)*l/imax;
  if(linwr2==0 && loutwr2==0)
  {
    x12=mr2*z+nr12;
    x22=mr2*z12+nr12;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    x12=-bwr2*sqrt(1-((z0wr2+z)*(z0wr2+z))/(awr2*awr2));
    x22=-bwr2*sqrt(1-((z0wr2+z12)*(z0wr2+z12))/(awr2*awr2));
    }else{
    x12=-sqrt((z-pbwr2)/-pawr2);
    x22=-sqrt((z12-pbwr2)/-pawr2);
    }
  }
  if(linhd2==0 && louthd2==0)
  {
    y12=md2*z+nd12;
    y22=md2*z12+nd12;
  }else{
    if(linhd2!=0 && louthd2!=0)
    {
    y12=-bhd2*sqrt(1-((z0hd2+z)*(z0hd2+z))/(ahd2*ahd2));
    y22=-bhd2*sqrt(1-((z0hd2+z12)*(z0hd2+z12))/(ahd2*ahd2));
    }else{
    y12=-sqrt((z-pbhd2)/-pahd2);
    y22=-sqrt((z12-pbhd2)/-pahd2);
    }
  }
  if(mxr2!=-1 || myd2!=-1) line((double)x12, (double)y12, (double)z, (double)x22, (double)y22, (double)z12); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z12=(i+1)*l/imax;
  if(linwr2==0 && loutwr2==0)
  {
    x12=mr2*z+nr12;
    x22=mr2*z12+nr12;
   }else{
     if(linwr2!=0 && loutwr2!=0){
     x12=-bwr2*sqrt(1-((z0wr2+z)*(z0wr2+z))/(awr2*awr2));
     x22=-bwr2*sqrt(1-((z0wr2+z12)*(z0wr2+z12))/(awr2*awr2));
     }else{
     x12=-sqrt((z-pbwr2)/-pawr2);
     x22=-sqrt((z12-pbwr2)/-pawr2);
     }
   }
   if(linhu2==0 && louthu2==0)
  {
    y12=mu2*z+nu12;
    y22=mu2*z12+nu12;
  }else{
    if(linhu2!=0 && louthu2!=0)
    {
    y12=bhu2*sqrt(1-((z0hu2+z)*(z0hu2+z))/(ahu2*ahu2));
    y22=bhu2*sqrt(1-((z0hu2+z12)*(z0hu2+z12))/(ahu2*ahu2));
    }else{
    y12=sqrt((z-pbhu2)/-pahu2);
    y22=sqrt((z12-pbhu2)/-pahu2);
    }
  }
  if(mxr2!=-1 || myu2!=-1)line((double)x12, (double)y12, (double)z, (double)x22, (double)y22, (double)z12); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z12=(i+1)*l/imax;
  if(linwl2==0 && loutwl2==0)
  {
    x12=ml2*z+nl12;
    x22=ml2*z12+nl12;
   }else{
     if(linwl2!=0 && loutwl2!=0)
     {
     x12=bwl2*sqrt(1-((z0wl2+z)*(z0wl2+z))/(awl2*awl2));
     x22=bwl2*sqrt(1-((z0wl2+z12)*(z0wl2+z12))/(awl2*awl2));
     }else{
     x12=sqrt((z-pbwl2)/-pawl2);
     x22=sqrt((z12-pbwl2)/-pawl2);
     }
   }
   if(linhu2==0 && louthu2==0)
  {
    y12=mu2*z+nu12;
    y22=mu2*z12+nu12;
  }else{
    if(linhu2!=0 && louthu2!=0)
    {
    y12=bhu2*sqrt(1-((z0hu2+z)*(z0hu2+z))/(ahu2*ahu2));
    y22=bhu2*sqrt(1-((z0hu2+z12)*(z0hu2+z12))/(ahu2*ahu2));
    }else{
    y12=sqrt((z-pbhu2)/-pahu2);
    y22=sqrt((z12-pbhu2)/-pahu2);
    }
  }
  if(mxl2!=-1 || myu2!=-1)line((double)x12, (double)y12, (double)z, (double)x22, (double)y22, (double)z12); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z12=(i+1)*l/imax;
  if(linwl2==0 && loutwl2 == 0)
   {
     xwt2=ml2*z+nl22;
     x1wt2=ml2*z12+nl22;
   }else{
      if(linwl2!=0 && loutwl2 != 0)
      {
      xwt2=bwlwt2*sqrt(1-((z0wl2+z)*(z0wl2+z))/(awlwt2*awlwt2));
      x1wt2=bwlwt2*sqrt(1-((z0wl2+z12)*(z0wl2+z12))/(awlwt2*awlwt2));
      }else{
      xwt2=sqrt((z-pbwlwt2)/-pawlwt2);
      x1wt2=sqrt((z12-pbwlwt2)/-pawlwt2);
      }
   }
  if(linhd2==0 && louthd2==0)
   {
     ywt2=md2*z+nd22;
     y1wt2=md2*z12+nd22;
    }else{
      if(linhd2!=0 && louthd2!=0)
      {
      ywt2=-bhdwt2*sqrt(1-((z0hd2+z)*(z0hd2+z))/(ahdwt2*ahdwt2));
      y1wt2=-bhdwt2*sqrt(1-((z0hd2+z12)*(z0hd2+z12))/(ahdwt2*ahdwt2));
      }else{
      ywt2=-sqrt((z-pbhdwt2)/-pahdwt2);
      y1wt2=-sqrt((z12-pbhdwt2)/-pahdwt2);
      }
   }
  if(mxlOW2!=-1 || mydOW2!=-1)line((double)xwt2, (double)ywt2, (double)z, (double)x1wt2, (double)y1wt2, (double)z12); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z12=(i+1)*l/imax;
  if(linwr2==0 && loutwr2==0)
  {
    xwt2=mr2*z+nr22;
    x1wt2=mr2*z12+nr22;
  }else{
    if(linwr2!=0 && loutwr2!=0)
    {
    xwt2=-bwrwt2*sqrt(1-((z0wr2+z)*(z0wr2+z))/(awrwt2*awrwt2));
    x1wt2=-bwrwt2*sqrt(1-((z0wr2+z12)*(z0wr2+z12))/(awrwt2*awrwt2));
    }else{
    xwt2=-sqrt((z-pbwrwt2)/-pawrwt2);
    x1wt2=-sqrt((z12-pbwrwt2)/-pawrwt2);
    }
  }
  if(linhd2==0 && louthd2==0)
  {
    ywt2=md2*z+nd22;
    y1wt2=md2*z12+nd22;
  }else{
    if(linhd2!=0 && louthd2!=0)
    {
    ywt2=-bhdwt2*sqrt(1-((z0hd2+z)*(z0hd2+z))/(ahdwt2*ahdwt2));
    y1wt2=-bhdwt2*sqrt(1-((z0hd2+z12)*(z0hd2+z12))/(ahdwt2*ahdwt2));
    }else{
    ywt2=-sqrt((z-pbhdwt2)/-pahdwt2);
    y1wt2=-sqrt((z12-pbhdwt2)/-pahdwt2);
    }
  }
  if(mxrOW2!=-1 || mydOW2!=-1) line((double)xwt2, (double)ywt2, (double)z, (double)x1wt2, (double)y1wt2, (double)z12); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z12=(i+1)*l/imax;
  if(linwr2==0 && loutwr2==0)
  {
    xwt2=mr2*z+nr22;
    x1wt2=mr2*z12+nr22;
   }else{
     if(linwr2!=0 && loutwr2!=0){
     xwt2=-bwrwt2*sqrt(1-((z0wr2+z)*(z0wr2+z))/(awrwt2*awrwt2));
     x1wt2=-bwrwt2*sqrt(1-((z0wr2+z12)*(z0wr2+z12))/(awrwt2*awrwt2));
     }else{
     xwt2=-sqrt((z-pbwrwt2)/-pawrwt2);
     x1wt2=-sqrt((z12-pbwrwt2)/-pawrwt2);
     }
   }
   if(linhu2==0 && louthu2==0)
  {
    ywt2=mu2*z+nu22;
    y1wt2=mu2*z12+nu22;
  }else{
    if(linhu2!=0 && louthu2!=0)
    {
    ywt2=bhuwt2*sqrt(1-((z0hu2+z)*(z0hu2+z))/(ahuwt2*ahuwt2));
    y1wt2=bhuwt2*sqrt(1-((z0hu2+z12)*(z0hu2+z12))/(ahuwt2*ahuwt2));
    }else{
    ywt2=sqrt((z-pbhuwt2)/-pahuwt2);
    y1wt2=sqrt((z12-pbhuwt2)/-pahuwt2);
    }
  }
   if(mxrOW2!=-1 || myuOW2!=-1)line((double)xwt2, (double)ywt2, (double)z, (double)x1wt2, (double)y1wt2, (double)z12); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z12=(i+1)*l/imax;
  if(linwl2==0 && loutwl2==0)
  {
    xwt2=ml2*z+nl22;
    x1wt2=ml2*z12+nl22;
   }else{
     if(linwl2!=0 && loutwl2!=0)
     {
     xwt2=bwlwt2*sqrt(1-((z0wl2+z)*(z0wl2+z))/(awlwt2*awlwt2));
     x1wt2=bwlwt2*sqrt(1-((z0wl2+z12)*(z0wl2+z12))/(awlwt2*awlwt2));
     }else{
     xwt2=sqrt((z-pbwlwt2)/-pawlwt2);
     x1wt2=sqrt((z12-pbwlwt2)/-pawlwt2);
     }
   }
   if(linhu2==0 && louthu2==0)
  {
    ywt2=mu2*z+nu22;
    y1wt2=mu2*z12+nu22;
  }else{
    if(linhu2!=0 && louthu2!=0)
    {
    ywt2=bhuwt2*sqrt(1-((z0hu2+z)*(z0hu2+z))/(ahuwt2*ahuwt2));
    y1wt2=bhuwt2*sqrt(1-((z0hu2+z12)*(z0hu2+z12))/(ahuwt2*ahuwt2));
    }else{
    ywt2=sqrt((z-pbhuwt2)/-pahuwt2);
    y1wt2=sqrt((z12-pbhuwt2)/-pahuwt2);
    }
  }
  if(mxlOW2!=-1 || myuOW2!=-1)line((double)xwt2, (double)ywt2, (double)z, (double)x1wt2, (double)y1wt2, (double)z12); 
}


  if (linwr3==0 && loutwr3==0){
   mr3=(-w2r3+w1r3)/l;
   nr13=-w1r3;
   nr23=-(w1rwt3);
   }


if (linwl3==0 && loutwl3==0){
   ml3=(w2l3-w1l3)/l;
   nl13=w1l3;
   nl23=(w1lwt3);
   }


if (linhu3 == 0 && louthu3==0) 
  {
   mu3=(h2u3-h1u3)/l;
   nu13=h1u3;
   nu23=(h1uwt3);
  }


if (linhd3 == 0 && louthd3==0) 
  {
   md3=(-h2d3+h1d3)/l;
   nd13=-h1d3;
   nd23=-(h1dwt3);
  }

  z0wr3=(linwr3-l-loutwr3)/2.0;
  z0wl3=(linwl3-l-loutwl3)/2.0;
  z0hu3=lbhu3/2.0-l-louthu3;
  z0hd3=lbhd3/2.0-l-louthd3;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd3!=-1) line(w1l3, -h1d3, 0.0, -w1r3, -h1d3, 0.0);							/* entrance window given by the INNER walls*/
  if(myu3!=-1)line(w1l3, h1u3, 0.0, -w1r3, h1u3, 0.0);
  if(mxl3!=-1)line(w1l3, -h1d3, 0.0, w1l3, h1u3, 0.0);
  if(mxr3!=-1)line( -w1r3, h1u3, 0.0, -w1r3, -h1d3, 0.0);

  if(myd3!=-1)line(w2l3, -h2d3, l, -w2r3, -h2d3, l);								/* exit window given by the INNER walls*/
  if(myu3!=-1)line(w2l3, h2u3,  l, -w2r3, h2u3, l);
  if(mxl3!=-1)line(w2l3, -h2d3, l, w2l3, h2u3, l);
  if(mxr3!=-1)line( -w2r3, -h2d3,  l, -w2r3, h2u3, l);

  if(mydOW3!=-1) line((w1lwt3), -(h1dwt3), 0.0, -(w1rwt3), -(h1dwt3), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW3!=-1)line((w1lwt3), (h1uwt3), 0.0, -(w1rwt3), (h1uwt3), 0.0);
  if(mxlOW3!=-1)line((w1lwt3), -(h1dwt3), 0.0, (w1lwt3), (h1uwt3), 0.0);
  if(mxrOW3!=-1)line( -(w1rwt3), (h1uwt3), 0.0, -(w1rwt3), -(h1dwt3), 0.0);

  if(mydOW3!=-1)line((w2lwt3), -(h2dwt3), l, -(w2rwt3), -(h2dwt3), l);					/* exit windows given by the OUTER walls*/
  if(myuOW3!=-1)line((w2lwt3), (h2uwt3),  l, -(w2rwt3), (h2uwt3), l);
  if(mxlOW3!=-1)line((w2lwt3), -(h2dwt3), l, (w2lwt3), (h2uwt3), l);
  if(mxrOW3!=-1)line( -(w2rwt3), -(h2dwt3),  l, -(w2rwt3), (h2uwt3), l);

  if((myd3!=-1 && mydOW3!=-1) || (mxl3!=-1 && mxlOW3!=-1)) line(w1l3, -h1d3, 0.0, (w1lwt3), -(h1dwt3), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu3!=-1 && myuOW3!=-1) || (mxl3!=-1 && mxlOW3!=-1)) line(w1l3, h1u3, 0.0, (w1lwt3), (h1uwt3), 0.0);
  if((myd3!=-1 && mydOW3!=-1) || (mxr3!=-1 && mxrOW3!=-1)) line(-w1r3, -h1d3, 0.0,-(w1rwt3),  -(h1dwt3), 0.0);
  if((myu3!=-1 && myuOW3!=-1) || (mxr3!=-1 && mxrOW3!=-1)) line( -w1r3, h1u3, 0.0, -(w1rwt3), (h1uwt3), 0.0);

  if((myd3!=-1 && mydOW3!=-1) || (mxl3!=-1 && mxlOW3!=-1)) line(w2l3, -h2d3, l, (w2lwt3), -(h2dwt3), l);	/* corner connection lines for the exit windows*/
  if((myu3!=-1 && myuOW3!=-1) || (mxl3!=-1 && mxlOW3!=-1)) line(w2l3, h2u3, l, (w2lwt3), (h2uwt3), l);
  if((myd3!=-1 && mydOW3!=-1) || (mxr3!=-1 && mxrOW3!=-1)) line(-w2r3, -h2d3, l,-(w2rwt3),  -(h2dwt3), l);
  if((myu3!=-1 && myuOW3!=-1) || (mxr3!=-1 && mxrOW3!=-1)) line( -w2r3, h2u3, l, -(w2rwt3), (h2uwt3), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z13=(i+1)*l/imax;
  if(linwl3==0 && loutwl3 == 0)
   {
     x13=ml3*z+nl13;
     x23=ml3*z13+nl13;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      x13=bwl3*sqrt(1-((z0wl3+z)*(z0wl3+z))/(awl3*awl3));
      x23=bwl3*sqrt(1-((z0wl3+z13)*(z0wl3+z13))/(awl3*awl3));
      }else{
      x13=sqrt((z-pbwl3)/-pawl3);
      x23=sqrt((z13-pbwl3)/-pawl3);
      }
   }
  if(linhd3==0 && louthd3==0)
   {
     y13=md3*z+nd13;
     y23=md3*z13+nd13;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      y13=-bhd3*sqrt(1-((z0hd3+z)*(z0hd3+z))/(ahd3*ahd3));
      y23=-bhd3*sqrt(1-((z0hd3+z13)*(z0hd3+z13))/(ahd3*ahd3));
      }else{
      y13=-sqrt((z-pbhd3)/-pahd3);
      y23=-sqrt((z13-pbhd3)/-pahd3);
      }
   }
  if(mxl3!=-1 || myd3!=-1)line((double)x13, (double)y13, (double)z, (double)x23, (double)y23, (double)z13); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z13=(i+1)*l/imax;
  if(linwr3==0 && loutwr3==0)
  {
    x13=mr3*z+nr13;
    x23=mr3*z13+nr13;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    x13=-bwr3*sqrt(1-((z0wr3+z)*(z0wr3+z))/(awr3*awr3));
    x23=-bwr3*sqrt(1-((z0wr3+z13)*(z0wr3+z13))/(awr3*awr3));
    }else{
    x13=-sqrt((z-pbwr3)/-pawr3);
    x23=-sqrt((z13-pbwr3)/-pawr3);
    }
  }
  if(linhd3==0 && louthd3==0)
  {
    y13=md3*z+nd13;
    y23=md3*z13+nd13;
  }else{
    if(linhd3!=0 && louthd3!=0)
    {
    y13=-bhd3*sqrt(1-((z0hd3+z)*(z0hd3+z))/(ahd3*ahd3));
    y23=-bhd3*sqrt(1-((z0hd3+z13)*(z0hd3+z13))/(ahd3*ahd3));
    }else{
    y13=-sqrt((z-pbhd3)/-pahd3);
    y23=-sqrt((z13-pbhd3)/-pahd3);
    }
  }
  if(mxr3!=-1 || myd3!=-1) line((double)x13, (double)y13, (double)z, (double)x23, (double)y23, (double)z13); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z13=(i+1)*l/imax;
  if(linwr3==0 && loutwr3==0)
  {
    x13=mr3*z+nr13;
    x23=mr3*z13+nr13;
   }else{
     if(linwr3!=0 && loutwr3!=0){
     x13=-bwr3*sqrt(1-((z0wr3+z)*(z0wr3+z))/(awr3*awr3));
     x23=-bwr3*sqrt(1-((z0wr3+z13)*(z0wr3+z13))/(awr3*awr3));
     }else{
     x13=-sqrt((z-pbwr3)/-pawr3);
     x23=-sqrt((z13-pbwr3)/-pawr3);
     }
   }
   if(linhu3==0 && louthu3==0)
  {
    y13=mu3*z+nu13;
    y23=mu3*z13+nu13;
  }else{
    if(linhu3!=0 && louthu3!=0)
    {
    y13=bhu3*sqrt(1-((z0hu3+z)*(z0hu3+z))/(ahu3*ahu3));
    y23=bhu3*sqrt(1-((z0hu3+z13)*(z0hu3+z13))/(ahu3*ahu3));
    }else{
    y13=sqrt((z-pbhu3)/-pahu3);
    y23=sqrt((z13-pbhu3)/-pahu3);
    }
  }
  if(mxr3!=-1 || myu3!=-1)line((double)x13, (double)y13, (double)z, (double)x23, (double)y23, (double)z13); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z13=(i+1)*l/imax;
  if(linwl3==0 && loutwl3==0)
  {
    x13=ml3*z+nl13;
    x23=ml3*z13+nl13;
   }else{
     if(linwl3!=0 && loutwl3!=0)
     {
     x13=bwl3*sqrt(1-((z0wl3+z)*(z0wl3+z))/(awl3*awl3));
     x23=bwl3*sqrt(1-((z0wl3+z13)*(z0wl3+z13))/(awl3*awl3));
     }else{
     x13=sqrt((z-pbwl3)/-pawl3);
     x23=sqrt((z13-pbwl3)/-pawl3);
     }
   }
   if(linhu3==0 && louthu3==0)
  {
    y13=mu3*z+nu13;
    y23=mu3*z13+nu13;
  }else{
    if(linhu3!=0 && louthu3!=0)
    {
    y13=bhu3*sqrt(1-((z0hu3+z)*(z0hu3+z))/(ahu3*ahu3));
    y23=bhu3*sqrt(1-((z0hu3+z13)*(z0hu3+z13))/(ahu3*ahu3));
    }else{
    y13=sqrt((z-pbhu3)/-pahu3);
    y23=sqrt((z13-pbhu3)/-pahu3);
    }
  }
  if(mxl3!=-1 || myu3!=-1)line((double)x13, (double)y13, (double)z, (double)x23, (double)y23, (double)z13); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z13=(i+1)*l/imax;
  if(linwl3==0 && loutwl3 == 0)
   {
     xwt3=ml3*z+nl23;
     x1wt3=ml3*z13+nl23;
   }else{
      if(linwl3!=0 && loutwl3 != 0)
      {
      xwt3=bwlwt3*sqrt(1-((z0wl3+z)*(z0wl3+z))/(awlwt3*awlwt3));
      x1wt3=bwlwt3*sqrt(1-((z0wl3+z13)*(z0wl3+z13))/(awlwt3*awlwt3));
      }else{
      xwt3=sqrt((z-pbwlwt3)/-pawlwt3);
      x1wt3=sqrt((z13-pbwlwt3)/-pawlwt3);
      }
   }
  if(linhd3==0 && louthd3==0)
   {
     ywt3=md3*z+nd23;
     y1wt3=md3*z13+nd23;
    }else{
      if(linhd3!=0 && louthd3!=0)
      {
      ywt3=-bhdwt3*sqrt(1-((z0hd3+z)*(z0hd3+z))/(ahdwt3*ahdwt3));
      y1wt3=-bhdwt3*sqrt(1-((z0hd3+z13)*(z0hd3+z13))/(ahdwt3*ahdwt3));
      }else{
      ywt3=-sqrt((z-pbhdwt3)/-pahdwt3);
      y1wt3=-sqrt((z13-pbhdwt3)/-pahdwt3);
      }
   }
  if(mxlOW3!=-1 || mydOW3!=-1)line((double)xwt3, (double)ywt3, (double)z, (double)x1wt3, (double)y1wt3, (double)z13); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z13=(i+1)*l/imax;
  if(linwr3==0 && loutwr3==0)
  {
    xwt3=mr3*z+nr23;
    x1wt3=mr3*z13+nr23;
  }else{
    if(linwr3!=0 && loutwr3!=0)
    {
    xwt3=-bwrwt3*sqrt(1-((z0wr3+z)*(z0wr3+z))/(awrwt3*awrwt3));
    x1wt3=-bwrwt3*sqrt(1-((z0wr3+z13)*(z0wr3+z13))/(awrwt3*awrwt3));
    }else{
    xwt3=-sqrt((z-pbwrwt3)/-pawrwt3);
    x1wt3=-sqrt((z13-pbwrwt3)/-pawrwt3);
    }
  }
  if(linhd3==0 && louthd3==0)
  {
    ywt3=md3*z+nd23;
    y1wt3=md3*z13+nd23;
  }else{
    if(linhd3!=0 && louthd3!=0)
    {
    ywt3=-bhdwt3*sqrt(1-((z0hd3+z)*(z0hd3+z))/(ahdwt3*ahdwt3));
    y1wt3=-bhdwt3*sqrt(1-((z0hd3+z13)*(z0hd3+z13))/(ahdwt3*ahdwt3));
    }else{
    ywt3=-sqrt((z-pbhdwt3)/-pahdwt3);
    y1wt3=-sqrt((z13-pbhdwt3)/-pahdwt3);
    }
  }
  if(mxrOW3!=-1 || mydOW3!=-1) line((double)xwt3, (double)ywt3, (double)z, (double)x1wt3, (double)y1wt3, (double)z13); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z13=(i+1)*l/imax;
  if(linwr3==0 && loutwr3==0)
  {
    xwt3=mr3*z+nr23;
    x1wt3=mr3*z13+nr23;
   }else{
     if(linwr3!=0 && loutwr3!=0){
     xwt3=-bwrwt3*sqrt(1-((z0wr3+z)*(z0wr3+z))/(awrwt3*awrwt3));
     x1wt3=-bwrwt3*sqrt(1-((z0wr3+z13)*(z0wr3+z13))/(awrwt3*awrwt3));
     }else{
     xwt3=-sqrt((z-pbwrwt3)/-pawrwt3);
     x1wt3=-sqrt((z13-pbwrwt3)/-pawrwt3);
     }
   }
   if(linhu3==0 && louthu3==0)
  {
    ywt3=mu3*z+nu23;
    y1wt3=mu3*z13+nu23;
  }else{
    if(linhu3!=0 && louthu3!=0)
    {
    ywt3=bhuwt3*sqrt(1-((z0hu3+z)*(z0hu3+z))/(ahuwt3*ahuwt3));
    y1wt3=bhuwt3*sqrt(1-((z0hu3+z13)*(z0hu3+z13))/(ahuwt3*ahuwt3));
    }else{
    ywt3=sqrt((z-pbhuwt3)/-pahuwt3);
    y1wt3=sqrt((z13-pbhuwt3)/-pahuwt3);
    }
  }
   if(mxrOW3!=-1 || myuOW3!=-1)line((double)xwt3, (double)ywt3, (double)z, (double)x1wt3, (double)y1wt3, (double)z13); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z13=(i+1)*l/imax;
  if(linwl3==0 && loutwl3==0)
  {
    xwt3=ml3*z+nl23;
    x1wt3=ml3*z13+nl23;
   }else{
     if(linwl3!=0 && loutwl3!=0)
     {
     xwt3=bwlwt3*sqrt(1-((z0wl3+z)*(z0wl3+z))/(awlwt3*awlwt3));
     x1wt3=bwlwt3*sqrt(1-((z0wl3+z13)*(z0wl3+z13))/(awlwt3*awlwt3));
     }else{
     xwt3=sqrt((z-pbwlwt3)/-pawlwt3);
     x1wt3=sqrt((z13-pbwlwt3)/-pawlwt3);
     }
   }
   if(linhu3==0 && louthu3==0)
  {
    ywt3=mu3*z+nu23;
    y1wt3=mu3*z13+nu23;
  }else{
    if(linhu3!=0 && louthu3!=0)
    {
    ywt3=bhuwt3*sqrt(1-((z0hu3+z)*(z0hu3+z))/(ahuwt3*ahuwt3));
    y1wt3=bhuwt3*sqrt(1-((z0hu3+z13)*(z0hu3+z13))/(ahuwt3*ahuwt3));
    }else{
    ywt3=sqrt((z-pbhuwt3)/-pahuwt3);
    y1wt3=sqrt((z13-pbhuwt3)/-pahuwt3);
    }
  }
  if(mxlOW3!=-1 || myuOW3!=-1)line((double)xwt3, (double)ywt3, (double)z, (double)x1wt3, (double)y1wt3, (double)z13); 
}

 if (linwr4==0 && loutwr4==0){
   mr4=(-w2r4+w1r4)/l;
   nr14=-w1r4;
   nr24=-(w1rwt4);
   }


if (linwl4==0 && loutwl4==0){
   ml4=(w2l4-w1l4)/l;
   nl14=w1l4;
   nl24=(w1lwt4);
   }


if (linhu4 == 0 && louthu4==0) 
  {
   mu4=(h2u4-h1u4)/l;
   nu14=h1u4;
   nu24=(h1uwt4);
  }


if (linhd4 == 0 && louthd4==0) 
  {
   md4=(-h2d4+h1d4)/l;
   nd14=-h1d4;
   nd24=-(h1dwt4);
  }

  z0wr4=(linwr4-l-loutwr4)/2.0;
  z0wl4=(linwl4-l-loutwl4)/2.0;
  z0hu4=lbhu4/2.0-l-louthu4;
  z0hd4=lbhd4/2.0-l-louthd4;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd4!=-1) line(w1l4, -h1d4, 0.0, -w1r4, -h1d4, 0.0);							/* entrance window given by the INNER walls*/
  if(myu4!=-1)line(w1l4, h1u4, 0.0, -w1r4, h1u4, 0.0);
  if(mxl4!=-1)line(w1l4, -h1d4, 0.0, w1l4, h1u4, 0.0);
  if(mxr4!=-1)line( -w1r4, h1u4, 0.0, -w1r4, -h1d4, 0.0);

  if(myd4!=-1)line(w2l4, -h2d4, l, -w2r4, -h2d4, l);								/* exit window given by the INNER walls*/
  if(myu4!=-1)line(w2l4, h2u4,  l, -w2r4, h2u4, l);
  if(mxl4!=-1)line(w2l4, -h2d4, l, w2l4, h2u4, l);
  if(mxr4!=-1)line( -w2r4, -h2d4,  l, -w2r4, h2u4, l);

  if(mydOW4!=-1) line((w1lwt4), -(h1dwt4), 0.0, -(w1rwt4), -(h1dwt4), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW4!=-1)line((w1lwt4), (h1uwt4), 0.0, -(w1rwt4), (h1uwt4), 0.0);
  if(mxlOW4!=-1)line((w1lwt4), -(h1dwt4), 0.0, (w1lwt4), (h1uwt4), 0.0);
  if(mxrOW4!=-1)line( -(w1rwt4), (h1uwt4), 0.0, -(w1rwt4), -(h1dwt4), 0.0);

  if(mydOW4!=-1)line((w2lwt4), -(h2dwt4), l, -(w2rwt4), -(h2dwt4), l);					/* exit windows given by the OUTER walls*/
  if(myuOW4!=-1)line((w2lwt4), (h2uwt4),  l, -(w2rwt4), (h2uwt4), l);
  if(mxlOW4!=-1)line((w2lwt4), -(h2dwt4), l, (w2lwt4), (h2uwt4), l);
  if(mxrOW4!=-1)line( -(w2rwt4), -(h2dwt4),  l, -(w2rwt4), (h2uwt4), l);

  if((myd4!=-1 && mydOW4!=-1) || (mxl4!=-1 && mxlOW4!=-1)) line(w1l4, -h1d4, 0.0, (w1lwt4), -(h1dwt4), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu4!=-1 && myuOW4!=-1) || (mxl4!=-1 && mxlOW4!=-1)) line(w1l4, h1u4, 0.0, (w1lwt4), (h1uwt4), 0.0);
  if((myd4!=-1 && mydOW4!=-1) || (mxr4!=-1 && mxrOW4!=-1)) line(-w1r4, -h1d4, 0.0,-(w1rwt4),  -(h1dwt4), 0.0);
  if((myu4!=-1 && myuOW4!=-1) || (mxr4!=-1 && mxrOW4!=-1)) line( -w1r4, h1u4, 0.0, -(w1rwt4), (h1uwt4), 0.0);

  if((myd4!=-1 && mydOW4!=-1) || (mxl4!=-1 && mxlOW4!=-1)) line(w2l4, -h2d4, l, (w2lwt4), -(h2dwt4), l);	/* corner connection lines for the exit windows*/
  if((myu4!=-1 && myuOW4!=-1) || (mxl4!=-1 && mxlOW4!=-1)) line(w2l4, h2u4, l, (w2lwt4), (h2uwt4), l);
  if((myd4!=-1 && mydOW4!=-1) || (mxr4!=-1 && mxrOW4!=-1)) line(-w2r4, -h2d4, l,-(w2rwt4),  -(h2dwt4), l);
  if((myu4!=-1 && myuOW4!=-1) || (mxr4!=-1 && mxrOW4!=-1)) line( -w2r4, h2u4, l, -(w2rwt4), (h2uwt4), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z14=(i+1)*l/imax;
  if(linwl4==0 && loutwl4 == 0)
   {
     x14=ml4*z+nl14;
     x24=ml4*z14+nl14;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      x14=bwl4*sqrt(1-((z0wl4+z)*(z0wl4+z))/(awl4*awl4));
      x24=bwl4*sqrt(1-((z0wl4+z14)*(z0wl4+z14))/(awl4*awl4));
      }else{
      x14=sqrt((z-pbwl4)/-pawl4);
      x24=sqrt((z14-pbwl4)/-pawl4);
      }
   }
  if(linhd4==0 && louthd4==0)
   {
     y14=md4*z+nd14;
     y24=md4*z14+nd14;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      y14=-bhd4*sqrt(1-((z0hd4+z)*(z0hd4+z))/(ahd4*ahd4));
      y24=-bhd4*sqrt(1-((z0hd4+z14)*(z0hd4+z14))/(ahd4*ahd4));
      }else{
      y14=-sqrt((z-pbhd4)/-pahd4);
      y24=-sqrt((z14-pbhd4)/-pahd4);
      }
   }
  if(mxl4!=-1 || myd4!=-1)line((double)x14, (double)y14, (double)z, (double)x24, (double)y24, (double)z14); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z14=(i+1)*l/imax;
  if(linwr4==0 && loutwr4==0)
  {
    x14=mr4*z+nr14;
    x24=mr4*z14+nr14;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    x14=-bwr4*sqrt(1-((z0wr4+z)*(z0wr4+z))/(awr4*awr4));
    x24=-bwr4*sqrt(1-((z0wr4+z14)*(z0wr4+z14))/(awr4*awr4));
    }else{
    x14=-sqrt((z-pbwr4)/-pawr4);
    x24=-sqrt((z14-pbwr4)/-pawr4);
    }
  }
  if(linhd4==0 && louthd4==0)
  {
    y14=md4*z+nd14;
    y24=md4*z14+nd14;
  }else{
    if(linhd4!=0 && louthd4!=0)
    {
    y14=-bhd4*sqrt(1-((z0hd4+z)*(z0hd4+z))/(ahd4*ahd4));
    y24=-bhd4*sqrt(1-((z0hd4+z14)*(z0hd4+z14))/(ahd4*ahd4));
    }else{
    y14=-sqrt((z-pbhd4)/-pahd4);
    y24=-sqrt((z14-pbhd4)/-pahd4);
    }
  }
  if(mxr4!=-1 || myd4!=-1) line((double)x14, (double)y14, (double)z, (double)x24, (double)y24, (double)z14); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z14=(i+1)*l/imax;
  if(linwr4==0 && loutwr4==0)
  {
    x14=mr4*z+nr14;
    x24=mr4*z14+nr14;
   }else{
     if(linwr4!=0 && loutwr4!=0){
     x14=-bwr4*sqrt(1-((z0wr4+z)*(z0wr4+z))/(awr4*awr4));
     x24=-bwr4*sqrt(1-((z0wr4+z14)*(z0wr4+z14))/(awr4*awr4));
     }else{
     x14=-sqrt((z-pbwr4)/-pawr4);
     x24=-sqrt((z14-pbwr4)/-pawr4);
     }
   }
   if(linhu4==0 && louthu4==0)
  {
    y14=mu4*z+nu14;
    y24=mu4*z14+nu14;
  }else{
    if(linhu4!=0 && louthu4!=0)
    {
    y14=bhu4*sqrt(1-((z0hu4+z)*(z0hu4+z))/(ahu4*ahu4));
    y24=bhu4*sqrt(1-((z0hu4+z14)*(z0hu4+z14))/(ahu4*ahu4));
    }else{
    y14=sqrt((z-pbhu4)/-pahu4);
    y24=sqrt((z14-pbhu4)/-pahu4);
    }
  }
  if(mxr4!=-1 || myu4!=-1)line((double)x14, (double)y14, (double)z, (double)x24, (double)y24, (double)z14); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z14=(i+1)*l/imax;
  if(linwl4==0 && loutwl4==0)
  {
    x14=ml4*z+nl14;
    x24=ml4*z14+nl14;
   }else{
     if(linwl4!=0 && loutwl4!=0)
     {
     x14=bwl4*sqrt(1-((z0wl4+z)*(z0wl4+z))/(awl4*awl4));
     x24=bwl4*sqrt(1-((z0wl4+z14)*(z0wl4+z14))/(awl4*awl4));
     }else{
     x14=sqrt((z-pbwl4)/-pawl4);
     x24=sqrt((z14-pbwl4)/-pawl4);
     }
   }
   if(linhu4==0 && louthu4==0)
  {
    y14=mu4*z+nu14;
    y24=mu4*z14+nu14;
  }else{
    if(linhu4!=0 && louthu4!=0)
    {
    y14=bhu4*sqrt(1-((z0hu4+z)*(z0hu4+z))/(ahu4*ahu4));
    y24=bhu4*sqrt(1-((z0hu4+z14)*(z0hu4+z14))/(ahu4*ahu4));
    }else{
    y14=sqrt((z-pbhu4)/-pahu4);
    y24=sqrt((z14-pbhu4)/-pahu4);
    }
  }
  if(mxl4!=-1 || myu4!=-1)line((double)x14, (double)y14, (double)z, (double)x24, (double)y24, (double)z14); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z14=(i+1)*l/imax;
  if(linwl4==0 && loutwl4 == 0)
   {
     xwt4=ml4*z+nl24;
     x1wt4=ml4*z14+nl24;
   }else{
      if(linwl4!=0 && loutwl4 != 0)
      {
      xwt4=bwlwt4*sqrt(1-((z0wl4+z)*(z0wl4+z))/(awlwt4*awlwt4));
      x1wt4=bwlwt4*sqrt(1-((z0wl4+z14)*(z0wl4+z14))/(awlwt4*awlwt4));
      }else{
      xwt4=sqrt((z-pbwlwt4)/-pawlwt4);
      x1wt4=sqrt((z14-pbwlwt4)/-pawlwt4);
      }
   }
  if(linhd4==0 && louthd4==0)
   {
     ywt4=md4*z+nd24;
     y1wt4=md4*z14+nd24;
    }else{
      if(linhd4!=0 && louthd4!=0)
      {
      ywt4=-bhdwt4*sqrt(1-((z0hd4+z)*(z0hd4+z))/(ahdwt4*ahdwt4));
      y1wt4=-bhdwt4*sqrt(1-((z0hd4+z14)*(z0hd4+z14))/(ahdwt4*ahdwt4));
      }else{
      ywt4=-sqrt((z-pbhdwt4)/-pahdwt4);
      y1wt4=-sqrt((z14-pbhdwt4)/-pahdwt4);
      }
   }
  if(mxlOW4!=-1 || mydOW4!=-1)line((double)xwt4, (double)ywt4, (double)z, (double)x1wt4, (double)y1wt4, (double)z14); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z14=(i+1)*l/imax;
  if(linwr4==0 && loutwr4==0)
  {
    xwt4=mr4*z+nr24;
    x1wt4=mr4*z14+nr24;
  }else{
    if(linwr4!=0 && loutwr4!=0)
    {
    xwt4=-bwrwt4*sqrt(1-((z0wr4+z)*(z0wr4+z))/(awrwt4*awrwt4));
    x1wt4=-bwrwt4*sqrt(1-((z0wr4+z14)*(z0wr4+z14))/(awrwt4*awrwt4));
    }else{
    xwt4=-sqrt((z-pbwrwt4)/-pawrwt4);
    x1wt4=-sqrt((z14-pbwrwt4)/-pawrwt4);
    }
  }
  if(linhd4==0 && louthd4==0)
  {
    ywt4=md4*z+nd24;
    y1wt4=md4*z14+nd24;
  }else{
    if(linhd4!=0 && louthd4!=0)
    {
    ywt4=-bhdwt4*sqrt(1-((z0hd4+z)*(z0hd4+z))/(ahdwt4*ahdwt4));
    y1wt4=-bhdwt4*sqrt(1-((z0hd4+z14)*(z0hd4+z14))/(ahdwt4*ahdwt4));
    }else{
    ywt4=-sqrt((z-pbhdwt4)/-pahdwt4);
    y1wt4=-sqrt((z14-pbhdwt4)/-pahdwt4);
    }
  }
  if(mxrOW4!=-1 || mydOW4!=-1) line((double)xwt4, (double)ywt4, (double)z, (double)x1wt4, (double)y1wt4, (double)z14); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z14=(i+1)*l/imax;
  if(linwr4==0 && loutwr4==0)
  {
    xwt4=mr4*z+nr24;
    x1wt4=mr4*z14+nr24;
   }else{
     if(linwr4!=0 && loutwr4!=0){
     xwt4=-bwrwt4*sqrt(1-((z0wr4+z)*(z0wr4+z))/(awrwt4*awrwt4));
     x1wt4=-bwrwt4*sqrt(1-((z0wr4+z14)*(z0wr4+z14))/(awrwt4*awrwt4));
     }else{
     xwt4=-sqrt((z-pbwrwt4)/-pawrwt4);
     x1wt4=-sqrt((z14-pbwrwt4)/-pawrwt4);
     }
   }
   if(linhu4==0 && louthu4==0)
  {
    ywt4=mu4*z+nu24;
    y1wt4=mu4*z14+nu24;
  }else{
    if(linhu4!=0 && louthu4!=0)
    {
    ywt4=bhuwt4*sqrt(1-((z0hu4+z)*(z0hu4+z))/(ahuwt4*ahuwt4));
    y1wt4=bhuwt4*sqrt(1-((z0hu4+z14)*(z0hu4+z14))/(ahuwt4*ahuwt4));
    }else{
    ywt4=sqrt((z-pbhuwt4)/-pahuwt4);
    y1wt4=sqrt((z14-pbhuwt4)/-pahuwt4);
    }
  }
   if(mxrOW4!=-1 || myuOW4!=-1)line((double)xwt4, (double)ywt4, (double)z, (double)x1wt4, (double)y1wt4, (double)z14); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z14=(i+1)*l/imax;
  if(linwl4==0 && loutwl4==0)
  {
    xwt4=ml4*z+nl24;
    x1wt4=ml4*z14+nl24;
   }else{
     if(linwl4!=0 && loutwl4!=0)
     {
     xwt4=bwlwt4*sqrt(1-((z0wl4+z)*(z0wl4+z))/(awlwt4*awlwt4));
     x1wt4=bwlwt4*sqrt(1-((z0wl4+z14)*(z0wl4+z14))/(awlwt4*awlwt4));
     }else{
     xwt4=sqrt((z-pbwlwt4)/-pawlwt4);
     x1wt4=sqrt((z14-pbwlwt4)/-pawlwt4);
     }
   }
   if(linhu4==0 && louthu4==0)
  {
    ywt4=mu4*z+nu24;
    y1wt4=mu4*z14+nu24;
  }else{
    if(linhu4!=0 && louthu4!=0)
    {
    ywt4=bhuwt4*sqrt(1-((z0hu4+z)*(z0hu4+z))/(ahuwt4*ahuwt4));
    y1wt4=bhuwt4*sqrt(1-((z0hu4+z14)*(z0hu4+z14))/(ahuwt4*ahuwt4));
    }else{
    ywt4=sqrt((z-pbhuwt4)/-pahuwt4);
    y1wt4=sqrt((z14-pbhuwt4)/-pahuwt4);
    }
  }
  if(mxlOW4!=-1 || myuOW4!=-1)line((double)xwt4, (double)ywt4, (double)z, (double)x1wt4, (double)y1wt4, (double)z14); 
}

 if (linwr5==0 && loutwr5==0){
   mr5=(-w2r5+w1r5)/l;
   nr15=-w1r5;
   nr25=-(w1rwt5);
   }


if (linwl5==0 && loutwl5==0){
   ml5=(w2l5-w1l5)/l;
   nl15=w1l5;
   nl25=(w1lwt5);
   }


if (linhu5 == 0 && louthu5==0) 
  {
   mu5=(h2u5-h1u5)/l;
   nu15=h1u5;
   nu25=(h1uwt5);
  }


if (linhd5 == 0 && louthd5==0) 
  {
   md5=(-h2d5+h1d5)/l;
   nd15=-h1d5;
   nd25=-(h1dwt5);
  }

  z0wr5=(linwr5-l-loutwr5)/2.0;
  z0wl5=(linwl5-l-loutwl5)/2.0;
  z0hu5=lbhu5/2.0-l-louthu5;
  z0hd5=lbhd5/2.0-l-louthd5;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd5!=-1) line(w1l5, -h1d5, 0.0, -w1r5, -h1d5, 0.0);							/* entrance window given by the INNER walls*/
  if(myu5!=-1)line(w1l5, h1u5, 0.0, -w1r5, h1u5, 0.0);
  if(mxl5!=-1)line(w1l5, -h1d5, 0.0, w1l5, h1u5, 0.0);
  if(mxr5!=-1)line( -w1r5, h1u5, 0.0, -w1r5, -h1d5, 0.0);

  if(myd5!=-1)line(w2l5, -h2d5, l, -w2r5, -h2d5, l);								/* exit window given by the INNER walls*/
  if(myu5!=-1)line(w2l5, h2u5,  l, -w2r5, h2u5, l);
  if(mxl5!=-1)line(w2l5, -h2d5, l, w2l5, h2u5, l);
  if(mxr5!=-1)line( -w2r5, -h2d5,  l, -w2r5, h2u5, l);

  if(mydOW5!=-1) line((w1lwt5), -(h1dwt5), 0.0, -(w1rwt5), -(h1dwt5), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW5!=-1)line((w1lwt5), (h1uwt5), 0.0, -(w1rwt5), (h1uwt5), 0.0);
  if(mxlOW5!=-1)line((w1lwt5), -(h1dwt5), 0.0, (w1lwt5), (h1uwt5), 0.0);
  if(mxrOW5!=-1)line( -(w1rwt5), (h1uwt5), 0.0, -(w1rwt5), -(h1dwt5), 0.0);

  if(mydOW5!=-1)line((w2lwt5), -(h2dwt5), l, -(w2rwt5), -(h2dwt5), l);					/* exit windows given by the OUTER walls*/
  if(myuOW5!=-1)line((w2lwt5), (h2uwt5),  l, -(w2rwt5), (h2uwt5), l);
  if(mxlOW5!=-1)line((w2lwt5), -(h2dwt5), l, (w2lwt5), (h2uwt5), l);
  if(mxrOW5!=-1)line( -(w2rwt5), -(h2dwt5),  l, -(w2rwt5), (h2uwt5), l);

  if((myd5!=-1 && mydOW5!=-1) || (mxl5!=-1 && mxlOW5!=-1)) line(w1l5, -h1d5, 0.0, (w1lwt5), -(h1dwt5), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu5!=-1 && myuOW5!=-1) || (mxl5!=-1 && mxlOW5!=-1)) line(w1l5, h1u5, 0.0, (w1lwt5), (h1uwt5), 0.0);
  if((myd5!=-1 && mydOW5!=-1) || (mxr5!=-1 && mxrOW5!=-1)) line(-w1r5, -h1d5, 0.0,-(w1rwt5),  -(h1dwt5), 0.0);
  if((myu5!=-1 && myuOW5!=-1) || (mxr5!=-1 && mxrOW5!=-1)) line( -w1r5, h1u5, 0.0, -(w1rwt5), (h1uwt5), 0.0);

  if((myd5!=-1 && mydOW5!=-1) || (mxl5!=-1 && mxlOW5!=-1)) line(w2l5, -h2d5, l, (w2lwt5), -(h2dwt5), l);	/* corner connection lines for the exit windows*/
  if((myu5!=-1 && myuOW5!=-1) || (mxl5!=-1 && mxlOW5!=-1)) line(w2l5, h2u5, l, (w2lwt5), (h2uwt5), l);
  if((myd5!=-1 && mydOW5!=-1) || (mxr5!=-1 && mxrOW5!=-1)) line(-w2r5, -h2d5, l,-(w2rwt5),  -(h2dwt5), l);
  if((myu5!=-1 && myuOW5!=-1) || (mxr5!=-1 && mxrOW5!=-1)) line( -w2r5, h2u5, l, -(w2rwt5), (h2uwt5), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z15=(i+1)*l/imax;
  if(linwl5==0 && loutwl5 == 0)
   {
     x15=ml5*z+nl15;
     x25=ml5*z15+nl15;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      x15=bwl5*sqrt(1-((z0wl5+z)*(z0wl5+z))/(awl5*awl5));
      x25=bwl5*sqrt(1-((z0wl5+z15)*(z0wl5+z15))/(awl5*awl5));
      }else{
      x15=sqrt((z-pbwl5)/-pawl5);
      x25=sqrt((z15-pbwl5)/-pawl5);
      }
   }
  if(linhd5==0 && louthd5==0)
   {
     y15=md5*z+nd15;
     y25=md5*z15+nd15;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      y15=-bhd5*sqrt(1-((z0hd5+z)*(z0hd5+z))/(ahd5*ahd5));
      y25=-bhd5*sqrt(1-((z0hd5+z15)*(z0hd5+z15))/(ahd5*ahd5));
      }else{
      y15=-sqrt((z-pbhd5)/-pahd5);
      y25=-sqrt((z15-pbhd5)/-pahd5);
      }
   }
  if(mxl5!=-1 || myd5!=-1)line((double)x15, (double)y15, (double)z, (double)x25, (double)y25, (double)z15); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z15=(i+1)*l/imax;
  if(linwr5==0 && loutwr5==0)
  {
    x15=mr5*z+nr15;
    x25=mr5*z15+nr15;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    x15=-bwr5*sqrt(1-((z0wr5+z)*(z0wr5+z))/(awr5*awr5));
    x25=-bwr5*sqrt(1-((z0wr5+z15)*(z0wr5+z15))/(awr5*awr5));
    }else{
    x15=-sqrt((z-pbwr5)/-pawr5);
    x25=-sqrt((z15-pbwr5)/-pawr5);
    }
  }
  if(linhd5==0 && louthd5==0)
  {
    y15=md5*z+nd15;
    y25=md5*z15+nd15;
  }else{
    if(linhd5!=0 && louthd5!=0)
    {
    y15=-bhd5*sqrt(1-((z0hd5+z)*(z0hd5+z))/(ahd5*ahd5));
    y25=-bhd5*sqrt(1-((z0hd5+z15)*(z0hd5+z15))/(ahd5*ahd5));
    }else{
    y15=-sqrt((z-pbhd5)/-pahd5);
    y25=-sqrt((z15-pbhd5)/-pahd5);
    }
  }
  if(mxr5!=-1 || myd5!=-1) line((double)x15, (double)y15, (double)z, (double)x25, (double)y25, (double)z15); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z15=(i+1)*l/imax;
  if(linwr5==0 && loutwr5==0)
  {
    x15=mr5*z+nr15;
    x25=mr5*z15+nr15;
   }else{
     if(linwr5!=0 && loutwr5!=0){
     x15=-bwr5*sqrt(1-((z0wr5+z)*(z0wr5+z))/(awr5*awr5));
     x25=-bwr5*sqrt(1-((z0wr5+z15)*(z0wr5+z15))/(awr5*awr5));
     }else{
     x15=-sqrt((z-pbwr5)/-pawr5);
     x25=-sqrt((z15-pbwr5)/-pawr5);
     }
   }
   if(linhu5==0 && louthu5==0)
  {
    y15=mu5*z+nu15;
    y25=mu5*z15+nu15;
  }else{
    if(linhu5!=0 && louthu5!=0)
    {
    y15=bhu5*sqrt(1-((z0hu5+z)*(z0hu5+z))/(ahu5*ahu5));
    y25=bhu5*sqrt(1-((z0hu5+z15)*(z0hu5+z15))/(ahu5*ahu5));
    }else{
    y15=sqrt((z-pbhu5)/-pahu5);
    y25=sqrt((z15-pbhu5)/-pahu5);
    }
  }
  if(mxr5!=-1 || myu5!=-1)line((double)x15, (double)y15, (double)z, (double)x25, (double)y25, (double)z15); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z15=(i+1)*l/imax;
  if(linwl5==0 && loutwl5==0)
  {
    x15=ml5*z+nl15;
    x25=ml5*z15+nl15;
   }else{
     if(linwl5!=0 && loutwl5!=0)
     {
     x15=bwl5*sqrt(1-((z0wl5+z)*(z0wl5+z))/(awl5*awl5));
     x25=bwl5*sqrt(1-((z0wl5+z15)*(z0wl5+z15))/(awl5*awl5));
     }else{
     x15=sqrt((z-pbwl5)/-pawl5);
     x25=sqrt((z15-pbwl5)/-pawl5);
     }
   }
   if(linhu5==0 && louthu5==0)
  {
    y15=mu5*z+nu15;
    y25=mu5*z15+nu15;
  }else{
    if(linhu5!=0 && louthu5!=0)
    {
    y15=bhu5*sqrt(1-((z0hu5+z)*(z0hu5+z))/(ahu5*ahu5));
    y25=bhu5*sqrt(1-((z0hu5+z15)*(z0hu5+z15))/(ahu5*ahu5));
    }else{
    y15=sqrt((z-pbhu5)/-pahu5);
    y25=sqrt((z15-pbhu5)/-pahu5);
    }
  }
  if(mxl5!=-1 || myu5!=-1)line((double)x15, (double)y15, (double)z, (double)x25, (double)y25, (double)z15); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z15=(i+1)*l/imax;
  if(linwl5==0 && loutwl5 == 0)
   {
     xwt5=ml5*z+nl25;
     x1wt5=ml5*z15+nl25;
   }else{
      if(linwl5!=0 && loutwl5 != 0)
      {
      xwt5=bwlwt5*sqrt(1-((z0wl5+z)*(z0wl5+z))/(awlwt5*awlwt5));
      x1wt5=bwlwt5*sqrt(1-((z0wl5+z15)*(z0wl5+z15))/(awlwt5*awlwt5));
      }else{
      xwt5=sqrt((z-pbwlwt5)/-pawlwt5);
      x1wt5=sqrt((z15-pbwlwt5)/-pawlwt5);
      }
   }
  if(linhd5==0 && louthd5==0)
   {
     ywt5=md5*z+nd25;
     y1wt5=md5*z15+nd25;
    }else{
      if(linhd5!=0 && louthd5!=0)
      {
      ywt5=-bhdwt5*sqrt(1-((z0hd5+z)*(z0hd5+z))/(ahdwt5*ahdwt5));
      y1wt5=-bhdwt5*sqrt(1-((z0hd5+z15)*(z0hd5+z15))/(ahdwt5*ahdwt5));
      }else{
      ywt5=-sqrt((z-pbhdwt5)/-pahdwt5);
      y1wt5=-sqrt((z15-pbhdwt5)/-pahdwt5);
      }
   }
  if(mxlOW5!=-1 || mydOW5!=-1)line((double)xwt5, (double)ywt5, (double)z, (double)x1wt5, (double)y1wt5, (double)z15); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z15=(i+1)*l/imax;
  if(linwr5==0 && loutwr5==0)
  {
    xwt5=mr5*z+nr25;
    x1wt5=mr5*z15+nr25;
  }else{
    if(linwr5!=0 && loutwr5!=0)
    {
    xwt5=-bwrwt5*sqrt(1-((z0wr5+z)*(z0wr5+z))/(awrwt5*awrwt5));
    x1wt5=-bwrwt5*sqrt(1-((z0wr5+z15)*(z0wr5+z15))/(awrwt5*awrwt5));
    }else{
    xwt5=-sqrt((z-pbwrwt5)/-pawrwt5);
    x1wt5=-sqrt((z15-pbwrwt5)/-pawrwt5);
    }
  }
  if(linhd5==0 && louthd5==0)
  {
    ywt5=md5*z+nd25;
    y1wt5=md5*z15+nd25;
  }else{
    if(linhd5!=0 && louthd5!=0)
    {
    ywt5=-bhdwt5*sqrt(1-((z0hd5+z)*(z0hd5+z))/(ahdwt5*ahdwt5));
    y1wt5=-bhdwt5*sqrt(1-((z0hd5+z15)*(z0hd5+z15))/(ahdwt5*ahdwt5));
    }else{
    ywt5=-sqrt((z-pbhdwt5)/-pahdwt5);
    y1wt5=-sqrt((z15-pbhdwt5)/-pahdwt5);
    }
  }
  if(mxrOW5!=-1 || mydOW5!=-1) line((double)xwt5, (double)ywt5, (double)z, (double)x1wt5, (double)y1wt5, (double)z15); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z15=(i+1)*l/imax;
  if(linwr5==0 && loutwr5==0)
  {
    xwt5=mr5*z+nr25;
    x1wt5=mr5*z15+nr25;
   }else{
     if(linwr5!=0 && loutwr5!=0){
     xwt5=-bwrwt5*sqrt(1-((z0wr5+z)*(z0wr5+z))/(awrwt5*awrwt5));
     x1wt5=-bwrwt5*sqrt(1-((z0wr5+z15)*(z0wr5+z15))/(awrwt5*awrwt5));
     }else{
     xwt5=-sqrt((z-pbwrwt5)/-pawrwt5);
     x1wt5=-sqrt((z15-pbwrwt5)/-pawrwt5);
     }
   }
   if(linhu5==0 && louthu5==0)
  {
    ywt5=mu5*z+nu25;
    y1wt5=mu5*z15+nu25;
  }else{
    if(linhu5!=0 && louthu5!=0)
    {
    ywt5=bhuwt5*sqrt(1-((z0hu5+z)*(z0hu5+z))/(ahuwt5*ahuwt5));
    y1wt5=bhuwt5*sqrt(1-((z0hu5+z15)*(z0hu5+z15))/(ahuwt5*ahuwt5));
    }else{
    ywt5=sqrt((z-pbhuwt5)/-pahuwt5);
    y1wt5=sqrt((z15-pbhuwt5)/-pahuwt5);
    }
  }
   if(mxrOW5!=-1 || myuOW5!=-1)line((double)xwt5, (double)ywt5, (double)z, (double)x1wt5, (double)y1wt5, (double)z15); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z15=(i+1)*l/imax;
  if(linwl5==0 && loutwl5==0)
  {
    xwt5=ml5*z+nl25;
    x1wt5=ml5*z15+nl25;
   }else{
     if(linwl5!=0 && loutwl5!=0)
     {
     xwt5=bwlwt5*sqrt(1-((z0wl5+z)*(z0wl5+z))/(awlwt5*awlwt5));
     x1wt5=bwlwt5*sqrt(1-((z0wl5+z15)*(z0wl5+z15))/(awlwt5*awlwt5));
     }else{
     xwt5=sqrt((z-pbwlwt5)/-pawlwt5);
     x1wt5=sqrt((z15-pbwlwt5)/-pawlwt5);
     }
   }
   if(linhu5==0 && louthu5==0)
  {
    ywt5=mu5*z+nu25;
    y1wt5=mu5*z15+nu25;
  }else{
    if(linhu5!=0 && louthu5!=0)
    {
    ywt5=bhuwt5*sqrt(1-((z0hu5+z)*(z0hu5+z))/(ahuwt5*ahuwt5));
    y1wt5=bhuwt5*sqrt(1-((z0hu5+z15)*(z0hu5+z15))/(ahuwt5*ahuwt5));
    }else{
    ywt5=sqrt((z-pbhuwt5)/-pahuwt5);
    y1wt5=sqrt((z15-pbhuwt5)/-pahuwt5);
    }
  }
  if(mxlOW5!=-1 || myuOW5!=-1)line((double)xwt5, (double)ywt5, (double)z, (double)x1wt5, (double)y1wt5, (double)z15); 
}

  if (linwr6==0 && loutwr6==0){
   mr6=(-w2r6+w1r6)/l;
   nr16=-w1r6;
   nr26=-(w1rwt6);
   }


if (linwl6==0 && loutwl6==0){
   ml6=(w2l6-w1l6)/l;
   nl16=w1l6;
   nl26=(w1lwt6);
   }


if (linhu6 == 0 && louthu6==0) 
  {
   mu6=(h2u6-h1u6)/l;
   nu16=h1u6;
   nu26=(h1uwt6);
  }


if (linhd6 == 0 && louthd6==0) 
  {
   md6=(-h2d6+h1d6)/l;
   nd16=-h1d6;
   nd26=-(h1dwt6);
  }

  z0wr6=(linwr6-l-loutwr6)/2.0;
  z0wl6=(linwl6-l-loutwl6)/2.0;
  z0hu6=lbhu6/2.0-l-louthu6;
  z0hd6=lbhd6/2.0-l-louthd6;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd6!=-1) line(w1l6, -h1d6, 0.0, -w1r6, -h1d6, 0.0);							/* entrance window given by the INNER walls*/
  if(myu6!=-1)line(w1l6, h1u6, 0.0, -w1r6, h1u6, 0.0);
  if(mxl6!=-1)line(w1l6, -h1d6, 0.0, w1l6, h1u6, 0.0);
  if(mxr6!=-1)line( -w1r6, h1u6, 0.0, -w1r6, -h1d6, 0.0);

  if(myd6!=-1)line(w2l6, -h2d6, l, -w2r6, -h2d6, l);								/* exit window given by the INNER walls*/
  if(myu6!=-1)line(w2l6, h2u6,  l, -w2r6, h2u6, l);
  if(mxl6!=-1)line(w2l6, -h2d6, l, w2l6, h2u6, l);
  if(mxr6!=-1)line( -w2r6, -h2d6,  l, -w2r6, h2u6, l);

  if(mydOW6!=-1) line((w1lwt6), -(h1dwt6), 0.0, -(w1rwt6), -(h1dwt6), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW6!=-1)line((w1lwt6), (h1uwt6), 0.0, -(w1rwt6), (h1uwt6), 0.0);
  if(mxlOW6!=-1)line((w1lwt6), -(h1dwt6), 0.0, (w1lwt6), (h1uwt6), 0.0);
  if(mxrOW6!=-1)line( -(w1rwt6), (h1uwt6), 0.0, -(w1rwt6), -(h1dwt6), 0.0);

  if(mydOW6!=-1)line((w2lwt6), -(h2dwt6), l, -(w2rwt6), -(h2dwt6), l);					/* exit windows given by the OUTER walls*/
  if(myuOW6!=-1)line((w2lwt6), (h2uwt6),  l, -(w2rwt6), (h2uwt6), l);
  if(mxlOW6!=-1)line((w2lwt6), -(h2dwt6), l, (w2lwt6), (h2uwt6), l);
  if(mxrOW6!=-1)line( -(w2rwt6), -(h2dwt6),  l, -(w2rwt6), (h2uwt6), l);

  if((myd6!=-1 && mydOW6!=-1) || (mxl6!=-1 && mxlOW6!=-1)) line(w1l6, -h1d6, 0.0, (w1lwt6), -(h1dwt6), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu6!=-1 && myuOW6!=-1) || (mxl6!=-1 && mxlOW6!=-1)) line(w1l6, h1u6, 0.0, (w1lwt6), (h1uwt6), 0.0);
  if((myd6!=-1 && mydOW6!=-1) || (mxr6!=-1 && mxrOW6!=-1)) line(-w1r6, -h1d6, 0.0,-(w1rwt6),  -(h1dwt6), 0.0);
  if((myu6!=-1 && myuOW6!=-1) || (mxr6!=-1 && mxrOW6!=-1)) line( -w1r6, h1u6, 0.0, -(w1rwt6), (h1uwt6), 0.0);

  if((myd6!=-1 && mydOW6!=-1) || (mxl6!=-1 && mxlOW6!=-1)) line(w2l6, -h2d6, l, (w2lwt6), -(h2dwt6), l);	/* corner connection lines for the exit windows*/
  if((myu6!=-1 && myuOW6!=-1) || (mxl6!=-1 && mxlOW6!=-1)) line(w2l6, h2u6, l, (w2lwt6), (h2uwt6), l);
  if((myd6!=-1 && mydOW6!=-1) || (mxr6!=-1 && mxrOW6!=-1)) line(-w2r6, -h2d6, l,-(w2rwt6),  -(h2dwt6), l);
  if((myu6!=-1 && myuOW6!=-1) || (mxr6!=-1 && mxrOW6!=-1)) line( -w2r6, h2u6, l, -(w2rwt6), (h2uwt6), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z16=(i+1)*l/imax;
  if(linwl6==0 && loutwl6 == 0)
   {
     x16=ml6*z+nl16;
     x26=ml6*z16+nl16;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      x16=bwl6*sqrt(1-((z0wl6+z)*(z0wl6+z))/(awl6*awl6));
      x26=bwl6*sqrt(1-((z0wl6+z16)*(z0wl6+z16))/(awl6*awl6));
      }else{
      x16=sqrt((z-pbwl6)/-pawl6);
      x26=sqrt((z16-pbwl6)/-pawl6);
      }
   }
  if(linhd6==0 && louthd6==0)
   {
     y16=md6*z+nd16;
     y26=md6*z16+nd16;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      y16=-bhd6*sqrt(1-((z0hd6+z)*(z0hd6+z))/(ahd6*ahd6));
      y26=-bhd6*sqrt(1-((z0hd6+z16)*(z0hd6+z16))/(ahd6*ahd6));
      }else{
      y16=-sqrt((z-pbhd6)/-pahd6);
      y26=-sqrt((z16-pbhd6)/-pahd6);
      }
   }
  if(mxl6!=-1 || myd6!=-1)line((double)x16, (double)y16, (double)z, (double)x26, (double)y26, (double)z16); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z16=(i+1)*l/imax;
  if(linwr6==0 && loutwr6==0)
  {
    x16=mr6*z+nr16;
    x26=mr6*z16+nr16;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    x16=-bwr6*sqrt(1-((z0wr6+z)*(z0wr6+z))/(awr6*awr6));
    x26=-bwr6*sqrt(1-((z0wr6+z16)*(z0wr6+z16))/(awr6*awr6));
    }else{
    x16=-sqrt((z-pbwr6)/-pawr6);
    x26=-sqrt((z16-pbwr6)/-pawr6);
    }
  }
  if(linhd6==0 && louthd6==0)
  {
    y16=md6*z+nd16;
    y26=md6*z16+nd16;
  }else{
    if(linhd6!=0 && louthd6!=0)
    {
    y16=-bhd6*sqrt(1-((z0hd6+z)*(z0hd6+z))/(ahd6*ahd6));
    y26=-bhd6*sqrt(1-((z0hd6+z16)*(z0hd6+z16))/(ahd6*ahd6));
    }else{
    y16=-sqrt((z-pbhd6)/-pahd6);
    y26=-sqrt((z16-pbhd6)/-pahd6);
    }
  }
  if(mxr6!=-1 || myd6!=-1) line((double)x16, (double)y16, (double)z, (double)x26, (double)y26, (double)z16); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z16=(i+1)*l/imax;
  if(linwr6==0 && loutwr6==0)
  {
    x16=mr6*z+nr16;
    x26=mr6*z16+nr16;
   }else{
     if(linwr6!=0 && loutwr6!=0){
     x16=-bwr6*sqrt(1-((z0wr6+z)*(z0wr6+z))/(awr6*awr6));
     x26=-bwr6*sqrt(1-((z0wr6+z16)*(z0wr6+z16))/(awr6*awr6));
     }else{
     x16=-sqrt((z-pbwr6)/-pawr6);
     x26=-sqrt((z16-pbwr6)/-pawr6);
     }
   }
   if(linhu6==0 && louthu6==0)
  {
    y16=mu6*z+nu16;
    y26=mu6*z16+nu16;
  }else{
    if(linhu6!=0 && louthu6!=0)
    {
    y16=bhu6*sqrt(1-((z0hu6+z)*(z0hu6+z))/(ahu6*ahu6));
    y26=bhu6*sqrt(1-((z0hu6+z16)*(z0hu6+z16))/(ahu6*ahu6));
    }else{
    y16=sqrt((z-pbhu6)/-pahu6);
    y26=sqrt((z16-pbhu6)/-pahu6);
    }
  }
  if(mxr6!=-1 || myu6!=-1)line((double)x16, (double)y16, (double)z, (double)x26, (double)y26, (double)z16); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z16=(i+1)*l/imax;
  if(linwl6==0 && loutwl6==0)
  {
    x16=ml6*z+nl16;
    x26=ml6*z16+nl16;
   }else{
     if(linwl6!=0 && loutwl6!=0)
     {
     x16=bwl6*sqrt(1-((z0wl6+z)*(z0wl6+z))/(awl6*awl6));
     x26=bwl6*sqrt(1-((z0wl6+z16)*(z0wl6+z16))/(awl6*awl6));
     }else{
     x16=sqrt((z-pbwl6)/-pawl6);
     x26=sqrt((z16-pbwl6)/-pawl6);
     }
   }
   if(linhu6==0 && louthu6==0)
  {
    y16=mu6*z+nu16;
    y26=mu6*z16+nu16;
  }else{
    if(linhu6!=0 && louthu6!=0)
    {
    y16=bhu6*sqrt(1-((z0hu6+z)*(z0hu6+z))/(ahu6*ahu6));
    y26=bhu6*sqrt(1-((z0hu6+z16)*(z0hu6+z16))/(ahu6*ahu6));
    }else{
    y16=sqrt((z-pbhu6)/-pahu6);
    y26=sqrt((z16-pbhu6)/-pahu6);
    }
  }
  if(mxl6!=-1 || myu6!=-1)line((double)x16, (double)y16, (double)z, (double)x26, (double)y26, (double)z16); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z16=(i+1)*l/imax;
  if(linwl6==0 && loutwl6 == 0)
   {
     xwt6=ml6*z+nl26;
     x1wt6=ml6*z16+nl26;
   }else{
      if(linwl6!=0 && loutwl6 != 0)
      {
      xwt6=bwlwt6*sqrt(1-((z0wl6+z)*(z0wl6+z))/(awlwt6*awlwt6));
      x1wt6=bwlwt6*sqrt(1-((z0wl6+z16)*(z0wl6+z16))/(awlwt6*awlwt6));
      }else{
      xwt6=sqrt((z-pbwlwt6)/-pawlwt6);
      x1wt6=sqrt((z16-pbwlwt6)/-pawlwt6);
      }
   }
  if(linhd6==0 && louthd6==0)
   {
     ywt6=md6*z+nd26;
     y1wt6=md6*z16+nd26;
    }else{
      if(linhd6!=0 && louthd6!=0)
      {
      ywt6=-bhdwt6*sqrt(1-((z0hd6+z)*(z0hd6+z))/(ahdwt6*ahdwt6));
      y1wt6=-bhdwt6*sqrt(1-((z0hd6+z16)*(z0hd6+z16))/(ahdwt6*ahdwt6));
      }else{
      ywt6=-sqrt((z-pbhdwt6)/-pahdwt6);
      y1wt6=-sqrt((z16-pbhdwt6)/-pahdwt6);
      }
   }
  if(mxlOW6!=-1 || mydOW6!=-1)line((double)xwt6, (double)ywt6, (double)z, (double)x1wt6, (double)y1wt6, (double)z16); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z16=(i+1)*l/imax;
  if(linwr6==0 && loutwr6==0)
  {
    xwt6=mr6*z+nr26;
    x1wt6=mr6*z16+nr26;
  }else{
    if(linwr6!=0 && loutwr6!=0)
    {
    xwt6=-bwrwt6*sqrt(1-((z0wr6+z)*(z0wr6+z))/(awrwt6*awrwt6));
    x1wt6=-bwrwt6*sqrt(1-((z0wr6+z16)*(z0wr6+z16))/(awrwt6*awrwt6));
    }else{
    xwt6=-sqrt((z-pbwrwt6)/-pawrwt6);
    x1wt6=-sqrt((z16-pbwrwt6)/-pawrwt6);
    }
  }
  if(linhd6==0 && louthd6==0)
  {
    ywt6=md6*z+nd26;
    y1wt6=md6*z16+nd26;
  }else{
    if(linhd6!=0 && louthd6!=0)
    {
    ywt6=-bhdwt6*sqrt(1-((z0hd6+z)*(z0hd6+z))/(ahdwt6*ahdwt6));
    y1wt6=-bhdwt6*sqrt(1-((z0hd6+z16)*(z0hd6+z16))/(ahdwt6*ahdwt6));
    }else{
    ywt6=-sqrt((z-pbhdwt6)/-pahdwt6);
    y1wt6=-sqrt((z16-pbhdwt6)/-pahdwt6);
    }
  }
  if(mxrOW6!=-1 || mydOW6!=-1) line((double)xwt6, (double)ywt6, (double)z, (double)x1wt6, (double)y1wt6, (double)z16); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z16=(i+1)*l/imax;
  if(linwr6==0 && loutwr6==0)
  {
    xwt6=mr6*z+nr26;
    x1wt6=mr6*z16+nr26;
   }else{
     if(linwr6!=0 && loutwr6!=0){
     xwt6=-bwrwt6*sqrt(1-((z0wr6+z)*(z0wr6+z))/(awrwt6*awrwt6));
     x1wt6=-bwrwt6*sqrt(1-((z0wr6+z16)*(z0wr6+z16))/(awrwt6*awrwt6));
     }else{
     xwt6=-sqrt((z-pbwrwt6)/-pawrwt6);
     x1wt6=-sqrt((z16-pbwrwt6)/-pawrwt6);
     }
   }
   if(linhu6==0 && louthu6==0)
  {
    ywt6=mu6*z+nu26;
    y1wt6=mu6*z16+nu26;
  }else{
    if(linhu6!=0 && louthu6!=0)
    {
    ywt6=bhuwt6*sqrt(1-((z0hu6+z)*(z0hu6+z))/(ahuwt6*ahuwt6));
    y1wt6=bhuwt6*sqrt(1-((z0hu6+z16)*(z0hu6+z16))/(ahuwt6*ahuwt6));
    }else{
    ywt6=sqrt((z-pbhuwt6)/-pahuwt6);
    y1wt6=sqrt((z16-pbhuwt6)/-pahuwt6);
    }
  }
   if(mxrOW6!=-1 || myuOW6!=-1)line((double)xwt6, (double)ywt6, (double)z, (double)x1wt6, (double)y1wt6, (double)z16); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z16=(i+1)*l/imax;
  if(linwl6==0 && loutwl6==0)
  {
    xwt6=ml6*z+nl26;
    x1wt6=ml6*z16+nl26;
   }else{
     if(linwl6!=0 && loutwl6!=0)
     {
     xwt6=bwlwt6*sqrt(1-((z0wl6+z)*(z0wl6+z))/(awlwt6*awlwt6));
     x1wt6=bwlwt6*sqrt(1-((z0wl6+z16)*(z0wl6+z16))/(awlwt6*awlwt6));
     }else{
     xwt6=sqrt((z-pbwlwt6)/-pawlwt6);
     x1wt6=sqrt((z16-pbwlwt6)/-pawlwt6);
     }
   }
   if(linhu6==0 && louthu6==0)
  {
    ywt6=mu6*z+nu26;
    y1wt6=mu6*z16+nu26;
  }else{
    if(linhu6!=0 && louthu6!=0)
    {
    ywt6=bhuwt6*sqrt(1-((z0hu6+z)*(z0hu6+z))/(ahuwt6*ahuwt6));
    y1wt6=bhuwt6*sqrt(1-((z0hu6+z16)*(z0hu6+z16))/(ahuwt6*ahuwt6));
    }else{
    ywt6=sqrt((z-pbhuwt6)/-pahuwt6);
    y1wt6=sqrt((z16-pbhuwt6)/-pahuwt6);
    }
  }
  if(mxlOW6!=-1 || myuOW6!=-1)line((double)xwt6, (double)ywt6, (double)z, (double)x1wt6, (double)y1wt6, (double)z16); 
}

 if (linwr7==0 && loutwr7==0){
   mr7=(-w2r7+w1r7)/l;
   nr17=-w1r7;
   nr27=-(w1rwt7);
   }


if (linwl7==0 && loutwl7==0){
   ml7=(w2l7-w1l7)/l;
   nl17=w1l7;
   nl27=(w1lwt7);
   }


if (linhu7 == 0 && louthu7==0) 
  {
   mu7=(h2u7-h1u7)/l;
   nu17=h1u7;
   nu27=(h1uwt7);
  }


if (linhd7 == 0 && louthd7==0) 
  {
   md7=(-h2d7+h1d7)/l;
   nd17=-h1d7;
   nd27=-(h1dwt7);
  }

  z0wr7=(linwr7-l-loutwr7)/2.0;
  z0wl7=(linwl7-l-loutwl7)/2.0;
  z0hu7=lbhu7/2.0-l-louthu7;
  z0hd7=lbhd7/2.0-l-louthd7;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd7!=-1) line(w1l7, -h1d7, 0.0, -w1r7, -h1d7, 0.0);							/* entrance window given by the INNER walls*/
  if(myu7!=-1)line(w1l7, h1u7, 0.0, -w1r7, h1u7, 0.0);
  if(mxl7!=-1)line(w1l7, -h1d7, 0.0, w1l7, h1u7, 0.0);
  if(mxr7!=-1)line( -w1r7, h1u7, 0.0, -w1r7, -h1d7, 0.0);

  if(myd7!=-1)line(w2l7, -h2d7, l, -w2r7, -h2d7, l);								/* exit window given by the INNER walls*/
  if(myu7!=-1)line(w2l7, h2u7,  l, -w2r7, h2u7, l);
  if(mxl7!=-1)line(w2l7, -h2d7, l, w2l7, h2u7, l);
  if(mxr7!=-1)line( -w2r7, -h2d7,  l, -w2r7, h2u7, l);

  if(mydOW7!=-1) line((w1lwt7), -(h1dwt7), 0.0, -(w1rwt7), -(h1dwt7), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW7!=-1)line((w1lwt7), (h1uwt7), 0.0, -(w1rwt7), (h1uwt7), 0.0);
  if(mxlOW7!=-1)line((w1lwt7), -(h1dwt7), 0.0, (w1lwt7), (h1uwt7), 0.0);
  if(mxrOW7!=-1)line( -(w1rwt7), (h1uwt7), 0.0, -(w1rwt7), -(h1dwt7), 0.0);

  if(mydOW7!=-1)line((w2lwt7), -(h2dwt7), l, -(w2rwt7), -(h2dwt7), l);					/* exit windows given by the OUTER walls*/
  if(myuOW7!=-1)line((w2lwt7), (h2uwt7),  l, -(w2rwt7), (h2uwt7), l);
  if(mxlOW7!=-1)line((w2lwt7), -(h2dwt7), l, (w2lwt7), (h2uwt7), l);
  if(mxrOW7!=-1)line( -(w2rwt7), -(h2dwt7),  l, -(w2rwt7), (h2uwt7), l);

  if((myd7!=-1 && mydOW7!=-1) || (mxl7!=-1 && mxlOW7!=-1)) line(w1l7, -h1d7, 0.0, (w1lwt7), -(h1dwt7), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu7!=-1 && myuOW7!=-1) || (mxl7!=-1 && mxlOW7!=-1)) line(w1l7, h1u7, 0.0, (w1lwt7), (h1uwt7), 0.0);
  if((myd7!=-1 && mydOW7!=-1) || (mxr7!=-1 && mxrOW7!=-1)) line(-w1r7, -h1d7, 0.0,-(w1rwt7),  -(h1dwt7), 0.0);
  if((myu7!=-1 && myuOW7!=-1) || (mxr7!=-1 && mxrOW7!=-1)) line( -w1r7, h1u7, 0.0, -(w1rwt7), (h1uwt7), 0.0);

  if((myd7!=-1 && mydOW7!=-1) || (mxl7!=-1 && mxlOW7!=-1)) line(w2l7, -h2d7, l, (w2lwt7), -(h2dwt7), l);	/* corner connection lines for the exit windows*/
  if((myu7!=-1 && myuOW7!=-1) || (mxl7!=-1 && mxlOW7!=-1)) line(w2l7, h2u7, l, (w2lwt7), (h2uwt7), l);
  if((myd7!=-1 && mydOW7!=-1) || (mxr7!=-1 && mxrOW7!=-1)) line(-w2r7, -h2d7, l,-(w2rwt7),  -(h2dwt7), l);
  if((myu7!=-1 && myuOW7!=-1) || (mxr7!=-1 && mxrOW7!=-1)) line( -w2r7, h2u7, l, -(w2rwt7), (h2uwt7), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z17=(i+1)*l/imax;
  if(linwl7==0 && loutwl7 == 0)
   {
     x17=ml7*z+nl17;
     x27=ml7*z17+nl17;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      x17=bwl7*sqrt(1-((z0wl7+z)*(z0wl7+z))/(awl7*awl7));
      x27=bwl7*sqrt(1-((z0wl7+z17)*(z0wl7+z17))/(awl7*awl7));
      }else{
      x17=sqrt((z-pbwl7)/-pawl7);
      x27=sqrt((z17-pbwl7)/-pawl7);
      }
   }
  if(linhd7==0 && louthd7==0)
   {
     y17=md7*z+nd17;
     y27=md7*z17+nd17;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      y17=-bhd7*sqrt(1-((z0hd7+z)*(z0hd7+z))/(ahd7*ahd7));
      y27=-bhd7*sqrt(1-((z0hd7+z17)*(z0hd7+z17))/(ahd7*ahd7));
      }else{
      y17=-sqrt((z-pbhd7)/-pahd7);
      y27=-sqrt((z17-pbhd7)/-pahd7);
      }
   }
  if(mxl7!=-1 || myd7!=-1)line((double)x17, (double)y17, (double)z, (double)x27, (double)y27, (double)z17); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z17=(i+1)*l/imax;
  if(linwr7==0 && loutwr7==0)
  {
    x17=mr7*z+nr17;
    x27=mr7*z17+nr17;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    x17=-bwr7*sqrt(1-((z0wr7+z)*(z0wr7+z))/(awr7*awr7));
    x27=-bwr7*sqrt(1-((z0wr7+z17)*(z0wr7+z17))/(awr7*awr7));
    }else{
    x17=-sqrt((z-pbwr7)/-pawr7);
    x27=-sqrt((z17-pbwr7)/-pawr7);
    }
  }
  if(linhd7==0 && louthd7==0)
  {
    y17=md7*z+nd17;
    y27=md7*z17+nd17;
  }else{
    if(linhd7!=0 && louthd7!=0)
    {
    y17=-bhd7*sqrt(1-((z0hd7+z)*(z0hd7+z))/(ahd7*ahd7));
    y27=-bhd7*sqrt(1-((z0hd7+z17)*(z0hd7+z17))/(ahd7*ahd7));
    }else{
    y17=-sqrt((z-pbhd7)/-pahd7);
    y27=-sqrt((z17-pbhd7)/-pahd7);
    }
  }
  if(mxr7!=-1 || myd7!=-1) line((double)x17, (double)y17, (double)z, (double)x27, (double)y27, (double)z17); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z17=(i+1)*l/imax;
  if(linwr7==0 && loutwr7==0)
  {
    x17=mr7*z+nr17;
    x27=mr7*z17+nr17;
   }else{
     if(linwr7!=0 && loutwr7!=0){
     x17=-bwr7*sqrt(1-((z0wr7+z)*(z0wr7+z))/(awr7*awr7));
     x27=-bwr7*sqrt(1-((z0wr7+z17)*(z0wr7+z17))/(awr7*awr7));
     }else{
     x17=-sqrt((z-pbwr7)/-pawr7);
     x27=-sqrt((z17-pbwr7)/-pawr7);
     }
   }
   if(linhu7==0 && louthu7==0)
  {
    y17=mu7*z+nu17;
    y27=mu7*z17+nu17;
  }else{
    if(linhu7!=0 && louthu7!=0)
    {
    y17=bhu7*sqrt(1-((z0hu7+z)*(z0hu7+z))/(ahu7*ahu7));
    y27=bhu7*sqrt(1-((z0hu7+z17)*(z0hu7+z17))/(ahu7*ahu7));
    }else{
    y17=sqrt((z-pbhu7)/-pahu7);
    y27=sqrt((z17-pbhu7)/-pahu7);
    }
  }
  if(mxr7!=-1 || myu7!=-1)line((double)x17, (double)y17, (double)z, (double)x27, (double)y27, (double)z17); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z17=(i+1)*l/imax;
  if(linwl7==0 && loutwl7==0)
  {
    x17=ml7*z+nl17;
    x27=ml7*z17+nl17;
   }else{
     if(linwl7!=0 && loutwl7!=0)
     {
     x17=bwl7*sqrt(1-((z0wl7+z)*(z0wl7+z))/(awl7*awl7));
     x27=bwl7*sqrt(1-((z0wl7+z17)*(z0wl7+z17))/(awl7*awl7));
     }else{
     x17=sqrt((z-pbwl7)/-pawl7);
     x27=sqrt((z17-pbwl7)/-pawl7);
     }
   }
   if(linhu7==0 && louthu7==0)
  {
    y17=mu7*z+nu17;
    y27=mu7*z17+nu17;
  }else{
    if(linhu7!=0 && louthu7!=0)
    {
    y17=bhu7*sqrt(1-((z0hu7+z)*(z0hu7+z))/(ahu7*ahu7));
    y27=bhu7*sqrt(1-((z0hu7+z17)*(z0hu7+z17))/(ahu7*ahu7));
    }else{
    y17=sqrt((z-pbhu7)/-pahu7);
    y27=sqrt((z17-pbhu7)/-pahu7);
    }
  }
  if(mxl7!=-1 || myu7!=-1)line((double)x17, (double)y17, (double)z, (double)x27, (double)y27, (double)z17); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z17=(i+1)*l/imax;
  if(linwl7==0 && loutwl7 == 0)
   {
     xwt7=ml7*z+nl27;
     x1wt7=ml7*z17+nl27;
   }else{
      if(linwl7!=0 && loutwl7 != 0)
      {
      xwt7=bwlwt7*sqrt(1-((z0wl7+z)*(z0wl7+z))/(awlwt7*awlwt7));
      x1wt7=bwlwt7*sqrt(1-((z0wl7+z17)*(z0wl7+z17))/(awlwt7*awlwt7));
      }else{
      xwt7=sqrt((z-pbwlwt7)/-pawlwt7);
      x1wt7=sqrt((z17-pbwlwt7)/-pawlwt7);
      }
   }
  if(linhd7==0 && louthd7==0)
   {
     ywt7=md7*z+nd27;
     y1wt7=md7*z17+nd27;
    }else{
      if(linhd7!=0 && louthd7!=0)
      {
      ywt7=-bhdwt7*sqrt(1-((z0hd7+z)*(z0hd7+z))/(ahdwt7*ahdwt7));
      y1wt7=-bhdwt7*sqrt(1-((z0hd7+z17)*(z0hd7+z17))/(ahdwt7*ahdwt7));
      }else{
      ywt7=-sqrt((z-pbhdwt7)/-pahdwt7);
      y1wt7=-sqrt((z17-pbhdwt7)/-pahdwt7);
      }
   }
  if(mxlOW7!=-1 || mydOW7!=-1)line((double)xwt7, (double)ywt7, (double)z, (double)x1wt7, (double)y1wt7, (double)z17); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z17=(i+1)*l/imax;
  if(linwr7==0 && loutwr7==0)
  {
    xwt7=mr7*z+nr27;
    x1wt7=mr7*z17+nr27;
  }else{
    if(linwr7!=0 && loutwr7!=0)
    {
    xwt7=-bwrwt7*sqrt(1-((z0wr7+z)*(z0wr7+z))/(awrwt7*awrwt7));
    x1wt7=-bwrwt7*sqrt(1-((z0wr7+z17)*(z0wr7+z17))/(awrwt7*awrwt7));
    }else{
    xwt7=-sqrt((z-pbwrwt7)/-pawrwt7);
    x1wt7=-sqrt((z17-pbwrwt7)/-pawrwt7);
    }
  }
  if(linhd7==0 && louthd7==0)
  {
    ywt7=md7*z+nd27;
    y1wt7=md7*z17+nd27;
  }else{
    if(linhd7!=0 && louthd7!=0)
    {
    ywt7=-bhdwt7*sqrt(1-((z0hd7+z)*(z0hd7+z))/(ahdwt7*ahdwt7));
    y1wt7=-bhdwt7*sqrt(1-((z0hd7+z17)*(z0hd7+z17))/(ahdwt7*ahdwt7));
    }else{
    ywt7=-sqrt((z-pbhdwt7)/-pahdwt7);
    y1wt7=-sqrt((z17-pbhdwt7)/-pahdwt7);
    }
  }
  if(mxrOW7!=-1 || mydOW7!=-1) line((double)xwt7, (double)ywt7, (double)z, (double)x1wt7, (double)y1wt7, (double)z17); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z17=(i+1)*l/imax;
  if(linwr7==0 && loutwr7==0)
  {
    xwt7=mr7*z+nr27;
    x1wt7=mr7*z17+nr27;
   }else{
     if(linwr7!=0 && loutwr7!=0){
     xwt7=-bwrwt7*sqrt(1-((z0wr7+z)*(z0wr7+z))/(awrwt7*awrwt7));
     x1wt7=-bwrwt7*sqrt(1-((z0wr7+z17)*(z0wr7+z17))/(awrwt7*awrwt7));
     }else{
     xwt7=-sqrt((z-pbwrwt7)/-pawrwt7);
     x1wt7=-sqrt((z17-pbwrwt7)/-pawrwt7);
     }
   }
   if(linhu7==0 && louthu7==0)
  {
    ywt7=mu7*z+nu27;
    y1wt7=mu7*z17+nu27;
  }else{
    if(linhu7!=0 && louthu7!=0)
    {
    ywt7=bhuwt7*sqrt(1-((z0hu7+z)*(z0hu7+z))/(ahuwt7*ahuwt7));
    y1wt7=bhuwt7*sqrt(1-((z0hu7+z17)*(z0hu7+z17))/(ahuwt7*ahuwt7));
    }else{
    ywt7=sqrt((z-pbhuwt7)/-pahuwt7);
    y1wt7=sqrt((z17-pbhuwt7)/-pahuwt7);
    }
  }
   if(mxrOW7!=-1 || myuOW7!=-1)line((double)xwt7, (double)ywt7, (double)z, (double)x1wt7, (double)y1wt7, (double)z17); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z17=(i+1)*l/imax;
  if(linwl7==0 && loutwl7==0)
  {
    xwt7=ml7*z+nl27;
    x1wt7=ml7*z17+nl27;
   }else{
     if(linwl7!=0 && loutwl7!=0)
     {
     xwt7=bwlwt7*sqrt(1-((z0wl7+z)*(z0wl7+z))/(awlwt7*awlwt7));
     x1wt7=bwlwt7*sqrt(1-((z0wl7+z17)*(z0wl7+z17))/(awlwt7*awlwt7));
     }else{
     xwt7=sqrt((z-pbwlwt7)/-pawlwt7);
     x1wt7=sqrt((z17-pbwlwt7)/-pawlwt7);
     }
   }
   if(linhu7==0 && louthu7==0)
  {
    ywt7=mu7*z+nu27;
    y1wt7=mu7*z17+nu27;
  }else{
    if(linhu7!=0 && louthu7!=0)
    {
    ywt7=bhuwt7*sqrt(1-((z0hu7+z)*(z0hu7+z))/(ahuwt7*ahuwt7));
    y1wt7=bhuwt7*sqrt(1-((z0hu7+z17)*(z0hu7+z17))/(ahuwt7*ahuwt7));
    }else{
    ywt7=sqrt((z-pbhuwt7)/-pahuwt7);
    y1wt7=sqrt((z17-pbhuwt7)/-pahuwt7);
    }
  }
  if(mxlOW7!=-1 || myuOW7!=-1)line((double)xwt7, (double)ywt7, (double)z, (double)x1wt7, (double)y1wt7, (double)z17); 
}

  if (linwr8==0 && loutwr8==0){
   mr8=(-w2r8+w1r8)/l;
   nr18=-w1r8;
   nr28=-(w1rwt8);
   }


if (linwl8==0 && loutwl8==0){
   ml8=(w2l8-w1l8)/l;
   nl18=w1l8;
   nl28=(w1lwt8);
   }


if (linhu8 == 0 && louthu8==0) 
  {
   mu8=(h2u8-h1u8)/l;
   nu18=h1u8;
   nu28=(h1uwt8);
  }


if (linhd8 == 0 && louthd8==0) 
  {
   md8=(-h2d8+h1d8)/l;
   nd18=-h1d8;
   nd28=-(h1dwt8);
  }

  z0wr8=(linwr8-l-loutwr8)/2.0;
  z0wl8=(linwl8-l-loutwl8)/2.0;
  z0hu8=lbhu8/2.0-l-louthu8;
  z0hd8=lbhd8/2.0-l-louthd8;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd8!=-1) line(w1l8, -h1d8, 0.0, -w1r8, -h1d8, 0.0);							/* entrance window given by the INNER walls*/
  if(myu8!=-1)line(w1l8, h1u8, 0.0, -w1r8, h1u8, 0.0);
  if(mxl8!=-1)line(w1l8, -h1d8, 0.0, w1l8, h1u8, 0.0);
  if(mxr8!=-1)line( -w1r8, h1u8, 0.0, -w1r8, -h1d8, 0.0);

  if(myd8!=-1)line(w2l8, -h2d8, l, -w2r8, -h2d8, l);								/* exit window given by the INNER walls*/
  if(myu8!=-1)line(w2l8, h2u8,  l, -w2r8, h2u8, l);
  if(mxl8!=-1)line(w2l8, -h2d8, l, w2l8, h2u8, l);
  if(mxr8!=-1)line( -w2r8, -h2d8,  l, -w2r8, h2u8, l);

  if(mydOW8!=-1) line((w1lwt8), -(h1dwt8), 0.0, -(w1rwt8), -(h1dwt8), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW8!=-1)line((w1lwt8), (h1uwt8), 0.0, -(w1rwt8), (h1uwt8), 0.0);
  if(mxlOW8!=-1)line((w1lwt8), -(h1dwt8), 0.0, (w1lwt8), (h1uwt8), 0.0);
  if(mxrOW8!=-1)line( -(w1rwt8), (h1uwt8), 0.0, -(w1rwt8), -(h1dwt8), 0.0);

  if(mydOW8!=-1)line((w2lwt8), -(h2dwt8), l, -(w2rwt8), -(h2dwt8), l);					/* exit windows given by the OUTER walls*/
  if(myuOW8!=-1)line((w2lwt8), (h2uwt8),  l, -(w2rwt8), (h2uwt8), l);
  if(mxlOW8!=-1)line((w2lwt8), -(h2dwt8), l, (w2lwt8), (h2uwt8), l);
  if(mxrOW8!=-1)line( -(w2rwt8), -(h2dwt8),  l, -(w2rwt8), (h2uwt8), l);

  if((myd8!=-1 && mydOW8!=-1) || (mxl8!=-1 && mxlOW8!=-1)) line(w1l8, -h1d8, 0.0, (w1lwt8), -(h1dwt8), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu8!=-1 && myuOW8!=-1) || (mxl8!=-1 && mxlOW8!=-1)) line(w1l8, h1u8, 0.0, (w1lwt8), (h1uwt8), 0.0);
  if((myd8!=-1 && mydOW8!=-1) || (mxr8!=-1 && mxrOW8!=-1)) line(-w1r8, -h1d8, 0.0,-(w1rwt8),  -(h1dwt8), 0.0);
  if((myu8!=-1 && myuOW8!=-1) || (mxr8!=-1 && mxrOW8!=-1)) line( -w1r8, h1u8, 0.0, -(w1rwt8), (h1uwt8), 0.0);

  if((myd8!=-1 && mydOW8!=-1) || (mxl8!=-1 && mxlOW8!=-1)) line(w2l8, -h2d8, l, (w2lwt8), -(h2dwt8), l);	/* corner connection lines for the exit windows*/
  if((myu8!=-1 && myuOW8!=-1) || (mxl8!=-1 && mxlOW8!=-1)) line(w2l8, h2u8, l, (w2lwt8), (h2uwt8), l);
  if((myd8!=-1 && mydOW8!=-1) || (mxr8!=-1 && mxrOW8!=-1)) line(-w2r8, -h2d8, l,-(w2rwt8),  -(h2dwt8), l);
  if((myu8!=-1 && myuOW8!=-1) || (mxr8!=-1 && mxrOW8!=-1)) line( -w2r8, h2u8, l, -(w2rwt8), (h2uwt8), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z18=(i+1)*l/imax;
  if(linwl8==0 && loutwl8 == 0)
   {
     x18=ml8*z+nl18;
     x28=ml8*z18+nl18;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      x18=bwl8*sqrt(1-((z0wl8+z)*(z0wl8+z))/(awl8*awl8));
      x28=bwl8*sqrt(1-((z0wl8+z18)*(z0wl8+z18))/(awl8*awl8));
      }else{
      x18=sqrt((z-pbwl8)/-pawl8);
      x28=sqrt((z18-pbwl8)/-pawl8);
      }
   }
  if(linhd8==0 && louthd8==0)
   {
     y18=md8*z+nd18;
     y28=md8*z18+nd18;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      y18=-bhd8*sqrt(1-((z0hd8+z)*(z0hd8+z))/(ahd8*ahd8));
      y28=-bhd8*sqrt(1-((z0hd8+z18)*(z0hd8+z18))/(ahd8*ahd8));
      }else{
      y18=-sqrt((z-pbhd8)/-pahd8);
      y28=-sqrt((z18-pbhd8)/-pahd8);
      }
   }
  if(mxl8!=-1 || myd8!=-1)line((double)x18, (double)y18, (double)z, (double)x28, (double)y28, (double)z18); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z18=(i+1)*l/imax;
  if(linwr8==0 && loutwr8==0)
  {
    x18=mr8*z+nr18;
    x28=mr8*z18+nr18;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    x18=-bwr8*sqrt(1-((z0wr8+z)*(z0wr8+z))/(awr8*awr8));
    x28=-bwr8*sqrt(1-((z0wr8+z18)*(z0wr8+z18))/(awr8*awr8));
    }else{
    x18=-sqrt((z-pbwr8)/-pawr8);
    x28=-sqrt((z18-pbwr8)/-pawr8);
    }
  }
  if(linhd8==0 && louthd8==0)
  {
    y18=md8*z+nd18;
    y28=md8*z18+nd18;
  }else{
    if(linhd8!=0 && louthd8!=0)
    {
    y18=-bhd8*sqrt(1-((z0hd8+z)*(z0hd8+z))/(ahd8*ahd8));
    y28=-bhd8*sqrt(1-((z0hd8+z18)*(z0hd8+z18))/(ahd8*ahd8));
    }else{
    y18=-sqrt((z-pbhd8)/-pahd8);
    y28=-sqrt((z18-pbhd8)/-pahd8);
    }
  }
  if(mxr8!=-1 || myd8!=-1) line((double)x18, (double)y18, (double)z, (double)x28, (double)y28, (double)z18); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z18=(i+1)*l/imax;
  if(linwr8==0 && loutwr8==0)
  {
    x18=mr8*z+nr18;
    x28=mr8*z18+nr18;
   }else{
     if(linwr8!=0 && loutwr8!=0){
     x18=-bwr8*sqrt(1-((z0wr8+z)*(z0wr8+z))/(awr8*awr8));
     x28=-bwr8*sqrt(1-((z0wr8+z18)*(z0wr8+z18))/(awr8*awr8));
     }else{
     x18=-sqrt((z-pbwr8)/-pawr8);
     x28=-sqrt((z18-pbwr8)/-pawr8);
     }
   }
   if(linhu8==0 && louthu8==0)
  {
    y18=mu8*z+nu18;
    y28=mu8*z18+nu18;
  }else{
    if(linhu8!=0 && louthu8!=0)
    {
    y18=bhu8*sqrt(1-((z0hu8+z)*(z0hu8+z))/(ahu8*ahu8));
    y28=bhu8*sqrt(1-((z0hu8+z18)*(z0hu8+z18))/(ahu8*ahu8));
    }else{
    y18=sqrt((z-pbhu8)/-pahu8);
    y28=sqrt((z18-pbhu8)/-pahu8);
    }
  }
  if(mxr8!=-1 || myu8!=-1)line((double)x18, (double)y18, (double)z, (double)x28, (double)y28, (double)z18); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z18=(i+1)*l/imax;
  if(linwl8==0 && loutwl8==0)
  {
    x18=ml8*z+nl18;
    x28=ml8*z18+nl18;
   }else{
     if(linwl8!=0 && loutwl8!=0)
     {
     x18=bwl8*sqrt(1-((z0wl8+z)*(z0wl8+z))/(awl8*awl8));
     x28=bwl8*sqrt(1-((z0wl8+z18)*(z0wl8+z18))/(awl8*awl8));
     }else{
     x18=sqrt((z-pbwl8)/-pawl8);
     x28=sqrt((z18-pbwl8)/-pawl8);
     }
   }
   if(linhu8==0 && louthu8==0)
  {
    y18=mu8*z+nu18;
    y28=mu8*z18+nu18;
  }else{
    if(linhu8!=0 && louthu8!=0)
    {
    y18=bhu8*sqrt(1-((z0hu8+z)*(z0hu8+z))/(ahu8*ahu8));
    y28=bhu8*sqrt(1-((z0hu8+z18)*(z0hu8+z18))/(ahu8*ahu8));
    }else{
    y18=sqrt((z-pbhu8)/-pahu8);
    y28=sqrt((z18-pbhu8)/-pahu8);
    }
  }
  if(mxl8!=-1 || myu8!=-1)line((double)x18, (double)y18, (double)z, (double)x28, (double)y28, (double)z18); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z18=(i+1)*l/imax;
  if(linwl8==0 && loutwl8 == 0)
   {
     xwt8=ml8*z+nl28;
     x1wt8=ml8*z18+nl28;
   }else{
      if(linwl8!=0 && loutwl8 != 0)
      {
      xwt8=bwlwt8*sqrt(1-((z0wl8+z)*(z0wl8+z))/(awlwt8*awlwt8));
      x1wt8=bwlwt8*sqrt(1-((z0wl8+z18)*(z0wl8+z18))/(awlwt8*awlwt8));
      }else{
      xwt8=sqrt((z-pbwlwt8)/-pawlwt8);
      x1wt8=sqrt((z18-pbwlwt8)/-pawlwt8);
      }
   }
  if(linhd8==0 && louthd8==0)
   {
     ywt8=md8*z+nd28;
     y1wt8=md8*z18+nd28;
    }else{
      if(linhd8!=0 && louthd8!=0)
      {
      ywt8=-bhdwt8*sqrt(1-((z0hd8+z)*(z0hd8+z))/(ahdwt8*ahdwt8));
      y1wt8=-bhdwt8*sqrt(1-((z0hd8+z18)*(z0hd8+z18))/(ahdwt8*ahdwt8));
      }else{
      ywt8=-sqrt((z-pbhdwt8)/-pahdwt8);
      y1wt8=-sqrt((z18-pbhdwt8)/-pahdwt8);
      }
   }
  if(mxlOW8!=-1 || mydOW8!=-1)line((double)xwt8, (double)ywt8, (double)z, (double)x1wt8, (double)y1wt8, (double)z18); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z18=(i+1)*l/imax;
  if(linwr8==0 && loutwr8==0)
  {
    xwt8=mr8*z+nr28;
    x1wt8=mr8*z18+nr28;
  }else{
    if(linwr8!=0 && loutwr8!=0)
    {
    xwt8=-bwrwt8*sqrt(1-((z0wr8+z)*(z0wr8+z))/(awrwt8*awrwt8));
    x1wt8=-bwrwt8*sqrt(1-((z0wr8+z18)*(z0wr8+z18))/(awrwt8*awrwt8));
    }else{
    xwt8=-sqrt((z-pbwrwt8)/-pawrwt8);
    x1wt8=-sqrt((z18-pbwrwt8)/-pawrwt8);
    }
  }
  if(linhd8==0 && louthd8==0)
  {
    ywt8=md8*z+nd28;
    y1wt8=md8*z18+nd28;
  }else{
    if(linhd8!=0 && louthd8!=0)
    {
    ywt8=-bhdwt8*sqrt(1-((z0hd8+z)*(z0hd8+z))/(ahdwt8*ahdwt8));
    y1wt8=-bhdwt8*sqrt(1-((z0hd8+z18)*(z0hd8+z18))/(ahdwt8*ahdwt8));
    }else{
    ywt8=-sqrt((z-pbhdwt8)/-pahdwt8);
    y1wt8=-sqrt((z18-pbhdwt8)/-pahdwt8);
    }
  }
  if(mxrOW8!=-1 || mydOW8!=-1) line((double)xwt8, (double)ywt8, (double)z, (double)x1wt8, (double)y1wt8, (double)z18); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z18=(i+1)*l/imax;
  if(linwr8==0 && loutwr8==0)
  {
    xwt8=mr8*z+nr28;
    x1wt8=mr8*z18+nr28;
   }else{
     if(linwr8!=0 && loutwr8!=0){
     xwt8=-bwrwt8*sqrt(1-((z0wr8+z)*(z0wr8+z))/(awrwt8*awrwt8));
     x1wt8=-bwrwt8*sqrt(1-((z0wr8+z18)*(z0wr8+z18))/(awrwt8*awrwt8));
     }else{
     xwt8=-sqrt((z-pbwrwt8)/-pawrwt8);
     x1wt8=-sqrt((z18-pbwrwt8)/-pawrwt8);
     }
   }
   if(linhu8==0 && louthu8==0)
  {
    ywt8=mu8*z+nu28;
    y1wt8=mu8*z18+nu28;
  }else{
    if(linhu8!=0 && louthu8!=0)
    {
    ywt8=bhuwt8*sqrt(1-((z0hu8+z)*(z0hu8+z))/(ahuwt8*ahuwt8));
    y1wt8=bhuwt8*sqrt(1-((z0hu8+z18)*(z0hu8+z18))/(ahuwt8*ahuwt8));
    }else{
    ywt8=sqrt((z-pbhuwt8)/-pahuwt8);
    y1wt8=sqrt((z18-pbhuwt8)/-pahuwt8);
    }
  }
   if(mxrOW8!=-1 || myuOW8!=-1)line((double)xwt8, (double)ywt8, (double)z, (double)x1wt8, (double)y1wt8, (double)z18); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z18=(i+1)*l/imax;
  if(linwl8==0 && loutwl8==0)
  {
    xwt8=ml8*z+nl28;
    x1wt8=ml8*z18+nl28;
   }else{
     if(linwl8!=0 && loutwl8!=0)
     {
     xwt8=bwlwt8*sqrt(1-((z0wl8+z)*(z0wl8+z))/(awlwt8*awlwt8));
     x1wt8=bwlwt8*sqrt(1-((z0wl8+z18)*(z0wl8+z18))/(awlwt8*awlwt8));
     }else{
     xwt8=sqrt((z-pbwlwt8)/-pawlwt8);
     x1wt8=sqrt((z18-pbwlwt8)/-pawlwt8);
     }
   }
   if(linhu8==0 && louthu8==0)
  {
    ywt8=mu8*z+nu28;
    y1wt8=mu8*z18+nu28;
  }else{
    if(linhu8!=0 && louthu8!=0)
    {
    ywt8=bhuwt8*sqrt(1-((z0hu8+z)*(z0hu8+z))/(ahuwt8*ahuwt8));
    y1wt8=bhuwt8*sqrt(1-((z0hu8+z18)*(z0hu8+z18))/(ahuwt8*ahuwt8));
    }else{
    ywt8=sqrt((z-pbhuwt8)/-pahuwt8);
    y1wt8=sqrt((z18-pbhuwt8)/-pahuwt8);
    }
  }
  if(mxlOW8!=-1 || myuOW8!=-1)line((double)xwt8, (double)ywt8, (double)z, (double)x1wt8, (double)y1wt8, (double)z18); 
}

  if (linwr9==0 && loutwr9==0){
   mr9=(-w2r9+w1r9)/l;
   nr19=-w1r9;
   nr29=-(w1rwt9);
   }


if (linwl9==0 && loutwl9==0){
   ml9=(w2l9-w1l9)/l;
   nl19=w1l9;
   nl29=(w1lwt9);
   }


if (linhu9 == 0 && louthu9==0) 
  {
   mu9=(h2u9-h1u9)/l;
   nu19=h1u9;
   nu29=(h1uwt9);
  }


if (linhd9 == 0 && louthd9==0) 
  {
   md9=(-h2d9+h1d9)/l;
   nd19=-h1d9;
   nd29=-(h1dwt9);
  }

  z0wr9=(linwr9-l-loutwr9)/2.0;
  z0wl9=(linwl9-l-loutwl9)/2.0;
  z0hu9=lbhu9/2.0-l-louthu9;
  z0hd9=lbhd9/2.0-l-louthd9;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd9!=-1) line(w1l9, -h1d9, 0.0, -w1r9, -h1d9, 0.0);							/* entrance window given by the INNER walls*/
  if(myu9!=-1)line(w1l9, h1u9, 0.0, -w1r9, h1u9, 0.0);
  if(mxl9!=-1)line(w1l9, -h1d9, 0.0, w1l9, h1u9, 0.0);
  if(mxr9!=-1)line( -w1r9, h1u9, 0.0, -w1r9, -h1d9, 0.0);

  if(myd9!=-1)line(w2l9, -h2d9, l, -w2r9, -h2d9, l);								/* exit window given by the INNER walls*/
  if(myu9!=-1)line(w2l9, h2u9,  l, -w2r9, h2u9, l);
  if(mxl9!=-1)line(w2l9, -h2d9, l, w2l9, h2u9, l);
  if(mxr9!=-1)line( -w2r9, -h2d9,  l, -w2r9, h2u9, l);

  if(mydOW9!=-1) line((w1lwt9), -(h1dwt9), 0.0, -(w1rwt9), -(h1dwt9), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW9!=-1)line((w1lwt9), (h1uwt9), 0.0, -(w1rwt9), (h1uwt9), 0.0);
  if(mxlOW9!=-1)line((w1lwt9), -(h1dwt9), 0.0, (w1lwt9), (h1uwt9), 0.0);
  if(mxrOW9!=-1)line( -(w1rwt9), (h1uwt9), 0.0, -(w1rwt9), -(h1dwt9), 0.0);

  if(mydOW9!=-1)line((w2lwt9), -(h2dwt9), l, -(w2rwt9), -(h2dwt9), l);					/* exit windows given by the OUTER walls*/
  if(myuOW9!=-1)line((w2lwt9), (h2uwt9),  l, -(w2rwt9), (h2uwt9), l);
  if(mxlOW9!=-1)line((w2lwt9), -(h2dwt9), l, (w2lwt9), (h2uwt9), l);
  if(mxrOW9!=-1)line( -(w2rwt9), -(h2dwt9),  l, -(w2rwt9), (h2uwt9), l);

  if((myd9!=-1 && mydOW9!=-1) || (mxl9!=-1 && mxlOW9!=-1)) line(w1l9, -h1d9, 0.0, (w1lwt9), -(h1dwt9), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu9!=-1 && myuOW9!=-1) || (mxl9!=-1 && mxlOW9!=-1)) line(w1l9, h1u9, 0.0, (w1lwt9), (h1uwt9), 0.0);
  if((myd9!=-1 && mydOW9!=-1) || (mxr9!=-1 && mxrOW9!=-1)) line(-w1r9, -h1d9, 0.0,-(w1rwt9),  -(h1dwt9), 0.0);
  if((myu9!=-1 && myuOW9!=-1) || (mxr9!=-1 && mxrOW9!=-1)) line( -w1r9, h1u9, 0.0, -(w1rwt9), (h1uwt9), 0.0);

  if((myd9!=-1 && mydOW9!=-1) || (mxl9!=-1 && mxlOW9!=-1)) line(w2l9, -h2d9, l, (w2lwt9), -(h2dwt9), l);	/* corner connection lines for the exit windows*/
  if((myu9!=-1 && myuOW9!=-1) || (mxl9!=-1 && mxlOW9!=-1)) line(w2l9, h2u9, l, (w2lwt9), (h2uwt9), l);
  if((myd9!=-1 && mydOW9!=-1) || (mxr9!=-1 && mxrOW9!=-1)) line(-w2r9, -h2d9, l,-(w2rwt9),  -(h2dwt9), l);
  if((myu9!=-1 && myuOW9!=-1) || (mxr9!=-1 && mxrOW9!=-1)) line( -w2r9, h2u9, l, -(w2rwt9), (h2uwt9), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z19=(i+1)*l/imax;
  if(linwl9==0 && loutwl9 == 0)
   {
     x19=ml9*z+nl19;
     x29=ml9*z19+nl19;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      x19=bwl9*sqrt(1-((z0wl9+z)*(z0wl9+z))/(awl9*awl9));
      x29=bwl9*sqrt(1-((z0wl9+z19)*(z0wl9+z19))/(awl9*awl9));
      }else{
      x19=sqrt((z-pbwl9)/-pawl9);
      x29=sqrt((z19-pbwl9)/-pawl9);
      }
   }
  if(linhd9==0 && louthd9==0)
   {
     y19=md9*z+nd19;
     y29=md9*z19+nd19;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      y19=-bhd9*sqrt(1-((z0hd9+z)*(z0hd9+z))/(ahd9*ahd9));
      y29=-bhd9*sqrt(1-((z0hd9+z19)*(z0hd9+z19))/(ahd9*ahd9));
      }else{
      y19=-sqrt((z-pbhd9)/-pahd9);
      y29=-sqrt((z19-pbhd9)/-pahd9);
      }
   }
  if(mxl9!=-1 || myd9!=-1)line((double)x19, (double)y19, (double)z, (double)x29, (double)y29, (double)z19); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z19=(i+1)*l/imax;
  if(linwr9==0 && loutwr9==0)
  {
    x19=mr9*z+nr19;
    x29=mr9*z19+nr19;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    x19=-bwr9*sqrt(1-((z0wr9+z)*(z0wr9+z))/(awr9*awr9));
    x29=-bwr9*sqrt(1-((z0wr9+z19)*(z0wr9+z19))/(awr9*awr9));
    }else{
    x19=-sqrt((z-pbwr9)/-pawr9);
    x29=-sqrt((z19-pbwr9)/-pawr9);
    }
  }
  if(linhd9==0 && louthd9==0)
  {
    y19=md9*z+nd19;
    y29=md9*z19+nd19;
  }else{
    if(linhd9!=0 && louthd9!=0)
    {
    y19=-bhd9*sqrt(1-((z0hd9+z)*(z0hd9+z))/(ahd9*ahd9));
    y29=-bhd9*sqrt(1-((z0hd9+z19)*(z0hd9+z19))/(ahd9*ahd9));
    }else{
    y19=-sqrt((z-pbhd9)/-pahd9);
    y29=-sqrt((z19-pbhd9)/-pahd9);
    }
  }
  if(mxr9!=-1 || myd9!=-1) line((double)x19, (double)y19, (double)z, (double)x29, (double)y29, (double)z19); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z19=(i+1)*l/imax;
  if(linwr9==0 && loutwr9==0)
  {
    x19=mr9*z+nr19;
    x29=mr9*z19+nr19;
   }else{
     if(linwr9!=0 && loutwr9!=0){
     x19=-bwr9*sqrt(1-((z0wr9+z)*(z0wr9+z))/(awr9*awr9));
     x29=-bwr9*sqrt(1-((z0wr9+z19)*(z0wr9+z19))/(awr9*awr9));
     }else{
     x19=-sqrt((z-pbwr9)/-pawr9);
     x29=-sqrt((z19-pbwr9)/-pawr9);
     }
   }
   if(linhu9==0 && louthu9==0)
  {
    y19=mu9*z+nu19;
    y29=mu9*z19+nu19;
  }else{
    if(linhu9!=0 && louthu9!=0)
    {
    y19=bhu9*sqrt(1-((z0hu9+z)*(z0hu9+z))/(ahu9*ahu9));
    y29=bhu9*sqrt(1-((z0hu9+z19)*(z0hu9+z19))/(ahu9*ahu9));
    }else{
    y19=sqrt((z-pbhu9)/-pahu9);
    y29=sqrt((z19-pbhu9)/-pahu9);
    }
  }
  if(mxr9!=-1 || myu9!=-1)line((double)x19, (double)y19, (double)z, (double)x29, (double)y29, (double)z19); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z19=(i+1)*l/imax;
  if(linwl9==0 && loutwl9==0)
  {
    x19=ml9*z+nl19;
    x29=ml9*z19+nl19;
   }else{
     if(linwl9!=0 && loutwl9!=0)
     {
     x19=bwl9*sqrt(1-((z0wl9+z)*(z0wl9+z))/(awl9*awl9));
     x29=bwl9*sqrt(1-((z0wl9+z19)*(z0wl9+z19))/(awl9*awl9));
     }else{
     x19=sqrt((z-pbwl9)/-pawl9);
     x29=sqrt((z19-pbwl9)/-pawl9);
     }
   }
   if(linhu9==0 && louthu9==0)
  {
    y19=mu9*z+nu19;
    y29=mu9*z19+nu19;
  }else{
    if(linhu9!=0 && louthu9!=0)
    {
    y19=bhu9*sqrt(1-((z0hu9+z)*(z0hu9+z))/(ahu9*ahu9));
    y29=bhu9*sqrt(1-((z0hu9+z19)*(z0hu9+z19))/(ahu9*ahu9));
    }else{
    y19=sqrt((z-pbhu9)/-pahu9);
    y29=sqrt((z19-pbhu9)/-pahu9);
    }
  }
  if(mxl9!=-1 || myu9!=-1)line((double)x19, (double)y19, (double)z, (double)x29, (double)y29, (double)z19); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z19=(i+1)*l/imax;
  if(linwl9==0 && loutwl9 == 0)
   {
     xwt9=ml9*z+nl29;
     x1wt9=ml9*z19+nl29;
   }else{
      if(linwl9!=0 && loutwl9 != 0)
      {
      xwt9=bwlwt9*sqrt(1-((z0wl9+z)*(z0wl9+z))/(awlwt9*awlwt9));
      x1wt9=bwlwt9*sqrt(1-((z0wl9+z19)*(z0wl9+z19))/(awlwt9*awlwt9));
      }else{
      xwt9=sqrt((z-pbwlwt9)/-pawlwt9);
      x1wt9=sqrt((z19-pbwlwt9)/-pawlwt9);
      }
   }
  if(linhd9==0 && louthd9==0)
   {
     ywt9=md9*z+nd29;
     y1wt9=md9*z19+nd29;
    }else{
      if(linhd9!=0 && louthd9!=0)
      {
      ywt9=-bhdwt9*sqrt(1-((z0hd9+z)*(z0hd9+z))/(ahdwt9*ahdwt9));
      y1wt9=-bhdwt9*sqrt(1-((z0hd9+z19)*(z0hd9+z19))/(ahdwt9*ahdwt9));
      }else{
      ywt9=-sqrt((z-pbhdwt9)/-pahdwt9);
      y1wt9=-sqrt((z19-pbhdwt9)/-pahdwt9);
      }
   }
  if(mxlOW9!=-1 || mydOW9!=-1)line((double)xwt9, (double)ywt9, (double)z, (double)x1wt9, (double)y1wt9, (double)z19); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z19=(i+1)*l/imax;
  if(linwr9==0 && loutwr9==0)
  {
    xwt9=mr9*z+nr29;
    x1wt9=mr9*z19+nr29;
  }else{
    if(linwr9!=0 && loutwr9!=0)
    {
    xwt9=-bwrwt9*sqrt(1-((z0wr9+z)*(z0wr9+z))/(awrwt9*awrwt9));
    x1wt9=-bwrwt9*sqrt(1-((z0wr9+z19)*(z0wr9+z19))/(awrwt9*awrwt9));
    }else{
    xwt9=-sqrt((z-pbwrwt9)/-pawrwt9);
    x1wt9=-sqrt((z19-pbwrwt9)/-pawrwt9);
    }
  }
  if(linhd9==0 && louthd9==0)
  {
    ywt9=md9*z+nd29;
    y1wt9=md9*z19+nd29;
  }else{
    if(linhd9!=0 && louthd9!=0)
    {
    ywt9=-bhdwt9*sqrt(1-((z0hd9+z)*(z0hd9+z))/(ahdwt9*ahdwt9));
    y1wt9=-bhdwt9*sqrt(1-((z0hd9+z19)*(z0hd9+z19))/(ahdwt9*ahdwt9));
    }else{
    ywt9=-sqrt((z-pbhdwt9)/-pahdwt9);
    y1wt9=-sqrt((z19-pbhdwt9)/-pahdwt9);
    }
  }
  if(mxrOW9!=-1 || mydOW9!=-1) line((double)xwt9, (double)ywt9, (double)z, (double)x1wt9, (double)y1wt9, (double)z19); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z19=(i+1)*l/imax;
  if(linwr9==0 && loutwr9==0)
  {
    xwt9=mr9*z+nr29;
    x1wt9=mr9*z19+nr29;
   }else{
     if(linwr9!=0 && loutwr9!=0){
     xwt9=-bwrwt9*sqrt(1-((z0wr9+z)*(z0wr9+z))/(awrwt9*awrwt9));
     x1wt9=-bwrwt9*sqrt(1-((z0wr9+z19)*(z0wr9+z19))/(awrwt9*awrwt9));
     }else{
     xwt9=-sqrt((z-pbwrwt9)/-pawrwt9);
     x1wt9=-sqrt((z19-pbwrwt9)/-pawrwt9);
     }
   }
   if(linhu9==0 && louthu9==0)
  {
    ywt9=mu9*z+nu29;
    y1wt9=mu9*z19+nu29;
  }else{
    if(linhu9!=0 && louthu9!=0)
    {
    ywt9=bhuwt9*sqrt(1-((z0hu9+z)*(z0hu9+z))/(ahuwt9*ahuwt9));
    y1wt9=bhuwt9*sqrt(1-((z0hu9+z19)*(z0hu9+z19))/(ahuwt9*ahuwt9));
    }else{
    ywt9=sqrt((z-pbhuwt9)/-pahuwt9);
    y1wt9=sqrt((z19-pbhuwt9)/-pahuwt9);
    }
  }
   if(mxrOW9!=-1 || myuOW9!=-1)line((double)xwt9, (double)ywt9, (double)z, (double)x1wt9, (double)y1wt9, (double)z19); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z19=(i+1)*l/imax;
  if(linwl9==0 && loutwl9==0)
  {
    xwt9=ml9*z+nl29;
    x1wt9=ml9*z19+nl29;
   }else{
     if(linwl9!=0 && loutwl9!=0)
     {
     xwt9=bwlwt9*sqrt(1-((z0wl9+z)*(z0wl9+z))/(awlwt9*awlwt9));
     x1wt9=bwlwt9*sqrt(1-((z0wl9+z19)*(z0wl9+z19))/(awlwt9*awlwt9));
     }else{
     xwt9=sqrt((z-pbwlwt9)/-pawlwt9);
     x1wt9=sqrt((z19-pbwlwt9)/-pawlwt9);
     }
   }
   if(linhu9==0 && louthu9==0)
  {
    ywt9=mu9*z+nu29;
    y1wt9=mu9*z19+nu29;
  }else{
    if(linhu9!=0 && louthu9!=0)
    {
    ywt9=bhuwt9*sqrt(1-((z0hu9+z)*(z0hu9+z))/(ahuwt9*ahuwt9));
    y1wt9=bhuwt9*sqrt(1-((z0hu9+z19)*(z0hu9+z19))/(ahuwt9*ahuwt9));
    }else{
    ywt9=sqrt((z-pbhuwt9)/-pahuwt9);
    y1wt9=sqrt((z19-pbhuwt9)/-pahuwt9);
    }
  }
  if(mxlOW9!=-1 || myuOW9!=-1)line((double)xwt9, (double)ywt9, (double)z, (double)x1wt9, (double)y1wt9, (double)z19); 
}

  if (linwr10==0 && loutwr10==0){
   mr10=(-w2r10+w1r10)/l;
   nr110=-w1r10;
   nr210=-(w1rwt10);
   }


if (linwl10==0 && loutwl10==0){
   ml10=(w2l10-w1l10)/l;
   nl110=w1l10;
   nl210=(w1lwt10);
   }


if (linhu10 == 0 && louthu10==0) 
  {
   mu10=(h2u10-h1u10)/l;
   nu110=h1u10;
   nu210=(h1uwt10);
  }


if (linhd10 == 0 && louthd10==0) 
  {
   md10=(-h2d10+h1d10)/l;
   nd110=-h1d10;
   nd210=-(h1dwt10);
  }

  z0wr10=(linwr10-l-loutwr10)/2.0;
  z0wl10=(linwl10-l-loutwl10)/2.0;
  z0hu10=lbhu10/2.0-l-louthu10;
  z0hd10=lbhd10/2.0-l-louthd10;

  z0wr1=(linwr1-l-loutwr1)/2.0;
  z0wl1=(linwl1-l-loutwl1)/2.0;
  z0hu1=lbhu1/2.0-l-louthu1;
  z0hd1=lbhd1/2.0-l-louthd1;

  if(myd10!=-1) line(w1l10, -h1d10, 0.0, -w1r10, -h1d10, 0.0);							/* entrance window given by the INNER walls*/
  if(myu10!=-1)line(w1l10, h1u10, 0.0, -w1r10, h1u10, 0.0);
  if(mxl10!=-1)line(w1l10, -h1d10, 0.0, w1l10, h1u10, 0.0);
  if(mxr10!=-1)line( -w1r10, h1u10, 0.0, -w1r10, -h1d10, 0.0);

  if(myd10!=-1)line(w2l10, -h2d10, l, -w2r10, -h2d10, l);								/* exit window given by the INNER walls*/
  if(myu10!=-1)line(w2l10, h2u10,  l, -w2r10, h2u10, l);
  if(mxl10!=-1)line(w2l10, -h2d10, l, w2l10, h2u10, l);
  if(mxr10!=-1)line( -w2r10, -h2d10,  l, -w2r10, h2u10, l);

  if(mydOW10!=-1) line((w1lwt10), -(h1dwt10), 0.0, -(w1rwt10), -(h1dwt10), 0.0);					/* entrance window given by the OUTER walls */
  if(myuOW10!=-1)line((w1lwt10), (h1uwt10), 0.0, -(w1rwt10), (h1uwt10), 0.0);
  if(mxlOW10!=-1)line((w1lwt10), -(h1dwt10), 0.0, (w1lwt10), (h1uwt10), 0.0);
  if(mxrOW10!=-1)line( -(w1rwt10), (h1uwt10), 0.0, -(w1rwt10), -(h1dwt10), 0.0);

  if(mydOW10!=-1)line((w2lwt10), -(h2dwt10), l, -(w2rwt10), -(h2dwt10), l);					/* exit windows given by the OUTER walls*/
  if(myuOW10!=-1)line((w2lwt10), (h2uwt10),  l, -(w2rwt10), (h2uwt10), l);
  if(mxlOW10!=-1)line((w2lwt10), -(h2dwt10), l, (w2lwt10), (h2uwt10), l);
  if(mxrOW10!=-1)line( -(w2rwt10), -(h2dwt10),  l, -(w2rwt10), (h2uwt10), l);

  if((myd10!=-1 && mydOW10!=-1) || (mxl10!=-1 && mxlOW10!=-1)) line(w1l10, -h1d10, 0.0, (w1lwt10), -(h1dwt10), 0.0);	/* corner connection lines for the entrance windows*/	
  if((myu10!=-1 && myuOW10!=-1) || (mxl10!=-1 && mxlOW10!=-1)) line(w1l10, h1u10, 0.0, (w1lwt10), (h1uwt10), 0.0);
  if((myd10!=-1 && mydOW10!=-1) || (mxr10!=-1 && mxrOW10!=-1)) line(-w1r10, -h1d10, 0.0,-(w1rwt10),  -(h1dwt10), 0.0);
  if((myu10!=-1 && myuOW10!=-1) || (mxr10!=-1 && mxrOW10!=-1)) line( -w1r10, h1u10, 0.0, -(w1rwt10), (h1uwt10), 0.0);

  if((myd10!=-1 && mydOW10!=-1) || (mxl10!=-1 && mxlOW10!=-1)) line(w2l10, -h2d10, l, (w2lwt10), -(h2dwt10), l);	/* corner connection lines for the exit windows*/
  if((myu10!=-1 && myuOW10!=-1) || (mxl10!=-1 && mxlOW10!=-1)) line(w2l10, h2u10, l, (w2lwt10), (h2uwt10), l);
  if((myd10!=-1 && mydOW10!=-1) || (mxr10!=-1 && mxrOW10!=-1)) line(-w2r10, -h2d10, l,-(w2rwt10),  -(h2dwt10), l);
  if((myu10!=-1 && myuOW10!=-1) || (mxr10!=-1 && mxrOW10!=-1)) line( -w2r10, h2u10, l, -(w2rwt10), (h2uwt10), l);

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT BOTTOM line */
   z=i*l/imax;
   z110=(i+1)*l/imax;
  if(linwl10==0 && loutwl10 == 0)
   {
     x110=ml10*z+nl110;
     x210=ml10*z110+nl110;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      x110=bwl10*sqrt(1-((z0wl10+z)*(z0wl10+z))/(awl10*awl10));
      x210=bwl10*sqrt(1-((z0wl10+z110)*(z0wl10+z110))/(awl10*awl10));
      }else{
      x110=sqrt((z-pbwl10)/-pawl10);
      x210=sqrt((z110-pbwl10)/-pawl10);
      }
   }
  if(linhd10==0 && louthd10==0)
   {
     y110=md10*z+nd110;
     y210=md10*z110+nd110;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      y110=-bhd10*sqrt(1-((z0hd10+z)*(z0hd10+z))/(ahd10*ahd10));
      y210=-bhd10*sqrt(1-((z0hd10+z110)*(z0hd10+z110))/(ahd10*ahd10));
      }else{
      y110=-sqrt((z-pbhd10)/-pahd10);
      y210=-sqrt((z110-pbhd10)/-pahd10);
      }
   }
  if(mxl10!=-1 || myd10!=-1)line((double)x110, (double)y110, (double)z, (double)x210, (double)y210, (double)z110); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT BOTTOM line */
  z=i*l/imax;
  z110=(i+1)*l/imax;
  if(linwr10==0 && loutwr10==0)
  {
    x110=mr10*z+nr110;
    x210=mr10*z110+nr110;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    x110=-bwr10*sqrt(1-((z0wr10+z)*(z0wr10+z))/(awr10*awr10));
    x210=-bwr10*sqrt(1-((z0wr10+z110)*(z0wr10+z110))/(awr10*awr10));
    }else{
    x110=-sqrt((z-pbwr10)/-pawr10);
    x210=-sqrt((z110-pbwr10)/-pawr10);
    }
  }
  if(linhd10==0 && louthd10==0)
  {
    y110=md10*z+nd110;
    y210=md10*z110+nd110;
  }else{
    if(linhd10!=0 && louthd10!=0)
    {
    y110=-bhd10*sqrt(1-((z0hd10+z)*(z0hd10+z))/(ahd10*ahd10));
    y210=-bhd10*sqrt(1-((z0hd10+z110)*(z0hd10+z110))/(ahd10*ahd10));
    }else{
    y110=-sqrt((z-pbhd10)/-pahd10);
    y210=-sqrt((z110-pbhd10)/-pahd10);
    }
  }
  if(mxr10!=-1 || myd10!=-1) line((double)x110, (double)y110, (double)z, (double)x210, (double)y210, (double)z110); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the INNER RIGHT TOP line */
  z=i*l/imax;
  z110=(i+1)*l/imax;
  if(linwr10==0 && loutwr10==0)
  {
    x110=mr10*z+nr110;
    x210=mr10*z110+nr110;
   }else{
     if(linwr10!=0 && loutwr10!=0){
     x110=-bwr10*sqrt(1-((z0wr10+z)*(z0wr10+z))/(awr10*awr10));
     x210=-bwr10*sqrt(1-((z0wr10+z110)*(z0wr10+z110))/(awr10*awr10));
     }else{
     x110=-sqrt((z-pbwr10)/-pawr10);
     x210=-sqrt((z110-pbwr10)/-pawr10);
     }
   }
   if(linhu10==0 && louthu10==0)
  {
    y110=mu10*z+nu110;
    y210=mu10*z110+nu110;
  }else{
    if(linhu10!=0 && louthu10!=0)
    {
    y110=bhu10*sqrt(1-((z0hu10+z)*(z0hu10+z))/(ahu10*ahu10));
    y210=bhu10*sqrt(1-((z0hu10+z110)*(z0hu10+z110))/(ahu10*ahu10));
    }else{
    y110=sqrt((z-pbhu10)/-pahu10);
    y210=sqrt((z110-pbhu10)/-pahu10);
    }
  }
  if(mxr10!=-1 || myu10!=-1)line((double)x110, (double)y110, (double)z, (double)x210, (double)y210, (double)z110); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the INNER LEFT TOP line */
  z=i*l/imax;
  z110=(i+1)*l/imax;
  if(linwl10==0 && loutwl10==0)
  {
    x110=ml10*z+nl110;
    x210=ml10*z110+nl110;
   }else{
     if(linwl10!=0 && loutwl10!=0)
     {
     x110=bwl10*sqrt(1-((z0wl10+z)*(z0wl10+z))/(awl10*awl10));
     x210=bwl10*sqrt(1-((z0wl10+z110)*(z0wl10+z110))/(awl10*awl10));
     }else{
     x110=sqrt((z-pbwl10)/-pawl10);
     x210=sqrt((z110-pbwl10)/-pawl10);
     }
   }
   if(linhu10==0 && louthu10==0)
  {
    y110=mu10*z+nu110;
    y210=mu10*z110+nu110;
  }else{
    if(linhu10!=0 && louthu10!=0)
    {
    y110=bhu10*sqrt(1-((z0hu10+z)*(z0hu10+z))/(ahu10*ahu10));
    y210=bhu10*sqrt(1-((z0hu10+z110)*(z0hu10+z110))/(ahu10*ahu10));
    }else{
    y110=sqrt((z-pbhu10)/-pahu10);
    y210=sqrt((z110-pbhu10)/-pahu10);
    }
  }
  if(mxl10!=-1 || myu10!=-1)line((double)x110, (double)y110, (double)z, (double)x210, (double)y210, (double)z110); 
}																	/* END INNER LINES*/


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT BOTTOM line */
   z=i*l/imax;
   z110=(i+1)*l/imax;
  if(linwl10==0 && loutwl10 == 0)
   {
     xwt10=ml10*z+nl210;
     x1wt10=ml10*z110+nl210;
   }else{
      if(linwl10!=0 && loutwl10 != 0)
      {
      xwt10=bwlwt10*sqrt(1-((z0wl10+z)*(z0wl10+z))/(awlwt10*awlwt10));
      x1wt10=bwlwt10*sqrt(1-((z0wl10+z110)*(z0wl10+z110))/(awlwt10*awlwt10));
      }else{
      xwt10=sqrt((z-pbwlwt10)/-pawlwt10);
      x1wt10=sqrt((z110-pbwlwt10)/-pawlwt10);
      }
   }
  if(linhd10==0 && louthd10==0)
   {
     ywt10=md10*z+nd210;
     y1wt10=md10*z110+nd210;
    }else{
      if(linhd10!=0 && louthd10!=0)
      {
      ywt10=-bhdwt10*sqrt(1-((z0hd10+z)*(z0hd10+z))/(ahdwt10*ahdwt10));
      y1wt10=-bhdwt10*sqrt(1-((z0hd10+z110)*(z0hd10+z110))/(ahdwt10*ahdwt10));
      }else{
      ywt10=-sqrt((z-pbhdwt10)/-pahdwt10);
      y1wt10=-sqrt((z110-pbhdwt10)/-pahdwt10);
      }
   }
  if(mxlOW10!=-1 || mydOW10!=-1)line((double)xwt10, (double)ywt10, (double)z, (double)x1wt10, (double)y1wt10, (double)z110); 
 }

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT BOTTOM line */
  z=i*l/imax;
  z110=(i+1)*l/imax;
  if(linwr10==0 && loutwr10==0)
  {
    xwt10=mr10*z+nr210;
    x1wt10=mr10*z110+nr210;
  }else{
    if(linwr10!=0 && loutwr10!=0)
    {
    xwt10=-bwrwt10*sqrt(1-((z0wr10+z)*(z0wr10+z))/(awrwt10*awrwt10));
    x1wt10=-bwrwt10*sqrt(1-((z0wr10+z110)*(z0wr10+z110))/(awrwt10*awrwt10));
    }else{
    xwt10=-sqrt((z-pbwrwt10)/-pawrwt10);
    x1wt10=-sqrt((z110-pbwrwt10)/-pawrwt10);
    }
  }
  if(linhd10==0 && louthd10==0)
  {
    ywt10=md10*z+nd210;
    y1wt10=md10*z110+nd210;
  }else{
    if(linhd10!=0 && louthd10!=0)
    {
    ywt10=-bhdwt10*sqrt(1-((z0hd10+z)*(z0hd10+z))/(ahdwt10*ahdwt10));
    y1wt10=-bhdwt10*sqrt(1-((z0hd10+z110)*(z0hd10+z110))/(ahdwt10*ahdwt10));
    }else{
    ywt10=-sqrt((z-pbhdwt10)/-pahdwt10);
    y1wt10=-sqrt((z110-pbhdwt10)/-pahdwt10);
    }
  }
  if(mxrOW10!=-1 || mydOW10!=-1) line((double)xwt10, (double)ywt10, (double)z, (double)x1wt10, (double)y1wt10, (double)z110); 
}


for(i=0;i<imax;i++){											/* calculation of the points for the OUTER RIGHT TOP line */
  z=i*l/imax;
  z110=(i+1)*l/imax;
  if(linwr10==0 && loutwr10==0)
  {
    xwt10=mr10*z+nr210;
    x1wt10=mr10*z110+nr210;
   }else{
     if(linwr10!=0 && loutwr10!=0){
     xwt10=-bwrwt10*sqrt(1-((z0wr10+z)*(z0wr10+z))/(awrwt10*awrwt10));
     x1wt10=-bwrwt10*sqrt(1-((z0wr10+z110)*(z0wr10+z110))/(awrwt10*awrwt10));
     }else{
     xwt10=-sqrt((z-pbwrwt10)/-pawrwt10);
     x1wt10=-sqrt((z110-pbwrwt10)/-pawrwt10);
     }
   }
   if(linhu10==0 && louthu10==0)
  {
    ywt10=mu10*z+nu210;
    y1wt10=mu10*z110+nu210;
  }else{
    if(linhu10!=0 && louthu10!=0)
    {
    ywt10=bhuwt10*sqrt(1-((z0hu10+z)*(z0hu10+z))/(ahuwt10*ahuwt10));
    y1wt10=bhuwt10*sqrt(1-((z0hu10+z110)*(z0hu10+z110))/(ahuwt10*ahuwt10));
    }else{
    ywt10=sqrt((z-pbhuwt10)/-pahuwt10);
    y1wt10=sqrt((z110-pbhuwt10)/-pahuwt10);
    }
  }
   if(mxrOW10!=-1 || myuOW10!=-1)line((double)xwt10, (double)ywt10, (double)z, (double)x1wt10, (double)y1wt10, (double)z110); 
}

for(i=0;i<imax;i++){											/* calculation of the points for the OUTER LEFT TOP line */
  z=i*l/imax;
  z110=(i+1)*l/imax;
  if(linwl10==0 && loutwl10==0)
  {
    xwt10=ml10*z+nl210;
    x1wt10=ml10*z110+nl210;
   }else{
     if(linwl10!=0 && loutwl10!=0)
     {
     xwt10=bwlwt10*sqrt(1-((z0wl10+z)*(z0wl10+z))/(awlwt10*awlwt10));
     x1wt10=bwlwt10*sqrt(1-((z0wl10+z110)*(z0wl10+z110))/(awlwt10*awlwt10));
     }else{
     xwt10=sqrt((z-pbwlwt10)/-pawlwt10);
     x1wt10=sqrt((z110-pbwlwt10)/-pawlwt10);
     }
   }
   if(linhu10==0 && louthu10==0)
  {
    ywt10=mu10*z+nu210;
    y1wt10=mu10*z110+nu210;
  }else{
    if(linhu10!=0 && louthu10!=0)
    {
    ywt10=bhuwt10*sqrt(1-((z0hu10+z)*(z0hu10+z))/(ahuwt10*ahuwt10));
    y1wt10=bhuwt10*sqrt(1-((z0hu10+z110)*(z0hu10+z110))/(ahuwt10*ahuwt10));
    }else{
    ywt10=sqrt((z-pbhuwt10)/-pahuwt10);
    y1wt10=sqrt((z110-pbhuwt10)/-pahuwt10);
    }
  }
  if(mxlOW10!=-1 || myuOW10!=-1)line((double)xwt10, (double)ywt10, (double)z, (double)x1wt10, (double)y1wt10, (double)z110); 
}



%}

END


