MODULE BARDELL

CONTAINS

SUBROUTINE integral_ff(i, j, x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r, out)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: i, j
    REAL*8, INTENT(IN) :: x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r
    REAL*8, INTENT(OUT) :: out
    out = 0
    SELECT CASE (i)
    CASE (1)
        SELECT CASE (j)
        CASE (1)
            out = 0.742857142857143*x1t*y1t
            RETURN
        CASE (2)
            out = 0.104761904761905*x1t*y1r
            RETURN
        CASE (3)
            out = 0.257142857142857*x1t*y2t
            RETURN
        CASE (4)
            out = -0.0619047619047619*x1t*y2r
            RETURN
        CASE (5)
            out = 0.0666666666666667*x1t
            RETURN
        CASE (6)
            out = -0.0126984126984127*x1t
            RETURN
        CASE (8)
            out = 0.000288600288600289*x1t
            RETURN
        END SELECT
    CASE (2)
        SELECT CASE (j)
        CASE (1)
            out = 0.104761904761905*x1r*y1t
            RETURN
        CASE (2)
            out = 0.019047619047619*x1r*y1r
            RETURN
        CASE (3)
            out = 0.0619047619047619*x1r*y2t
            RETURN
        CASE (4)
            out = -0.0142857142857143*x1r*y2r
            RETURN
        CASE (5)
            out = 0.0142857142857143*x1r
            RETURN
        CASE (6)
            out = -0.00158730158730159*x1r
            RETURN
        CASE (7)
            out = -0.000529100529100529*x1r
            RETURN
        CASE (8)
            out = 0.000144300144300144*x1r
            RETURN
        END SELECT
    CASE (3)
        SELECT CASE (j)
        CASE (1)
            out = 0.257142857142857*x2t*y1t
            RETURN
        CASE (2)
            out = 0.0619047619047619*x2t*y1r
            RETURN
        CASE (3)
            out = 0.742857142857143*x2t*y2t
            RETURN
        CASE (4)
            out = -0.104761904761905*x2t*y2r
            RETURN
        CASE (5)
            out = 0.0666666666666667*x2t
            RETURN
        CASE (6)
            out = 0.0126984126984127*x2t
            RETURN
        CASE (8)
            out = -0.000288600288600289*x2t
            RETURN
        END SELECT
    CASE (4)
        SELECT CASE (j)
        CASE (1)
            out = -0.0619047619047619*x2r*y1t
            RETURN
        CASE (2)
            out = -0.0142857142857143*x2r*y1r
            RETURN
        CASE (3)
            out = -0.104761904761905*x2r*y2t
            RETURN
        CASE (4)
            out = 0.019047619047619*x2r*y2r
            RETURN
        CASE (5)
            out = -0.0142857142857143*x2r
            RETURN
        CASE (6)
            out = -0.00158730158730159*x2r
            RETURN
        CASE (7)
            out = 0.000529100529100529*x2r
            RETURN
        CASE (8)
            out = 0.000144300144300144*x2r
            RETURN
        END SELECT
    CASE (5)
        SELECT CASE (j)
        CASE (1)
            out = 0.0666666666666667*y1t
            RETURN
        CASE (2)
            out = 0.0142857142857143*y1r
            RETURN
        CASE (3)
            out = 0.0666666666666667*y2t
            RETURN
        CASE (4)
            out = -0.0142857142857143*y2r
            RETURN
        CASE (5)
            out = 0.0126984126984127
            RETURN
        CASE (7)
            out = -0.000769600769600770
            RETURN
        CASE (9)
            out = 4.44000444000444e-5
            RETURN
        END SELECT
    CASE (6)
        SELECT CASE (j)
        CASE (1)
            out = -0.0126984126984127*y1t
            RETURN
        CASE (2)
            out = -0.00158730158730159*y1r
            RETURN
        CASE (3)
            out = 0.0126984126984127*y2t
            RETURN
        CASE (4)
            out = -0.00158730158730159*y2r
            RETURN
        CASE (6)
            out = 0.00115440115440115
            RETURN
        CASE (8)
            out = -0.000177600177600178
            RETURN
        CASE (10)
            out = 1.48000148000148e-5
            RETURN
        END SELECT
    CASE (7)
        SELECT CASE (j)
        CASE (2)
            out = -0.000529100529100529*y1r
            RETURN
        CASE (4)
            out = 0.000529100529100529*y2r
            RETURN
        CASE (5)
            out = -0.000769600769600770
            RETURN
        CASE (7)
            out = 0.000266400266400266
            RETURN
        CASE (9)
            out = -5.92000592000592e-5
            RETURN
        CASE (11)
            out = 6.09412374118256e-6
            RETURN
        END SELECT
    CASE (8)
        SELECT CASE (j)
        CASE (1)
            out = 0.000288600288600289*y1t
            RETURN
        CASE (2)
            out = 0.000144300144300144*y1r
            RETURN
        CASE (3)
            out = -0.000288600288600289*y2t
            RETURN
        CASE (4)
            out = 0.000144300144300144*y2r
            RETURN
        CASE (6)
            out = -0.000177600177600178
            RETURN
        CASE (8)
            out = 8.88000888000888e-5
            RETURN
        CASE (10)
            out = -2.43764949647303e-5
            RETURN
        CASE (12)
            out = 2.88669019319174e-6
            RETURN
        END SELECT
    CASE (9)
        SELECT CASE (j)
        CASE (5)
            out = 4.44000444000444e-5
            RETURN
        CASE (7)
            out = -5.92000592000592e-5
            RETURN
        CASE (9)
            out = 3.65647424470954e-5
            RETURN
        CASE (11)
            out = -1.15467607727670e-5
            RETURN
        CASE (13)
            out = 1.51207581548139e-6
            RETURN
        END SELECT
    CASE (10)
        SELECT CASE (j)
        CASE (6)
            out = 1.48000148000148e-5
            RETURN
        CASE (8)
            out = -2.43764949647303e-5
            RETURN
        CASE (10)
            out = 1.73201411591504e-5
            RETURN
        CASE (12)
            out = -6.04830326192555e-6
            RETURN
        CASE (14)
            out = 8.54651547880785e-7
            RETURN
        END SELECT
    CASE (11)
        SELECT CASE (j)
        CASE (7)
            out = 6.09412374118256e-6
            RETURN
        CASE (9)
            out = -1.15467607727670e-5
            RETURN
        CASE (11)
            out = 9.07245489288833e-6
            RETURN
        CASE (13)
            out = -3.41860619152314e-6
            RETURN
        CASE (15)
            out = 5.12790928728471e-7
            RETURN
        END SELECT
    CASE (12)
        SELECT CASE (j)
        CASE (8)
            out = 2.88669019319174e-6
            RETURN
        CASE (10)
            out = -6.04830326192555e-6
            RETURN
        CASE (12)
            out = 5.12790928728471e-6
            RETURN
        CASE (14)
            out = -2.05116371491388e-6
            RETURN
        CASE (16)
            out = 3.22868362532741e-7
            RETURN
        END SELECT
    CASE (13)
        SELECT CASE (j)
        CASE (9)
            out = 1.51207581548139e-6
            RETURN
        CASE (11)
            out = -3.41860619152314e-6
            RETURN
        CASE (13)
            out = 3.07674557237082e-6
            RETURN
        CASE (15)
            out = -1.29147345013096e-6
            RETURN
        CASE (17)
            out = 2.11534444418003e-7
            RETURN
        END SELECT
    CASE (14)
        SELECT CASE (j)
        CASE (10)
            out = 8.54651547880785e-7
            RETURN
        CASE (12)
            out = -2.05116371491388e-6
            RETURN
        CASE (14)
            out = 1.93721017519645e-6
            RETURN
        CASE (16)
            out = -8.46137777672011e-7
            RETURN
        CASE (18)
            out = 1.43297526863808e-7
            RETURN
        END SELECT
    CASE (15)
        SELECT CASE (j)
        CASE (11)
            out = 5.12790928728471e-7
            RETURN
        CASE (13)
            out = -1.29147345013096e-6
            RETURN
        CASE (15)
            out = 1.26920666650802e-6
            RETURN
        CASE (17)
            out = -5.73190107455233e-7
            RETURN
        CASE (19)
            out = 9.98740338747754e-8
            RETURN
        END SELECT
    CASE (16)
        SELECT CASE (j)
        CASE (12)
            out = 3.22868362532741e-7
            RETURN
        CASE (14)
            out = -8.46137777672011e-7
            RETURN
        CASE (16)
            out = 8.59785161182849e-7
            RETURN
        CASE (18)
            out = -3.99496135499102e-7
            RETURN
        CASE (20)
            out = 7.13385956248396e-8
            RETURN
        END SELECT
    CASE (17)
        SELECT CASE (j)
        CASE (13)
            out = 2.11534444418003e-7
            RETURN
        CASE (15)
            out = -5.73190107455233e-7
            RETURN
        CASE (17)
            out = 5.99244203248653e-7
            RETURN
        CASE (19)
            out = -2.85354382499358e-7
            RETURN
        CASE (21)
            out = 5.20578941046127e-8
            RETURN
        END SELECT
    CASE (18)
        SELECT CASE (j)
        CASE (14)
            out = 1.43297526863808e-7
            RETURN
        CASE (16)
            out = -3.99496135499102e-7
            RETURN
        CASE (18)
            out = 4.28031573749038e-7
            RETURN
        CASE (20)
            out = -2.08231576418451e-7
            RETURN
        CASE (22)
            out = 3.87097161290710e-8
            RETURN
        END SELECT
    CASE (19)
        SELECT CASE (j)
        CASE (15)
            out = 9.98740338747754e-8
            RETURN
        CASE (17)
            out = -2.85354382499358e-7
            RETURN
        CASE (19)
            out = 3.12347364627676e-7
            RETURN
        CASE (21)
            out = -1.54838864516284e-7
            RETURN
        CASE (23)
            out = 2.92683219512488e-8
            RETURN
        END SELECT
    CASE (20)
        SELECT CASE (j)
        CASE (16)
            out = 7.13385956248396e-8
            RETURN
        CASE (18)
            out = -2.08231576418451e-7
            RETURN
        CASE (20)
            out = 2.32258296774426e-7
            RETURN
        CASE (22)
            out = -1.17073287804995e-7
            RETURN
        CASE (24)
            out = 2.24617354509584e-8
            RETURN
        END SELECT
    CASE (21)
        SELECT CASE (j)
        CASE (17)
            out = 5.20578941046127e-8
            RETURN
        CASE (19)
            out = -1.54838864516284e-7
            RETURN
        CASE (21)
            out = 1.75609931707493e-7
            RETURN
        CASE (23)
            out = -8.98469418038335e-8
            RETURN
        CASE (25)
            out = 1.74702386840787e-8
            RETURN
        END SELECT
    CASE (22)
        SELECT CASE (j)
        CASE (18)
            out = 3.87097161290710e-8
            RETURN
        CASE (20)
            out = -1.17073287804995e-7
            RETURN
        CASE (22)
            out = 1.34770412705750e-7
            RETURN
        CASE (24)
            out = -6.98809547363149e-8
            RETURN
        CASE (26)
            out = 1.37531666236364e-8
            RETURN
        END SELECT
    CASE (23)
        SELECT CASE (j)
        CASE (19)
            out = 2.92683219512488e-8
            RETURN
        CASE (21)
            out = -8.98469418038335e-8
            RETURN
        CASE (23)
            out = 1.04821432104472e-7
            RETURN
        CASE (25)
            out = -5.50126664945458e-8
            RETURN
        CASE (27)
            out = 1.09463979249351e-8
            RETURN
        END SELECT
    CASE (24)
        SELECT CASE (j)
        CASE (20)
            out = 2.24617354509584e-8
            RETURN
        CASE (22)
            out = -6.98809547363149e-8
            RETURN
        CASE (24)
            out = 8.25189997418187e-8
            RETURN
        CASE (26)
            out = -4.37855916997405e-8
            RETURN
        CASE (28)
            out = 8.80004539063412e-9
            RETURN
        END SELECT
    CASE (25)
        SELECT CASE (j)
        CASE (21)
            out = 1.74702386840787e-8
            RETURN
        CASE (23)
            out = -5.50126664945458e-8
            RETURN
        CASE (25)
            out = 6.56783875496108e-8
            RETURN
        CASE (27)
            out = -3.52001815625365e-8
            RETURN
        CASE (29)
            out = 7.13965946787297e-9
            RETURN
        END SELECT
    CASE (26)
        SELECT CASE (j)
        CASE (22)
            out = 1.37531666236364e-8
            RETURN
        CASE (24)
            out = -4.37855916997405e-8
            RETURN
        CASE (26)
            out = 5.28002723438047e-8
            RETURN
        CASE (28)
            out = -2.85586378714919e-8
            RETURN
        CASE (30)
            out = 5.84153956462334e-9
            RETURN
        END SELECT
    CASE (27)
        SELECT CASE (j)
        CASE (23)
            out = 1.09463979249351e-8
            RETURN
        CASE (25)
            out = -3.52001815625365e-8
            RETURN
        CASE (27)
            out = 4.28379568072378e-8
            RETURN
        CASE (29)
            out = -2.33661582584934e-8
            RETURN
        END SELECT
    CASE (28)
        SELECT CASE (j)
        CASE (24)
            out = 8.80004539063412e-9
            RETURN
        CASE (26)
            out = -2.85586378714919e-8
            RETURN
        CASE (28)
            out = 3.50492373877400e-8
            RETURN
        CASE (30)
            out = -1.92668322482314e-8
            RETURN
        END SELECT
    CASE (29)
        SELECT CASE (j)
        CASE (25)
            out = 7.13965946787297e-9
            RETURN
        CASE (27)
            out = -2.33661582584934e-8
            RETURN
        CASE (29)
            out = 2.89002483723470e-8
            RETURN
        END SELECT
    CASE (30)
        SELECT CASE (j)
        CASE (26)
            out = 5.84153956462334e-9
            RETURN
        CASE (28)
            out = -1.92668322482314e-8
            RETURN
        CASE (30)
            out = 2.40019011905933e-8
            RETURN
        END SELECT
    END SELECT
