--------------------------------------------------------------------------------

i need help to write a code that is very difficult for me i have to know the mathematical formula
explain
example
1.i have 6 groups x 5 textboxes each one with random numbers from 1....8 and each group has unique numbers not doubles (within each group)
2 theses numbers i split them to odd,even,sml,big(small numbers are lower than mnumber5) and (big numbers are numbers bigger than number 5 )
i add all the values of them and gives me a number the total number

example
odd+even+small+big = total
75+58+65+68=266
the random numbers in each group are
group 1 9,5,2,3,6
group 2 9,3,1,5,8
group 3 1,2,5,4,6
group 4 8,7,4,2,3
group 5 2,5,8,3,4
group 6 2,3,1,5,7

another example with the same total number 266

odd+even+small+big=total
59+74+58+75=266

the random numbers are

group 1 5,2,6,1,3
group 2 7,3,8,2,6
group 3 3,8,6,5,7
group 4 5,3,8,1,4
group 5 2,4,6,3,5
group 6 2,4,6,1,7


i want to know the formula that, giving a total number the code will put the apropriate random numbers instead the result after the addition of odd,even,small,big to be the same like the total number that i give
in other words how many combinations are equal to total number 266
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
thank you
memas