END SUBROUTINE integral_ff


SUBROUTINE integral_ffxi(i, j, x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r, out)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: i, j
    REAL*8, INTENT(IN) :: x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r
    REAL*8, INTENT(OUT) :: out
    out = 0
    SELECT CASE (i)
    CASE (1)
        SELECT CASE (j)
        CASE (1)
            out = -0.5*x1t*y1t
            RETURN
        CASE (2)
            out = 0.1*x1t*y1r
            RETURN
        CASE (3)
            out = 0.5*x1t*y2t
            RETURN
        CASE (4)
            out = -0.1*x1t*y2r
            RETURN
        CASE (5)
            out = 0.0857142857142857*x1t
            RETURN
        CASE (7)
            out = -0.00317460317460317*x1t
            RETURN
        END SELECT
    CASE (2)
        SELECT CASE (j)
        CASE (1)
            out = -0.1*x1r*y1t
            RETURN
        CASE (3)
            out = 0.1*x1r*y2t
            RETURN
        CASE (4)
            out = -0.0166666666666667*x1r*y2r
            RETURN
        CASE (5)
            out = 0.00952380952380952*x1r
            RETURN
        CASE (6)
            out = 0.00476190476190476*x1r
            RETURN
        CASE (7)
            out = -0.00158730158730159*x1r
            RETURN
        END SELECT
    CASE (3)
        SELECT CASE (j)
        CASE (1)
            out = -0.5*x2t*y1t
            RETURN
        CASE (2)
            out = -0.1*x2t*y1r
            RETURN
        CASE (3)
            out = 0.5*x2t*y2t
            RETURN
        CASE (4)
            out = 0.1*x2t*y2r
            RETURN
        CASE (5)
            out = -0.0857142857142857*x2t
            RETURN
        CASE (7)
            out = 0.00317460317460317*x2t
            RETURN
        END SELECT
    CASE (4)
        SELECT CASE (j)
        CASE (1)
            out = 0.1*x2r*y1t
            RETURN
        CASE (2)
            out = 0.0166666666666667*x2r*y1r
            RETURN
        CASE (3)
            out = -0.1*x2r*y2t
            RETURN
        CASE (5)
            out = 0.00952380952380952*x2r
            RETURN
        CASE (6)
            out = -0.00476190476190476*x2r
            RETURN
        CASE (7)
            out = -0.00158730158730159*x2r
            RETURN
        END SELECT
    CASE (5)
        SELECT CASE (j)
        CASE (1)
            out = -0.0857142857142857*y1t
            RETURN
        CASE (2)
            out = -0.00952380952380952*y1r
            RETURN
        CASE (3)
            out = 0.0857142857142857*y2t
            RETURN
        CASE (4)
            out = -0.00952380952380952*y2r
            RETURN
        CASE (6)
            out = 0.00634920634920635
            RETURN
        CASE (8)
            out = -0.000577200577200577
            RETURN
        END SELECT
    CASE (6)
        SELECT CASE (j)
        CASE (2)
            out = -0.00476190476190476*y1r
            RETURN
        CASE (4)
            out = 0.00476190476190476*y2r
            RETURN
        CASE (5)
            out = -0.00634920634920635
            RETURN
        CASE (7)
            out = 0.00173160173160173
            RETURN
        CASE (9)
            out = -0.000222000222000222
            RETURN
        END SELECT
    CASE (7)
        SELECT CASE (j)
        CASE (1)
            out = 0.00317460317460317*y1t
            RETURN
        CASE (2)
            out = 0.00158730158730159*y1r
            RETURN
        CASE (3)
            out = -0.00317460317460317*y2t
            RETURN
        CASE (4)
            out = 0.00158730158730159*y2r
            RETURN
        CASE (6)
            out = -0.00173160173160173
            RETURN
        CASE (8)
            out = 0.000666000666000666
            RETURN
        CASE (10)
            out = -0.000103600103600104
            RETURN
        END SELECT
    CASE (8)
        SELECT CASE (j)
        CASE (5)
            out = 0.000577200577200577
            RETURN
        CASE (7)
            out = -0.000666000666000666
            RETURN
        CASE (9)
            out = 0.000310800310800311
            RETURN
        CASE (11)
            out = -5.48471136706431e-5
            RETURN
        END SELECT
    CASE (9)
        SELECT CASE (j)
        CASE (6)
            out = 0.000222000222000222
            RETURN
        CASE (8)
            out = -0.000310800310800311
            RETURN
        CASE (10)
            out = 0.000164541341011929
            RETURN
        CASE (12)
            out = -3.17535921251092e-5
            RETURN
        END SELECT
    CASE (10)
        SELECT CASE (j)
        CASE (7)
            out = 0.000103600103600104
            RETURN
        CASE (9)
            out = -0.000164541341011929
            RETURN
        CASE (11)
            out = 9.52607763753275e-5
            RETURN
        CASE (13)
            out = -1.96569856012580e-5
            RETURN
        END SELECT
    CASE (11)
        SELECT CASE (j)
        CASE (8)
            out = 5.48471136706431e-5
            RETURN
        CASE (10)
            out = -9.52607763753275e-5
            RETURN
        CASE (12)
            out = 5.89709568037741e-5
            RETURN
        CASE (14)
            out = -1.28197732182118e-5
            RETURN
        END SELECT
    CASE (12)
        SELECT CASE (j)
        CASE (9)
            out = 3.17535921251092e-5
            RETURN
        CASE (11)
            out = -5.89709568037741e-5
            RETURN
        CASE (13)
            out = 3.84593196546353e-5
            RETURN
        CASE (15)
            out = -8.71744578838400e-6
            RETURN
        END SELECT
    CASE (13)
        SELECT CASE (j)
        CASE (10)
            out = 1.96569856012580e-5
            RETURN
        CASE (12)
            out = -3.84593196546353e-5
            RETURN
        CASE (14)
            out = 2.61523373651520e-5
            RETURN
        CASE (16)
            out = -6.13449888812208e-6
            RETURN
        END SELECT
    CASE (14)
        SELECT CASE (j)
        CASE (11)
            out = 1.28197732182118e-5
            RETURN
        CASE (13)
            out = -2.61523373651520e-5
            RETURN
        CASE (15)
            out = 1.84034966643662e-5
            RETURN
        CASE (17)
            out = -4.44222333277806e-6
            RETURN
        END SELECT
    CASE (15)
        SELECT CASE (j)
        CASE (12)
            out = 8.71744578838400e-6
            RETURN
        CASE (14)
            out = -1.84034966643662e-5
            RETURN
        CASE (16)
            out = 1.33266699983342e-5
            RETURN
        CASE (18)
            out = -3.29584311786759e-6
            RETURN
        END SELECT
    CASE (16)
        SELECT CASE (j)
        CASE (13)
            out = 6.13449888812208e-6
            RETURN
        CASE (15)
            out = -1.33266699983342e-5
            RETURN
        CASE (17)
            out = 9.88752935360277e-6
            RETURN
        CASE (19)
            out = -2.49685084686939e-6
            RETURN
        END SELECT
    CASE (17)
        SELECT CASE (j)
        CASE (14)
            out = 4.44222333277806e-6
            RETURN
        CASE (16)
            out = -9.88752935360277e-6
            RETURN
        CASE (18)
            out = 7.49055254060816e-6
            RETURN
        CASE (20)
            out = -1.92614208187067e-6
            RETURN
        END SELECT
    CASE (18)
        SELECT CASE (j)
        CASE (15)
            out = 3.29584311786759e-6
            RETURN
        CASE (17)
            out = -7.49055254060816e-6
            RETURN
        CASE (19)
            out = 5.77842624561201e-6
            RETURN
        CASE (21)
            out = -1.50967892903377e-6
            RETURN
        END SELECT
    CASE (19)
        SELECT CASE (j)
        CASE (16)
            out = 2.49685084686939e-6
            RETURN
        CASE (18)
            out = -5.77842624561201e-6
            RETURN
        CASE (20)
            out = 4.52903678710130e-6
            RETURN
        CASE (22)
            out = -1.20000120000120e-6
            RETURN
        END SELECT
    CASE (20)
        SELECT CASE (j)
        CASE (17)
            out = 1.92614208187067e-6
            RETURN
        CASE (19)
            out = -4.52903678710130e-6
            RETURN
        CASE (21)
            out = 3.60000360000360e-6
            RETURN
        CASE (23)
            out = -9.65854624391210e-7
            RETURN
        END SELECT
    CASE (21)
        SELECT CASE (j)
        CASE (18)
            out = 1.50967892903377e-6
            RETURN
        CASE (20)
            out = -3.60000360000360e-6
            RETURN
        CASE (22)
            out = 2.89756387317363e-6
            RETURN
        CASE (24)
            out = -7.86160740783543e-7
            RETURN
        END SELECT
    CASE (22)
        SELECT CASE (j)
        CASE (19)
            out = 1.20000120000120e-6
            RETURN
        CASE (21)
            out = -2.89756387317363e-6
            RETURN
        CASE (23)
            out = 2.35848222235063e-6
            RETURN
        CASE (25)
            out = -6.46398831310913e-7
            RETURN
        END SELECT
    CASE (23)
        SELECT CASE (j)
        CASE (20)
            out = 9.65854624391210e-7
            RETURN
        CASE (22)
            out = -2.35848222235063e-6
            RETURN
        CASE (24)
            out = 1.93919649393274e-6
            RETURN
        CASE (26)
            out = -5.36373498321821e-7
            RETURN
        END SELECT
    CASE (24)
        SELECT CASE (j)
        CASE (21)
            out = 7.86160740783543e-7
            RETURN
        CASE (23)
            out = -1.93919649393274e-6
            RETURN
        CASE (25)
            out = 1.60912049496546e-6
            RETURN
        CASE (27)
            out = -4.48802314922340e-7
            RETURN
        END SELECT
    CASE (25)
        SELECT CASE (j)
        CASE (22)
            out = 6.46398831310913e-7
            RETURN
        CASE (24)
            out = -1.60912049496546e-6
            RETURN
        CASE (26)
            out = 1.34640694476702e-6
            RETURN
        CASE (28)
            out = -3.78401951797267e-7
            RETURN
        END SELECT
    CASE (26)
        SELECT CASE (j)
        CASE (23)
            out = 5.36373498321821e-7
            RETURN
        CASE (25)
            out = -1.34640694476702e-6
            RETURN
        CASE (27)
            out = 1.13520585539180e-6
            RETURN
        CASE (29)
            out = -3.21284676054284e-7
            RETURN
        END SELECT
    CASE (27)
        SELECT CASE (j)
        CASE (24)
            out = 4.48802314922340e-7
            RETURN
        CASE (26)
            out = -1.13520585539180e-6
            RETURN
        CASE (28)
            out = 9.63854028162851e-7
            RETURN
        CASE (30)
            out = -2.74552359537297e-7
            RETURN
        END SELECT
    CASE (28)
        SELECT CASE (j)
        CASE (25)
            out = 3.78401951797267e-7
            RETURN
        CASE (27)
            out = -9.63854028162851e-7
            RETURN
        CASE (29)
            out = 8.23657078611891e-7
            RETURN
        END SELECT
    CASE (29)
        SELECT CASE (j)
        CASE (26)
            out = 3.21284676054284e-7
            RETURN
        CASE (28)
            out = -8.23657078611891e-7
            RETURN
        CASE (30)
            out = 7.08056085122503e-7
            RETURN
        END SELECT
    CASE (30)
        SELECT CASE (j)
        CASE (27)
            out = 2.74552359537297e-7
            RETURN
        CASE (29)
            out = -7.08056085122503e-7
            RETURN
        END SELECT
    END SELECT
END SUBROUTINE integral_ffxi


SUBROUTINE integral_ffxixi(i, j, x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r, out)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: i, j
    REAL*8, INTENT(IN) :: x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r
    REAL*8, INTENT(OUT) :: out
    out = 0
    SELECT CASE (i)
    CASE (1)
        SELECT CASE (j)
        CASE (1)
            out = -0.6*x1t*y1t
            RETURN
        CASE (2)
            out = -0.55*x1t*y1r
            RETURN
        CASE (3)
            out = 0.6*x1t*y2t
            RETURN
        CASE (4)
            out = -0.05*x1t*y2r
            RETURN
        CASE (6)
            out = 0.0285714285714286*x1t
            RETURN
        END SELECT
    CASE (2)
        SELECT CASE (j)
        CASE (1)
            out = -0.05*x1r*y1t
            RETURN
        CASE (2)
            out = -0.0666666666666667*x1r*y1r
            RETURN
        CASE (3)
            out = 0.05*x1r*y2t
            RETURN
        CASE (4)
            out = 0.0166666666666667*x1r*y2r
            RETURN
        CASE (5)
            out = -0.0333333333333333*x1r
            RETURN
        CASE (6)
            out = 0.0142857142857143*x1r
            RETURN
        END SELECT
    CASE (3)
        SELECT CASE (j)
        CASE (1)
            out = 0.6*x2t*y1t
            RETURN
        CASE (2)
            out = 0.05*x2t*y1r
            RETURN
        CASE (3)
            out = -0.6*x2t*y2t
            RETURN
        CASE (4)
            out = 0.55*x2t*y2r
            RETURN
        CASE (6)
            out = -0.0285714285714286*x2t
            RETURN
        END SELECT
    CASE (4)
        SELECT CASE (j)
        CASE (1)
            out = -0.05*x2r*y1t
            RETURN
        CASE (2)
            out = 0.0166666666666667*x2r*y1r
            RETURN
        CASE (3)
            out = 0.05*x2r*y2t
            RETURN
        CASE (4)
            out = -0.0666666666666667*x2r*y2r
            RETURN
        CASE (5)
            out = 0.0333333333333333*x2r
            RETURN
        CASE (6)
            out = 0.0142857142857143*x2r
            RETURN
        END SELECT
    CASE (5)
        SELECT CASE (j)
        CASE (2)
            out = -0.0333333333333333*y1r
            RETURN
        CASE (4)
            out = 0.0333333333333333*y2r
            RETURN
        CASE (5)
            out = -0.0380952380952381
            RETURN
        CASE (7)
            out = 0.00634920634920635
            RETURN
        END SELECT
    CASE (6)
        SELECT CASE (j)
        CASE (1)
            out = 0.0285714285714286*y1t
            RETURN
        CASE (2)
            out = 0.0142857142857143*y1r
            RETURN
        CASE (3)
            out = -0.0285714285714286*y2t
            RETURN
        CASE (4)
            out = 0.0142857142857143*y2r
            RETURN
        CASE (6)
            out = -0.0126984126984127
            RETURN
        CASE (8)
            out = 0.00288600288600289
            RETURN
        END SELECT
    CASE (7)
        SELECT CASE (j)
        CASE (5)
            out = 0.00634920634920635
            RETURN
        CASE (7)
            out = -0.00577200577200577
            RETURN
        CASE (9)
            out = 0.00155400155400155
            RETURN
        END SELECT
    CASE (8)
        SELECT CASE (j)
        CASE (6)
            out = 0.00288600288600289
            RETURN
        CASE (8)
            out = -0.00310800310800311
            RETURN
        CASE (10)
            out = 0.000932400932400932
            RETURN
        END SELECT
    CASE (9)
        SELECT CASE (j)
        CASE (7)
            out = 0.00155400155400155
            RETURN
        CASE (9)
            out = -0.00186480186480186
            RETURN
        CASE (11)
            out = 0.000603318250377074
            RETURN
        END SELECT
    CASE (10)
        SELECT CASE (j)
        CASE (8)
            out = 0.000932400932400932
            RETURN
        CASE (10)
            out = -0.00120663650075415
            RETURN
        CASE (12)
            out = 0.000412796697626419
            RETURN
        END SELECT
    CASE (11)
        SELECT CASE (j)
        CASE (9)
            out = 0.000603318250377074
            RETURN
        CASE (11)
            out = -0.000825593395252838
            RETURN
        CASE (13)
            out = 0.000294854784018871
            RETURN
        END SELECT
    CASE (12)
        SELECT CASE (j)
        CASE (10)
            out = 0.000412796697626419
            RETURN
        CASE (12)
            out = -0.000589709568037741
            RETURN
        CASE (14)
            out = 0.000217936144709600
            RETURN
        END SELECT
    CASE (13)
        SELECT CASE (j)
        CASE (11)
            out = 0.000294854784018871
            RETURN
        CASE (13)
            out = -0.000435872289419200
            RETURN
        CASE (15)
            out = 0.000165631469979296
            RETURN
        END SELECT
    CASE (14)
        SELECT CASE (j)
        CASE (12)
            out = 0.000217936144709600
            RETURN
        CASE (14)
            out = -0.000331262939958592
            RETURN
        CASE (16)
            out = 0.000128824476650564
            RETURN
        END SELECT
    CASE (15)
        SELECT CASE (j)
        CASE (13)
            out = 0.000165631469979296
            RETURN
        CASE (15)
            out = -0.000257648953301127
            RETURN
        CASE (17)
            out = 0.000102171136653895
            RETURN
        END SELECT
    CASE (16)
        SELECT CASE (j)
        CASE (14)
            out = 0.000128824476650564
            RETURN
        CASE (16)
            out = -0.000204342273307791
            RETURN
        CASE (18)
            out = 8.23960779466897e-5
            RETURN
        END SELECT
    CASE (17)
        SELECT CASE (j)
        CASE (15)
            out = 0.000102171136653895
            RETURN
        CASE (17)
            out = -0.000164792155893379
            RETURN
        CASE (19)
            out = 6.74149728654734e-5
            RETURN
        END SELECT
    CASE (18)
        SELECT CASE (j)
        CASE (16)
            out = 8.23960779466897e-5
            RETURN
        CASE (18)
            out = -0.000134829945730947
            RETURN
        CASE (20)
            out = 5.58581203742494e-5
            RETURN
        END SELECT
    CASE (19)
        SELECT CASE (j)
        CASE (17)
            out = 6.74149728654734e-5
            RETURN
        CASE (19)
            out = -0.000111716240748499
            RETURN
        CASE (21)
            out = 4.68000468000468e-5
            RETURN
        END SELECT
    CASE (20)
        SELECT CASE (j)
        CASE (18)
            out = 5.58581203742494e-5
            RETURN
        CASE (20)
            out = -9.36000936000936e-5
            RETURN
        CASE (22)
            out = 3.96000396000396e-5
            RETURN
        END SELECT
    CASE (21)
        SELECT CASE (j)
        CASE (19)
            out = 4.68000468000468e-5
            RETURN
        CASE (21)
            out = -7.92000792000792e-5
            RETURN
        CASE (23)
            out = 3.38049118536923e-5
            RETURN
        END SELECT
    CASE (22)
        SELECT CASE (j)
        CASE (20)
            out = 3.96000396000396e-5
            RETURN
        CASE (22)
            out = -6.76098237073847e-5
            RETURN
        CASE (24)
            out = 2.90879474089911e-5
            RETURN
        END SELECT
    CASE (23)
        SELECT CASE (j)
        CASE (21)
            out = 3.38049118536923e-5
            RETURN
        CASE (23)
            out = -5.81758948179822e-5
            RETURN
        CASE (25)
            out = 2.52095544211256e-5
            RETURN
        END SELECT
    CASE (24)
        SELECT CASE (j)
        CASE (22)
            out = 2.90879474089911e-5
            RETURN
        CASE (24)
            out = -5.04191088422512e-5
            RETURN
        CASE (26)
            out = 2.19913134311947e-5
            RETURN
        END SELECT
    CASE (25)
        SELECT CASE (j)
        CASE (23)
            out = 2.52095544211256e-5
            RETURN
        CASE (25)
            out = -4.39826268623894e-5
            RETURN
        CASE (27)
            out = 1.92984995416606e-5
            RETURN
        END SELECT
    CASE (26)
        SELECT CASE (j)
        CASE (24)
            out = 2.19913134311947e-5
            RETURN
        CASE (26)
            out = -3.85969990833213e-5
            RETURN
        CASE (28)
            out = 1.70280878308770e-5
            RETURN
        END SELECT
    CASE (27)
        SELECT CASE (j)
        CASE (25)
            out = 1.92984995416606e-5
            RETURN
        CASE (27)
            out = -3.40561756617541e-5
            RETURN
        CASE (29)
            out = 1.51003797745513e-5
            RETURN
        END SELECT
    CASE (28)
        SELECT CASE (j)
        CASE (26)
            out = 1.70280878308770e-5
            RETURN
        CASE (28)
            out = -3.02007595491027e-5
            RETURN
        CASE (30)
            out = 1.34530656173275e-5
            RETURN
        END SELECT
    CASE (29)
        SELECT CASE (j)
        CASE (27)
            out = 1.51003797745513e-5
            RETURN
        CASE (29)
            out = -2.69061312346551e-5
            RETURN
        END SELECT
    CASE (30)
        SELECT CASE (j)
        CASE (28)
            out = 1.34530656173275e-5
            RETURN
        CASE (30)
            out = -2.40739068941651e-5
            RETURN
        END SELECT
    END SELECT
END SUBROUTINE integral_ffxixi


SUBROUTINE integral_fxifxi(i, j, x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r, out)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: i, j
    REAL*8, INTENT(IN) :: x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r
    REAL*8, INTENT(OUT) :: out
    out = 0
    SELECT CASE (i)
    CASE (1)
        SELECT CASE (j)
        CASE (1)
            out = 0.6*x1t*y1t
            RETURN
        CASE (2)
            out = 0.05*x1t*y1r
            RETURN
        CASE (3)
            out = -0.6*x1t*y2t
            RETURN
        CASE (4)
            out = 0.05*x1t*y2r
            RETURN
        CASE (6)
            out = -0.0285714285714286*x1t
            RETURN
        END SELECT
    CASE (2)
        SELECT CASE (j)
        CASE (1)
            out = 0.05*x1r*y1t
            RETURN
        CASE (2)
            out = 0.0666666666666667*x1r*y1r
            RETURN
        CASE (3)
            out = -0.05*x1r*y2t
            RETURN
        CASE (4)
            out = -0.0166666666666667*x1r*y2r
            RETURN
        CASE (5)
            out = 0.0333333333333333*x1r
            RETURN
        CASE (6)
            out = -0.0142857142857143*x1r
            RETURN
        END SELECT
    CASE (3)
        SELECT CASE (j)
        CASE (1)
            out = -0.6*x2t*y1t
            RETURN
        CASE (2)
            out = -0.05*x2t*y1r
            RETURN
        CASE (3)
            out = 0.6*x2t*y2t
            RETURN
        CASE (4)
            out = -0.05*x2t*y2r
            RETURN
        CASE (6)
            out = 0.0285714285714286*x2t
            RETURN
        END SELECT
    CASE (4)
        SELECT CASE (j)
        CASE (1)
            out = 0.05*x2r*y1t
            RETURN
        CASE (2)
            out = -0.0166666666666667*x2r*y1r
            RETURN
        CASE (3)
            out = -0.05*x2r*y2t
            RETURN
        CASE (4)
            out = 0.0666666666666667*x2r*y2r
            RETURN
        CASE (5)
            out = -0.0333333333333333*x2r
            RETURN
        CASE (6)
            out = -0.0142857142857143*x2r
            RETURN
        END SELECT
    CASE (5)
        SELECT CASE (j)
        CASE (2)
            out = 0.0333333333333333*y1r
            RETURN
        CASE (4)
            out = -0.0333333333333333*y2r
            RETURN
        CASE (5)
            out = 0.0380952380952381
            RETURN
        CASE (7)
            out = -0.00634920634920635
            RETURN
        END SELECT
    CASE (6)
        SELECT CASE (j)
        CASE (1)
            out = -0.0285714285714286*y1t
            RETURN
        CASE (2)
            out = -0.0142857142857143*y1r
            RETURN
        CASE (3)
            out = 0.0285714285714286*y2t
            RETURN
        CASE (4)
            out = -0.0142857142857143*y2r
            RETURN
        CASE (6)
            out = 0.0126984126984127
            RETURN
        CASE (8)
            out = -0.00288600288600289
            RETURN
        END SELECT
    CASE (7)
        SELECT CASE (j)
        CASE (5)
            out = -0.00634920634920635
            RETURN
        CASE (7)
            out = 0.00577200577200577
            RETURN
        CASE (9)
            out = -0.00155400155400155
            RETURN
        END SELECT
    CASE (8)
        SELECT CASE (j)
        CASE (6)
            out = -0.00288600288600289
            RETURN
        CASE (8)
            out = 0.00310800310800311
            RETURN
        CASE (10)
            out = -0.000932400932400932
            RETURN
        END SELECT
    CASE (9)
        SELECT CASE (j)
        CASE (7)
            out = -0.00155400155400155
            RETURN
        CASE (9)
            out = 0.00186480186480186
            RETURN
        CASE (11)
            out = -0.000603318250377074
            RETURN
        END SELECT
    CASE (10)
        SELECT CASE (j)
        CASE (8)
            out = -0.000932400932400932
            RETURN
        CASE (10)
            out = 0.00120663650075415
            RETURN
        CASE (12)
            out = -0.000412796697626419
            RETURN
        END SELECT
    CASE (11)
        SELECT CASE (j)
        CASE (9)
            out = -0.000603318250377074
            RETURN
        CASE (11)
            out = 0.000825593395252838
            RETURN
        CASE (13)
            out = -0.000294854784018871
            RETURN
        END SELECT
    CASE (12)
        SELECT CASE (j)
        CASE (10)
            out = -0.000412796697626419
            RETURN
        CASE (12)
            out = 0.000589709568037741
            RETURN
        CASE (14)
            out = -0.000217936144709600
            RETURN
        END SELECT
    CASE (13)
        SELECT CASE (j)
        CASE (11)
            out = -0.000294854784018871
            RETURN
        CASE (13)
            out = 0.000435872289419200
            RETURN
        CASE (15)
            out = -0.000165631469979296
            RETURN
        END SELECT
    CASE (14)
        SELECT CASE (j)
        CASE (12)
            out = -0.000217936144709600
            RETURN
        CASE (14)
            out = 0.000331262939958592
            RETURN
        CASE (16)
            out = -0.000128824476650564
            RETURN
        END SELECT
    CASE (15)
        SELECT CASE (j)
        CASE (13)
            out = -0.000165631469979296
            RETURN
        CASE (15)
            out = 0.000257648953301127
            RETURN
        CASE (17)
            out = -0.000102171136653895
            RETURN
        END SELECT
    CASE (16)
        SELECT CASE (j)
        CASE (14)
            out = -0.000128824476650564
            RETURN
        CASE (16)
            out = 0.000204342273307791
            RETURN
        CASE (18)
            out = -8.23960779466897e-5
            RETURN
        END SELECT
    CASE (17)
        SELECT CASE (j)
        CASE (15)
            out = -0.000102171136653895
            RETURN
        CASE (17)
            out = 0.000164792155893379
            RETURN
        CASE (19)
            out = -6.74149728654734e-5
            RETURN
        END SELECT
    CASE (18)
        SELECT CASE (j)
        CASE (16)
            out = -8.23960779466897e-5
            RETURN
        CASE (18)
            out = 0.000134829945730947
            RETURN
        CASE (20)
            out = -5.58581203742494e-5
            RETURN
        END SELECT
    CASE (19)
        SELECT CASE (j)
        CASE (17)
            out = -6.74149728654734e-5
            RETURN
        CASE (19)
            out = 0.000111716240748499
            RETURN
        CASE (21)
            out = -4.68000468000468e-5
            RETURN
        END SELECT
    CASE (20)
        SELECT CASE (j)
        CASE (18)
            out = -5.58581203742494e-5
            RETURN
        CASE (20)
            out = 9.36000936000936e-5
            RETURN
        CASE (22)
            out = -3.96000396000396e-5
            RETURN
        END SELECT
    CASE (21)
        SELECT CASE (j)
        CASE (19)
            out = -4.68000468000468e-5
            RETURN
        CASE (21)
            out = 7.92000792000792e-5
            RETURN
        CASE (23)
            out = -3.38049118536923e-5
            RETURN
        END SELECT
    CASE (22)
        SELECT CASE (j)
        CASE (20)
            out = -3.96000396000396e-5
            RETURN
        CASE (22)
            out = 6.76098237073847e-5
            RETURN
        CASE (24)
            out = -2.90879474089911e-5
            RETURN
        END SELECT
    CASE (23)
        SELECT CASE (j)
        CASE (21)
            out = -3.38049118536923e-5
            RETURN
        CASE (23)
            out = 5.81758948179822e-5
            RETURN
        CASE (25)
            out = -2.52095544211256e-5
            RETURN
        END SELECT
    CASE (24)
        SELECT CASE (j)
        CASE (22)
            out = -2.90879474089911e-5
            RETURN
        CASE (24)
            out = 5.04191088422512e-5
            RETURN
        CASE (26)
            out = -2.19913134311947e-5
            RETURN
        END SELECT
    CASE (25)
        SELECT CASE (j)
        CASE (23)
            out = -2.52095544211256e-5
            RETURN
        CASE (25)
            out = 4.39826268623894e-5
            RETURN
        CASE (27)
            out = -1.92984995416606e-5
            RETURN
        END SELECT
    CASE (26)
        SELECT CASE (j)
        CASE (24)
            out = -2.19913134311947e-5
            RETURN
        CASE (26)
            out = 3.85969990833213e-5
            RETURN
        CASE (28)
            out = -1.70280878308770e-5
            RETURN
        END SELECT
    CASE (27)
        SELECT CASE (j)
        CASE (25)
            out = -1.92984995416606e-5
            RETURN
        CASE (27)
            out = 3.40561756617541e-5
            RETURN
        CASE (29)
            out = -1.51003797745513e-5
            RETURN
        END SELECT
    CASE (28)
        SELECT CASE (j)
        CASE (26)
            out = -1.70280878308770e-5
            RETURN
        CASE (28)
            out = 3.02007595491027e-5
            RETURN
        CASE (30)
            out = -1.34530656173275e-5
            RETURN
        END SELECT
    CASE (29)
        SELECT CASE (j)
        CASE (27)
            out = -1.51003797745513e-5
            RETURN
        CASE (29)
            out = 2.69061312346551e-5
            RETURN
        END SELECT
    CASE (30)
        SELECT CASE (j)
        CASE (28)
            out = -1.34530656173275e-5
            RETURN
        CASE (30)
            out = 2.40739068941651e-5
            RETURN
        END SELECT
    END SELECT
END SUBROUTINE integral_fxifxi


SUBROUTINE integral_fxifxixi(i, j, x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r, out)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: i, j
    REAL*8, INTENT(IN) :: x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r
    REAL*8, INTENT(OUT) :: out
    out = 0
    SELECT CASE (i)
    CASE (1)
        SELECT CASE (j)
        CASE (2)
            out = 0.25*x1t*y1r
            RETURN
        CASE (4)
            out = -0.25*x1t*y2r
            RETURN
        CASE (5)
            out = 0.2*x1t
            RETURN
        END SELECT
    CASE (2)
        SELECT CASE (j)
        CASE (1)
            out = -0.25*x1r*y1t
            RETURN
        CASE (2)
            out = -0.125*x1r*y1r
            RETURN
        CASE (3)
            out = 0.25*x1r*y2t
            RETURN
        CASE (4)
            out = -0.125*x1r*y2r
            RETURN
        CASE (5)
            out = 0.1*x1r
            RETURN
        END SELECT
    CASE (3)
        SELECT CASE (j)
        CASE (2)
            out = -0.25*x2t*y1r
            RETURN
        CASE (4)
            out = 0.25*x2t*y2r
            RETURN
        CASE (5)
            out = -0.2*x2t
            RETURN
        END SELECT
    CASE (4)
        SELECT CASE (j)
        CASE (1)
            out = 0.25*x2r*y1t
            RETURN
        CASE (2)
            out = 0.125*x2r*y1r
            RETURN
        CASE (3)
            out = -0.25*x2r*y2t
            RETURN
        CASE (4)
            out = 0.125*x2r*y2r
            RETURN
        CASE (5)
            out = 0.1*x2r
            RETURN
        END SELECT
    CASE (5)
        SELECT CASE (j)
        CASE (1)
            out = -0.2*y1t
            RETURN
        CASE (2)
            out = -0.1*y1r
            RETURN
        CASE (3)
            out = 0.2*y2t
            RETURN
        CASE (4)
            out = -0.1*y2r
            RETURN
        CASE (6)
            out = 0.0571428571428571
            RETURN
        END SELECT
    CASE (6)
        SELECT CASE (j)
        CASE (5)
            out = -0.0571428571428571
            RETURN
        CASE (7)
            out = 0.0317460317460317
            RETURN
        END SELECT
    CASE (7)
        SELECT CASE (j)
        CASE (6)
            out = -0.0317460317460317
            RETURN
        CASE (8)
            out = 0.0202020202020202
            RETURN
        END SELECT
    CASE (8)
        SELECT CASE (j)
        CASE (7)
            out = -0.0202020202020202
            RETURN
        CASE (9)
            out = 0.0139860139860140
            RETURN
        END SELECT
    CASE (9)
        SELECT CASE (j)
        CASE (8)
            out = -0.0139860139860140
            RETURN
        CASE (10)
            out = 0.0102564102564103
            RETURN
        END SELECT
    CASE (10)
        SELECT CASE (j)
        CASE (9)
            out = -0.0102564102564103
            RETURN
        CASE (11)
            out = 0.00784313725490196
            RETURN
        END SELECT
    CASE (11)
        SELECT CASE (j)
        CASE (10)
            out = -0.00784313725490196
            RETURN
        CASE (12)
            out = 0.00619195046439629
            RETURN
        END SELECT
    CASE (12)
        SELECT CASE (j)
        CASE (11)
            out = -0.00619195046439629
            RETURN
        CASE (13)
            out = 0.00501253132832080
            RETURN
        END SELECT
    CASE (13)
        SELECT CASE (j)
        CASE (12)
            out = -0.00501253132832080
            RETURN
        CASE (14)
            out = 0.00414078674948240
            RETURN
        END SELECT
    CASE (14)
        SELECT CASE (j)
        CASE (13)
            out = -0.00414078674948240
            RETURN
        CASE (15)
            out = 0.00347826086956522
            RETURN
        END SELECT
    CASE (15)
        SELECT CASE (j)
        CASE (14)
            out = -0.00347826086956522
            RETURN
        CASE (16)
            out = 0.00296296296296296
            RETURN
        END SELECT
    CASE (16)
        SELECT CASE (j)
        CASE (15)
            out = -0.00296296296296296
            RETURN
        CASE (17)
            out = 0.00255427841634738
            RETURN
        END SELECT
    CASE (17)
        SELECT CASE (j)
        CASE (16)
            out = -0.00255427841634738
            RETURN
        CASE (18)
            out = 0.00222469410456062
            RETURN
        END SELECT
    CASE (18)
        SELECT CASE (j)
        CASE (17)
            out = -0.00222469410456062
            RETURN
        CASE (19)
            out = 0.00195503421309873
            RETURN
        END SELECT
    CASE (19)
        SELECT CASE (j)
        CASE (18)
            out = -0.00195503421309873
            RETURN
        CASE (20)
            out = 0.00173160173160173
            RETURN
        END SELECT
    CASE (20)
        SELECT CASE (j)
        CASE (19)
            out = -0.00173160173160173
            RETURN
        CASE (21)
            out = 0.00154440154440154
            RETURN
        END SELECT
    CASE (21)
        SELECT CASE (j)
        CASE (20)
            out = -0.00154440154440154
            RETURN
        CASE (22)
            out = 0.00138600138600139
            RETURN
        END SELECT
    CASE (22)
        SELECT CASE (j)
        CASE (21)
            out = -0.00138600138600139
            RETURN
        CASE (23)
            out = 0.00125078173858662
            RETURN
        END SELECT
    CASE (23)
        SELECT CASE (j)
        CASE (22)
            out = -0.00125078173858662
            RETURN
        CASE (24)
            out = 0.00113442994895065
            RETURN
        END SELECT
    CASE (24)
        SELECT CASE (j)
        CASE (23)
            out = -0.00113442994895065
            RETURN
        CASE (25)
            out = 0.00103359173126615
            RETURN
        END SELECT
    CASE (25)
        SELECT CASE (j)
        CASE (24)
            out = -0.00103359173126615
            RETURN
        CASE (26)
            out = 0.000945626477541371
            RETURN
        END SELECT
    CASE (26)
        SELECT CASE (j)
        CASE (25)
            out = -0.000945626477541371
            RETURN
        CASE (27)
            out = 0.000868432479374729
            RETURN
        END SELECT
    CASE (27)
        SELECT CASE (j)
        CASE (26)
            out = -0.000868432479374729
            RETURN
        CASE (28)
            out = 0.000800320128051221
            RETURN
        END SELECT
    CASE (28)
        SELECT CASE (j)
        CASE (27)
            out = -0.000800320128051221
            RETURN
        CASE (29)
            out = 0.000739918608953015
            RETURN
        END SELECT
    CASE (29)
        SELECT CASE (j)
        CASE (28)
            out = -0.000739918608953015
            RETURN
        CASE (30)
            out = 0.000686106346483705
            RETURN
        END SELECT
    CASE (30)
        SELECT CASE (j)
        CASE (29)
            out = -0.000686106346483705
            RETURN
        END SELECT
    END SELECT
END SUBROUTINE integral_fxifxixi


SUBROUTINE integral_fxixifxixi(i, j, x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r, out)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: i, j
    REAL*8, INTENT(IN) :: x1t, x1r, x2t, x2r, y1t, y1r, y2t, y2r
    REAL*8, INTENT(OUT) :: out
    out = 0
    SELECT CASE (i)
    CASE (1)
        SELECT CASE (j)
        CASE (1)
            out = 1.5*x1t*y1t
            RETURN
        CASE (2)
            out = 0.75*x1t*y1r
            RETURN
        CASE (3)
            out = -1.5*x1t*y2t
            RETURN
        CASE (4)
            out = 0.75*x1t*y2r
            RETURN
        END SELECT
    CASE (2)
        SELECT CASE (j)
        CASE (1)
            out = 0.75*x1r*y1t
            RETURN
        CASE (2)
            out = 0.5*x1r*y1r
            RETURN
        CASE (3)
            out = -0.75*x1r*y2t
            RETURN
        CASE (4)
            out = 0.25*x1r*y2r
            RETURN
        END SELECT
    CASE (3)
        SELECT CASE (j)
        CASE (1)
            out = -1.5*x2t*y1t
            RETURN
        CASE (2)
            out = -0.75*x2t*y1r
            RETURN
        CASE (3)
            out = 1.5*x2t*y2t
            RETURN
        CASE (4)
            out = -0.75*x2t*y2r
            RETURN
        END SELECT
    CASE (4)
        SELECT CASE (j)
        CASE (1)
            out = 0.75*x2r*y1t
            RETURN
        CASE (2)
            out = 0.25*x2r*y1r
            RETURN
        CASE (3)
            out = -0.75*x2r*y2t
            RETURN
        CASE (4)
            out = 0.5*x2r*y2r
            RETURN
        END SELECT
    CASE (5)
        SELECT CASE (j)
        CASE (5)
            out = 0.400000000000000
            RETURN
        END SELECT
    CASE (6)
        SELECT CASE (j)
        CASE (6)
            out = 0.285714285714286
            RETURN
        END SELECT
    CASE (7)
        SELECT CASE (j)
        CASE (7)
            out = 0.222222222222222
            RETURN
        END SELECT
    CASE (8)
        SELECT CASE (j)
        CASE (8)
            out = 0.181818181818182
            RETURN
        END SELECT
    CASE (9)
        SELECT CASE (j)
        CASE (9)
            out = 0.153846153846154
            RETURN
        END SELECT
    CASE (10)
        SELECT CASE (j)
        CASE (10)
            out = 0.133333333333333
            RETURN
        END SELECT
    CASE (11)
        SELECT CASE (j)
        CASE (11)
            out = 0.117647058823529
            RETURN
        END SELECT
    CASE (12)
        SELECT CASE (j)
        CASE (12)
            out = 0.105263157894737
            RETURN
        END SELECT
    CASE (13)
        SELECT CASE (j)
        CASE (13)
            out = 0.0952380952380952
            RETURN
        END SELECT
    CASE (14)
        SELECT CASE (j)
        CASE (14)
            out = 0.0869565217391304
            RETURN
        END SELECT
    CASE (15)
        SELECT CASE (j)
        CASE (15)
            out = 0.0800000000000000
            RETURN
        END SELECT
    CASE (16)
        SELECT CASE (j)
        CASE (16)
            out = 0.0740740740740741
            RETURN
        END SELECT
    CASE (17)
        SELECT CASE (j)
        CASE (17)
            out = 0.0689655172413793
            RETURN
        END SELECT
    CASE (18)
        SELECT CASE (j)
        CASE (18)
            out = 0.0645161290322581
            RETURN
        END SELECT
    CASE (19)
        SELECT CASE (j)
        CASE (19)
            out = 0.0606060606060606
            RETURN
        END SELECT
    CASE (20)
        SELECT CASE (j)
        CASE (20)
            out = 0.0571428571428571
            RETURN
        END SELECT
    CASE (21)
        SELECT CASE (j)
        CASE (21)
            out = 0.0540540540540541
            RETURN
        END SELECT
    CASE (22)
        SELECT CASE (j)
        CASE (22)
            out = 0.0512820512820513
            RETURN
        END SELECT
    CASE (23)
        SELECT CASE (j)
        CASE (23)
            out = 0.0487804878048781
            RETURN
        END SELECT
    CASE (24)
        SELECT CASE (j)
        CASE (24)
            out = 0.0465116279069767
            RETURN
        END SELECT
    CASE (25)
        SELECT CASE (j)
        CASE (25)
            out = 0.0444444444444444
            RETURN
        END SELECT
    CASE (26)
        SELECT CASE (j)
        CASE (26)
            out = 0.0425531914893617
            RETURN
        END SELECT
    CASE (27)
        SELECT CASE (j)
        CASE (27)
            out = 0.0408163265306122
            RETURN
        END SELECT
    CASE (28)
        SELECT CASE (j)
        CASE (28)
            out = 0.0392156862745098
            RETURN
        END SELECT
    CASE (29)
        SELECT CASE (j)
        CASE (29)
            out = 0.0377358490566038
            RETURN
        END SELECT
    CASE (30)
        SELECT CASE (j)
        CASE (30)
            out = 0.0363636363636364
            RETURN
        END SELECT
    END SELECT
END SUBROUTINE integral_fxixifxixi

END MODULE BARDELL
